Relevant tables choice with bind_tools #27776
Unanswered
MartinV279
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using the following tutorial for making a SQL agent: https://langchain-ai.github.io/langgraph/tutorials/sql-agent/
In the tutorial, there is a step that returns only RELEVANT tables to answer the user query. It is supposed to look at all available/usable tables and pick which of them may be relevant to the query.
In the attached code to this thread, I reconstructed the call. The query I use for this was fetched from the original tutorial, and passes the state["messages"] to this step which is GPT4o llm call with bind_tools. It basicall uses "sql_db_schema" tool from SQLDatabaseToolkit.
I imagined that in the background there is some prompt being invoked, but when I recreated the steps from langchain's source it still works.
The description of "sql_db_schema" states "Get the schema and sample rows for the specified SQL tables.".
I am not adding any system prompt, nor initializing chains for tables or anything.
My confusion and question is: At what time does the combination of llm and tool decides to pick the relevant tables only? And more importantly, where and how?
I am kind of new to AI agents, so any help around this will be very appreciated.
Thanks!
System Info
langchain==0.3.4
langchain-community==0.3.3
langchain-core==0.3.13
langchain-openai==0.2.4
langchain-plantuml==0.0.7
langchain-text-splitters==0.3.0
langchainhub==0.1.21
Python 3.9.20
Beta Was this translation helpful? Give feedback.
All reactions