gkamradt / langchain-tutorials

Overview and tutorial of the LangChain Library
6.63k stars 1.92k forks source link

ValidationError: 1 validation error for SQLDatabaseToolkit #21

Closed SEUlegend closed 1 year ago

SEUlegend commented 1 year ago

I got this error. The version of langchain is 0.0.169. I want to know how to fix this error.


ValidationError Traceback (most recent call last) Cell In[2], line 3 1 # db = SQLDatabase.from_uri("sqlite:///../../../../notebooks/Chinook.db") 2 db = SQLDatabase.from_uri("sqlite:///../../notebooks/Chinook.db") ----> 3 toolkit = SQLDatabaseToolkit(db=db) 4 agent_executor = create_sql_agent( 5 llm = OpenAI(temperature=0, openai_api_key="sk-xxx"), 6 toolkit=toolkit, 7 verbose=True 8 )

File ~/miniconda3/envs/aigc/lib/python3.10/site-packages/pydantic/main.py:342, in pydantic.main.BaseModel.init()

ValidationError: 1 validation error for SQLDatabaseToolkit llm field required (type=value_error.missing)

gkamradt commented 1 year ago

Looks like the field LLM is required - please supply that or repost w/ the code you're having trouble with

SEUlegend commented 1 year ago

Thank you very much. The problem has been solved to put the LLM parameter into the SQLDatabaseToolkit