You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pgml-cms/docs/getting-started/connect-to-the-database.md
+58-7Lines changed: 58 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,18 @@
2
2
description: PostgresML is compatible with all standard PostgreSQL clients
3
3
---
4
4
5
-
# Connecting
6
-
7
-
### Connecting
5
+
# Connect your app
8
6
9
7
You can connect to your database from any Postgres compatible client. PostgresML is intended to serve in the traditional role of an application database, along with it's extended role as an MLOps platform to make it easy to build and maintain AI applications. 
10
8
11
-
####Application SDKs
9
+
### Application SDKs
12
10
13
-
We provide client SDKs for JavaScript, Python and Rust apps that manage connections to the Postgres database and make it easy to construct efficient queries for AI use cases, like managing a document collection for RAG, or building a chatbot. All of the ML & AI still happens in the database, with centralized operations, hardware and dependency management.
11
+
We provide client SDKs for JavaScript, Python and Rust apps that manage connections to the Postgres database and make it easy to construct efficient queries for AI use cases, like managing a document collection for RAG, or building a chatbot. All of the ML & AI still happens in the database, with centralized operations, hardware and dependency management.
14
12
15
13
These SDKs are under rapid development to add new features and use cases, but we release non breaking changes with minor version updates in accordance with SemVer. It's easy to install into your existing application.
16
14
15
+
#### Installation
16
+
17
17
{% tabs %}
18
18
{% tab title="JavaScript" %}
19
19
```
@@ -28,7 +28,58 @@ pip install pgml
28
28
{% endtab %}
29
29
{% endtabs %}
30
30
31
-
#### Native Language Bindings
31
+
#### Test the connection
32
+
33
+
{% tabs %}
34
+
{% tab title="JavaScript" %}
35
+
```
36
+
const pgml = require("pgml");
37
+
38
+
const main = async () => {
39
+
const client = pgml.newOpenSourceAI();
40
+
const results = client.chat_completions_create(
41
+
"mistralai/Mistral-7B-Instruct-v0.1",
42
+
[
43
+
{
44
+
role: "system",
45
+
content: "You are a friendly chatbot who always responds in the style of a pirate",
46
+
},
47
+
{
48
+
role: "user",
49
+
content: "How many helicopters can a human eat in one sitting?",
50
+
},
51
+
],
52
+
);
53
+
console.log(results);
54
+
```
55
+
{% endtab %}
56
+
57
+
{% tab title="Python" %}
58
+
```
59
+
import pgml
60
+
61
+
async def main():
62
+
client = pgml.OpenSourceAI()
63
+
results = client.chat_completions_create(
64
+
"mistralai/Mistral-7B-Instruct-v0.1",
65
+
[
66
+
{
67
+
"role": "system",
68
+
"content": "You are a friendly chatbot who always responds in the style of a pirate",
69
+
},
70
+
{
71
+
"role": "user",
72
+
"content": "How many helicopters can a human eat in one sitting?",
73
+
},
74
+
],
75
+
temperature=0.85,
76
+
)
77
+
print(results)
78
+
```
79
+
{% endtab %}
80
+
{% endtabs %}
81
+
82
+
### Native Language Bindings
32
83
33
84
You can also connect directly to the database with your favorite bindings or ORM:
34
85
@@ -49,7 +100,7 @@ You can also connect directly to the database with your favorite bindings or ORM
49
100
* Rust: [postgres](https://crates.io/crates/postgres), [SQLx](https://github.com/launchbadge/sqlx) or [Diesel](https://github.com/diesel-rs/diesel)
50
101
* Swift: [PostgresNIO](https://github.com/vapor/postgres-nio) or [PostgresClientKit](https://github.com/codewinsdotcom/PostgresClientKit)
51
102
52
-
####SQL Editors
103
+
### SQL Editors
53
104
54
105
Use any of these popular tools to execute SQL queries directly against the database:
0 commit comments