🤖AI & LLM Integration

This page provides comprehensive information on the architectural aspects of our system's AI & LLM implementation.

Our plan involves the integration of an LLM (Mistral AI) into the platform. The objective is to enable the LLM to interact with the database and present the results in a format that is easily understandable by humans. The LLM will be granted a read-only role, allowing it to access the database without the ability to make any modifications. Two LLM agents will be used: LLM1, responsible for converting user prompts into queries that can be executed against the database, and LLM2, tasked with interpreting the results of the database queries.

This will consist of the following parts:

  1. The SqlGen agent (LLM1) should have a system prompt that provides information about the available tables, including their data content and column structure. The descriptions of the tables can be stored in a new table within Supabase and updated using Appsmith.

  2. The SqlTransformer agent (LLM2) will subsequently execute the generated query produced by SqlGen against the database.

  3. In the event of an error or syntax error, both the query and the error should be forwarded to the SqlErrorCorrector agent (LLM3). SqlErrorCorrector will then make an attempt to rectify the query, enabling SqlTransformer to retry its execution.

  4. This process will persist until either the maximum number of retries is reached or the query is executed successfully.

  5. SqlTransformer will be equipped with a system prompt that outlines its purpose, which is to convert a JSON query result into a format that is easily readable by humans. The system prompt will also include the descriptions and schemas of the tables. Following the successful execution of a query, SqlTransformer will convert the JSON result into human-readable text and provide it as the output.

  6. Each of the preceding steps will be executed on a dedicated server. This server will primarily run an Express API, which will handle the processing of the steps and return the result obtained from step 5 as its response.

  7. The obtained result will be presented on the frontend interface for display.

Last updated