Skip to content

Commit d89f343

Browse files
authored
Merge pull request #149 from mindsdb/main
Release 3.1.1
2 parents 8e17af6 + 9a23f3e commit d89f343

File tree

7 files changed

+62
-14
lines changed

7 files changed

+62
-14
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Release
22

33
on:
4-
push:
5-
branches:
6-
- stable
4+
release:
5+
types: [published]
76

87
jobs:
98
test:

.github/workflows/mindsdb_python_sdk.yml renamed to .github/workflows/test_prs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: PR workflow
33
on:
44
pull_request:
55
branches:
6-
- stable
7-
- staging
6+
- main
87

98
jobs:
109
test:

examples/using_agents_with_streaming_with_retrieval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
agent.add_file('./data/tokaido-rulebook.pdf', 'rule book for the board game Tokaido')
1616

17-
question = "what are the rules for the game takaido?"
17+
question = "what are the rules for the game tokaido?"
1818

1919
# Stream the completion
2020
completion_stream = agent.completion_stream([{'question': question, 'answer': None}])
@@ -30,4 +30,4 @@
3030
full_response += chunk
3131

3232
print("\n\nFull response:")
33-
print(full_response)
33+
print(full_response)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import mindsdb_sdk
2+
from uuid import uuid4
3+
import os
4+
5+
con = mindsdb_sdk.connect()
6+
7+
open_ai_key = os.getenv('OPENAI_API_KEY')
8+
model_name = 'gpt-4'
9+
10+
# Now create an agent that will use the model we just created.
11+
agent = con.agents.create(name=f'mindsdb_sql_agent_{model_name}_{uuid4().hex}',
12+
model='gpt-4')
13+
14+
15+
# Set up a Postgres data source with our new agent.
16+
data_source = 'postgres'
17+
connection_args = {
18+
"user": "demo_user",
19+
"password": "demo_password",
20+
"host": "samples.mindsdb.com",
21+
"port": "5432",
22+
"database": "demo",
23+
"schema": "demo_data"
24+
}
25+
description = 'mindsdb demo database'
26+
database = con.databases.create(
27+
f'mindsdb_sql_agent_datasource_{uuid4().hex}',
28+
data_source,
29+
connection_args
30+
)
31+
32+
# Actually connect the agent to the datasource.
33+
agent.add_database(database.name, [], description)
34+
35+
36+
question = 'How many three-bedroom houses were sold in 2008?'
37+
38+
completion_stream = agent.completion_stream([{'question': question, 'answer': None}])
39+
40+
# Process the streaming response
41+
full_response = ""
42+
for chunk in completion_stream:
43+
print(chunk) # Print the entire chunk for debugging
44+
if isinstance(chunk, dict):
45+
if 'output' in chunk:
46+
full_response += chunk['output']
47+
elif isinstance(chunk, str):
48+
full_response += chunk
49+
50+
print("\n\nFull response:")
51+
print(full_response)
52+
53+
con.databases.drop(database.name)
54+
con.agents.drop(agent.name)

examples/using_database_mind_text2sql.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
# Load MindsDB API key from environment variable. or set it here.
99
MINDSDB_API_KEY = os.getenv('MINDSDB_API_KEY')
1010

11-
# Set the model name for mind to use
12-
model_name = 'gpt-4'
13-
1411
# Set the base URL for the MindsDB LiteLLM proxy.
15-
base_url = 'https://ai.dev.mindsdb.com'
12+
base_url = 'https://llm.mdb.ai'
1613

1714

1815
# Connect to MindsDB LiteLLM proxy.
@@ -42,7 +39,6 @@
4239
api_key= MINDSDB_API_KEY,
4340
name = f'my_house_data_mind_{uuid4().hex}',
4441
data_source_configs=[pg_config],
45-
model= model_name
4642
)
4743

4844
# Actually pass in our tool to get a SQL completion.

mindsdb_sdk/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'mindsdb_sdk'
22
__package_name__ = 'mindsdb_sdk'
3-
__version__ = '3.1.0'
3+
__version__ = '3.1.1'
44
__description__ = "MindsDB Python SDK, provides an SDK to use a remote mindsdb instance"
55
__email__ = "[email protected]"
66
__author__ = 'MindsDB Inc'

mindsdb_sdk/connectors/rest_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def agent_completion(self, project: str, name: str, messages: List[dict]):
279279
@_try_relogin
280280
def agent_completion_stream(self, project: str, name: str, messages: List[dict]):
281281
url = self.url + f'/api/projects/{project}/agents/{name}/completions/stream'
282-
stream = requests.post(url, json={'messages': messages}, stream=True)
282+
stream = self.session.post(url, json={'messages': messages}, stream=True)
283283
client = SSEClient(stream)
284284
for chunk in client.events():
285285
# Stream objects loaded from SSE events 'data' param.

0 commit comments

Comments
 (0)