File tree 1 file changed +17
-11
lines changed
1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change 1
1
from uuid import uuid4
2
2
3
3
from openai import OpenAI
4
- from mindsdb_sdk .utils .mind import create_mind
4
+ from mindsdb_sdk .utils .mind import create_mind , DatabaseConfig
5
5
import os
6
6
7
7
21
21
base_url = base_url
22
22
)
23
23
24
- # create a database mind
25
- mind = create_mind (
26
- name = f'my_house_data_mind_{ uuid4 ().hex } ' ,
27
- description = 'House Sales' ,
28
- base_url = base_url ,
29
- api_key = MINDSDB_API_KEY ,
30
- model = model_name ,
31
- data_source_type = 'postgres' ,
32
- data_source_connection_args = {
24
+ # Create a Database Config.
25
+ pg_config = DatabaseConfig (
26
+ description = 'House Sales' ,
27
+ type = 'postgres' ,
28
+ connection_args = {
33
29
'user' : 'demo_user' ,
34
30
'password' : 'demo_password' ,
35
31
'host' : 'samples.mindsdb.com' ,
36
32
'port' : '5432' ,
37
33
'database' : 'demo' ,
38
34
'schema' : 'demo_data'
39
- }
35
+ },
36
+ tables = ['house_sales' ]
37
+ )
38
+
39
+ # create a database mind
40
+ mind = create_mind (
41
+ base_url = base_url ,
42
+ api_key = MINDSDB_API_KEY ,
43
+ name = f'my_house_data_mind_{ uuid4 ().hex } ' ,
44
+ data_source_configs = [pg_config ],
45
+ model = model_name
40
46
)
41
47
42
48
# Actually pass in our tool to get a SQL completion.
You can’t perform that action at this time.
0 commit comments