from minds.client import Client
from minds.datasources import DatabaseConfig
client = Client("MINDS_API_KEY")
postgres_config = DatabaseConfig(
name='unique_data_source_name',
description='House sales data',
engine='postgres',
connection_data={
'user': 'demo_user',
'password': 'demo_password',
'host': 'samples.mindsdb.com',
'port': '5432',
'database': 'demo',
'schema': 'demo_data'
},
tables=['house_sales']
)
datasource = client.datasources.create(postgres_config, update=True)
mind = client.minds.create(
name='unique_mind_name',
datasources=[datasource],
prompt_template='answer questions in a helpful way using the available data',
update=True
)
print(f"{mind.name} was created successfully. You can now use this Mind using the OpenAI-compatible API, see docs for next steps.")