Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, and more.
https://anythingllm.com
MIT License
24.36k stars 2.44k forks source link

[FEAT]: Support for Sending Training Data and Executing SQL Queries in SQLAgent custom skill. #2414

Closed avinashkurup closed 6 days ago

avinashkurup commented 6 days ago

What would you like to see?

Feature Request:

  1. Send Training Data Ability to send training data with sample queries and DDLs as a text file after invoking an agent session. Shown in the picture, the query is sent to the LLM but the training data is not uploaded.

  2. Execute SQL Queries Ability to run SQL on the read-only DB connection and print the results in the AnythingLLM response.

    Provided some sample training data as a text file in workspace mode and the system analyzed and generated SQL which did not return any results on running on the DB due to misunderstanding the provided name as first and last name.

utilised the uploaded file as training data, anythingllm-training-data.txt

expected SQL: SELECT observation_date, lab_description, lab_value, lab_units, lab_code
                            FROM master_patient_index.patient_lab_results
                              WHERE first_name = 'Gloria696'
                           ORDER BY observation_date ASC;

erroneous SQL generated: SELECT observation_date, lab_description, lab_value, lab_units, lab_code
                                            FROM master_patient_index.patient_lab_results
                                               WHERE first_name = 'Gloria' AND last_name = '696'
                                            ORDER BY observation_date ASC;

image

timothycarambat commented 6 days ago

You could accomplish this via the prompt (system or input) and guiding the output to accomplish this. Adding this functionality specifically for agent would be complex to support, dragging and dropping files into the input embeds them into the workspace for later use. Agents have access to uploaded files so you could directly the agent to refer to that file first and then run SQL and a model should be able to reason about both.