-
Notifications
You must be signed in to change notification settings - Fork 13
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 #143 from mindsdb/staging
Release 3.1.0
- Loading branch information
Showing
8 changed files
with
102 additions
and
92 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
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,33 @@ | ||
import mindsdb_sdk | ||
from uuid import uuid4 | ||
import os | ||
|
||
con = mindsdb_sdk.connect() | ||
|
||
open_ai_key = os.getenv('OPENAI_API_KEY') | ||
model_name = 'gpt-4o' | ||
|
||
# Now create an agent that will use the model we just created. | ||
agent = con.agents.create(name=f'mindsdb_retrieval_agent_{model_name}_{uuid4().hex}', | ||
model=model_name, | ||
params={'return_context': True}) | ||
|
||
agent.add_file('./data/tokaido-rulebook.pdf', 'rule book for the board game Tokaido') | ||
|
||
question = "what are the rules for the game takaido?" | ||
|
||
# Stream the completion | ||
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) |
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.0.2' | ||
__version__ = '3.1.0' | ||
__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
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
Oops, something went wrong.