HomeGuidesAPI ReferenceRelease notes
Log In
Guides

SQL DB context

By using the SQL DB context option, you can connect your database and provide the model with valuable context, improving the quality of interactions.

Hereโ€™s how you can do it:

Database support and configuration

๐Ÿ“˜

Supported DB's

Ensure that your database is one of the following supported types:

  • PostgreSQL (dialect: postgresql)
  • MySQL and MariaDB (dialect: mysql)
  • Oracle (dialect: oracle)
  • Microsoft SQL Server (dialect: mssql)
  • BigQuery

โ—๏ธ

Password limitations

Please note that passwords should not contain the characters @ and :. If your password includes these characters, you will need to modify them in your connection string as follows:

๐Ÿ“˜

Database Query Limit Notice

To maintain optimal performance, each query is currently capped at a limit of 100 entries.

๐Ÿšง

Postgres table schema

Please ensure that all column names are in lowercase with no capital letters.

Using the UI

Step 1: Add the Context

Click on theย "+ Cool" button, and then SQL DB tool" start setting up the database connection.

Step 2: Configure the Context

  • Assign aย meaningful nameย to the tool.
  • Database Selection and Connection: Identify and connect to your chosen database by providing the requisite details:
    • For BigQuery:
      • Specify your BigQuery project.
      • Input the BigQuery dataset you intend to query.
      • Input your GCP service account information for credential validation (in a JSON format).
    • For Other Database Types:
      • Construct your Database URL in the format: dialect://username:password@host:port/database. Ensure you replace the placeholders with actual values specific to your database credentials and connection information.
  • Select specific tables for your Context: To enhance application performance and control access to specific tables in your database, you can configure your application to access only selected tables. You have the flexibility to choose which tables your tool can access, grant access to all tables if needed, and enable automatic inclusion of any new tables added to the database.

Using the SDK

You can find the complete creation flow of the "AI Assistant Retrieval" application here. This SDK code snippet pertains to the creation of the SQL DB context within this flow.