How it Works
When you add the database query tool and the specified database context to your API request, Zylon follows these steps:- Analyzes natural language: Zylon interprets your natural language question and understands what data you’re looking for.
- Generates SQL query: Automatically converts your question into the appropriate SQL query based on the database schema.
- Executes query: Runs the generated SQL query against your specified database connection.
- Returns results: Provides a coherent results based in the database response.
Important Notes
- To use this tool, you must specify the type
database_query_v1
. - The
tool_context
must contain at least onesql_database
with a validconnection_string
. - You can use
/v1/messages/validate
to validate connectivity before. - The tool automatically generates SQL queries from natural language - no SQL knowledge required.
- Results contains the SQL query, and results. If the content is too long, it will create a CSV file.
- SSL connections are supported through the
ssl
parameter in the tool context. - Detailed instructions on how to establish database connections Database Connector documentation.
Example Usage
In this practical example, we connect to a SQL Server database and query customer information using natural language.1
Perform Database Query
Send a request with your natural language question and the database connection details. The tool will automatically generate and execute the appropriate SQL query.
2
Response
The system responds with the generated SQL query, execution results, and a natural language answer: