You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a few examples in our docs to showcase how to create agents, add skills, etc., using the Python SDK. Initial example:
importmindsdb_sdkfromuuidimportuuid4con=mindsdb_sdk.connect()
# Now create an agent that will use the model we just created.agent=con.agents.create(name=f'mindsdb_sql_agent_{uuid4().hex}',
model={'model_name':'gpt-4',
params={'openai_api_key':'sk-'})
# 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='house sales data'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)
print('Ask a question: ')
question='What is the average price of homes?'answer=agent.completion([{'question': question, 'answer': None}])
print(answer.content)
The text was updated successfully, but these errors were encountered:
We need a few examples in our docs to showcase how to create agents, add skills, etc., using the Python SDK. Initial example:
The text was updated successfully, but these errors were encountered: