create sql agent is not executing the query but replies back with sql query that it will invoke it . Also it some times just return the data which is not even in the dataset. All of this happen whe the query did get executed. #23828
Replies: 4 comments 1 reply
-
@dosubot[bot] please look into it |
Beta Was this translation helpful? Give feedback.
-
I have created my tools like this- @tool
@tool
and provided it as utilities in create_sql_agent |
Beta Was this translation helpful? Give feedback.
-
Solved it by explicitly asking LLM to invoke the query |
Beta Was this translation helpful? Give feedback.
-
snippet of one of the tool @tool
|
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I am working on create_sql_agent with gpt3.5 turbo
here in my config
db_agent = create_sql_agent(llm,
seed=42,
db=db,
top_k= 50,
max_iterations = 15,
extra_tools = utilities,
agent_type= AgentType.OPENAI_FUNCTIONS,
handle_parsing_errors=True,
handle_sql_errors=True,
agent_executor_kwargs=agent_executor_kwargs,
verbose=True)
I have created some tools as per client requirtements ,
problems I am facing,
-queries didnt get executed some time
-fake data gets shown in response
System Info
Question asked : Compare the expected versus actual quarterly price realization 2021 and 2022 for 16 inch tyres
Invoking:
sql_db_list_tables
with{}
elasiticity, inventory, monthly_forecast, product_master, sales_master, weekly_forecast
Invoking:
sql_db_schema
with{'table_names': 'product_master'}
CREATE TABLE product_master (
"EAN code" INTEGER,
brand_name TEXT,
product_name TEXT,
"Width" INTEGER,
diameter INTEGER,
"Ratio" INTEGER,
load_index INTEGER,
speed_index TEXT,
launched_day REAL,
launched_month REAL,
launched_year REAL
)
/*
3 rows from product_master table:
EAN code brand_name product_name Width diameter Ratio load_index speed_index launched_day launched_month launched_year
8019227232929 Pirelli Cinturato P1 Verde 205 16 55 91 H 21.0 7.0 2021.0
3528702522950 Michelin CrossClimate2 205 16 55 91 V 1.0 4.0 2021.0
3528709544870 Michelin Primacy 4+ 205 16 60 92 H 1.0 1.0 2022.0
*/
Invoking:
price_realization
with{'tyre_diameter': '16', 'first_year': 2021, 'second_year': 2022}
This table shows the expected and actual average prices, as well as the price difference for each quarter in 2021 and 2022.
this is fake data and query didnt get executed
Beta Was this translation helpful? Give feedback.
All reactions