-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from mindsdb/main
Release 3.1.1
- Loading branch information
Showing
7 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- stable | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ name: PR workflow | |
on: | ||
pull_request: | ||
branches: | ||
- stable | ||
- staging | ||
- main | ||
|
||
jobs: | ||
test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import mindsdb_sdk | ||
from uuid import uuid4 | ||
import os | ||
|
||
con = mindsdb_sdk.connect() | ||
|
||
open_ai_key = os.getenv('OPENAI_API_KEY') | ||
model_name = 'gpt-4' | ||
|
||
# Now create an agent that will use the model we just created. | ||
agent = con.agents.create(name=f'mindsdb_sql_agent_{model_name}_{uuid4().hex}', | ||
model='gpt-4') | ||
|
||
|
||
# Set up a Postgres data source with our new agent. | ||
data_source = 'postgres' | ||
connection_args = { | ||
"user": "demo_user", | ||
"password": "demo_password", | ||
"host": "samples.mindsdb.com", | ||
"port": "5432", | ||
"database": "demo", | ||
"schema": "demo_data" | ||
} | ||
description = 'mindsdb demo database' | ||
database = con.databases.create( | ||
f'mindsdb_sql_agent_datasource_{uuid4().hex}', | ||
data_source, | ||
connection_args | ||
) | ||
|
||
# Actually connect the agent to the datasource. | ||
agent.add_database(database.name, [], description) | ||
|
||
|
||
question = 'How many three-bedroom houses were sold in 2008?' | ||
|
||
completion_stream = agent.completion_stream([{'question': question, 'answer': None}]) | ||
|
||
# Process the streaming response | ||
full_response = "" | ||
for chunk in completion_stream: | ||
print(chunk) # Print the entire chunk for debugging | ||
if isinstance(chunk, dict): | ||
if 'output' in chunk: | ||
full_response += chunk['output'] | ||
elif isinstance(chunk, str): | ||
full_response += chunk | ||
|
||
print("\n\nFull response:") | ||
print(full_response) | ||
|
||
con.databases.drop(database.name) | ||
con.agents.drop(agent.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
__title__ = 'mindsdb_sdk' | ||
__package_name__ = 'mindsdb_sdk' | ||
__version__ = '3.1.0' | ||
__version__ = '3.1.1' | ||
__description__ = "MindsDB Python SDK, provides an SDK to use a remote mindsdb instance" | ||
__email__ = "[email protected]" | ||
__author__ = 'MindsDB Inc' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters