langchain icon indicating copy to clipboard operation
langchain copied to clipboard

DOC: SQL Database Agent

Open er77 opened this issue 1 year ago • 2 comments

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

er77 avatar May 21 '23 19:05 er77

Same issue here image

xiaohui-hiwintech avatar May 22 '23 03:05 xiaohui-hiwintech

@er77 @xiaohui-gsv

llm = OpenAI(temperature=0) toolkit = SQLDatabaseToolkit(db=db, llm=llm)

Pass llm and it should work.

mradul-kanugo avatar May 22 '23 10:05 mradul-kanugo

@mradul-kanugo

Hi, even after trying the above code, I am still facing the error. image

Ajithprasath08 avatar May 29 '23 05:05 Ajithprasath08

me too

hordaway avatar Jun 13 '23 08:06 hordaway

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

marcovic avatar Jun 20 '23 14:06 marcovic

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

Apashrov16 avatar Jul 22 '23 01:07 Apashrov16

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

ChelcieDeAlmeida avatar Jul 31 '23 04:07 ChelcieDeAlmeida

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!

dosubot[bot] avatar Oct 30 '23 16:10 dosubot[bot]