langchain
langchain copied to clipboard
DOC: SQL Database Agent
Issue with current documentation:
Hello I was trying to reproduce an example from that documentation
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html?highlight=SQLDatabaseToolkit#
and got error
toolkit = SQLDatabaseToolkit(db=db )
ValidationError: 1 validation error for SQLDatabaseToolkit llm field required (type=value_error.missing)
Idea or request for content:
No response
Same issue here
@er77 @xiaohui-gsv
llm = OpenAI(temperature=0) toolkit = SQLDatabaseToolkit(db=db, llm=llm)
Pass llm and it should work.
@mradul-kanugo
Hi, even after trying the above code, I am still facing the error.
me too
Using this one: from langchain.chat_models import ChatOpenAI llm = ChatOpenAI(model_name="gpt-3.5-turbo")
toolkit = SQLDatabaseToolkit(db=db,llm=llm)
agent_executor = create_sql_agent( llm=llm, toolkit=toolkit, verbose=True )
and it works for me
Using this one: from langchain.chat_models import ChatOpenAI llm = ChatOpenAI(model_name="gpt-3.5-turbo")
toolkit = SQLDatabaseToolkit(db=db,llm=llm)
agent_executor = create_sql_agent( llm=llm, toolkit=toolkit, verbose=True )
and it works for me
It works for me too
The suggestions works for me. General assumption but are you on a paid account with openAI? Once I paid for API access, the code everyone here recommended began to work for me
Hi, @er77! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, you encountered a documentation problem with the SQL Database Agent. You were trying to reproduce an example from the documentation but encountered an error. mradul-kanugo suggested passing a parameter called "llm" to resolve the issue, but Ajithprasath08 reported that it didn't work for them. However, marcovic shared their code which worked for them, and Apashrov16 confirmed that it worked for them as well.
Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding!