File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1
1
__title__ = 'mindsdb_sdk'
2
2
__package_name__ = 'mindsdb_sdk'
3
- __version__ = '2.3 .0'
3
+ __version__ = '2.4 .0'
4
4
__description__ = "MindsDB Python SDK, provides an SDK to use a remote mindsdb instance"
5
5
6
6
__author__ = 'MindsDB Inc'
Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+
4
+ # Define the Mind entity
5
+ class Mind :
6
+ """
7
+ Mind entity
8
+ """
9
+
10
+ def __init__ (self , name ):
11
+ self .name = name
12
+
13
+
14
+ # Create mind entity util function
15
+ def create (
16
+ base_url : str ,
17
+ api_key : str ,
18
+ model : str ,
19
+ connection_args : dict ,
20
+ data_source : str ,
21
+ description : str ,
22
+ ) -> Mind :
23
+ """
24
+ Create a mind entity in LiteLLM proxy.
25
+
26
+ Args:
27
+ base_url: MindsDB base URL
28
+ api_key: MindsDB API key
29
+ model: Model name
30
+ connection_args: Connection arguments
31
+ data_source: Data source
32
+ description: Description
33
+
34
+ Returns:
35
+ Mind: Mind entity
36
+ """
37
+ url = f"{ base_url } /minds"
38
+ headers = {"Authorization" : f"Bearer { api_key } " }
39
+ payload = {
40
+ "model" : model ,
41
+ "connection_args" : connection_args ,
42
+ "data_source" : data_source ,
43
+ "description" : description
44
+ }
45
+ response = requests .post (url , json = payload , headers = headers )
46
+ response .raise_for_status ()
47
+
48
+ name = response .json ()['name' ]
49
+
50
+ return Mind (name = name )
You can’t perform that action at this time.
0 commit comments