SQLAI.ai

Model's Maximum Context Length Exceeded

Example of the model's maximum context length exceeded error
Example of the model's maximum context length exceeded error

The error occurs if the added database schema is too large for AI to handle at once. The way to solve this is to exclude tables from the database schema that is send to AI. On the app page click on the "Data source" button (it can also have the name of your data source) and then toggle off the tables that you don't want to include:

You can also see the "Token usage" showing how many tokens the current selections will add to the AI request.

It isn't possible to limit the size when the data source is imported in "any format". It has to be CSV, manual or connected.

Multiple Data Sources

An alternative approach would be to shrink the imported database schema. If the database schema is very large then importing it as separate data sources could be useful, e.g. "customers information", "performance information", "blog information" and so on. Then the user can switch between each data source depending on the desired data.