You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/Projects/multi-AI-test/azure-postgresql-openai-langchain-autogen-demo/new_env_0.4/lib/python3.12/site-packages/pydantic/_internal/_mock_val_ser.py:100, in MockValSer.getattr(self, item) 98 # raise an AttributeError if item doesn't exist 99 getattr(self._val_or_ser, item)
--> 100 raise PydanticUserError(self._error_message, code=self._code)
PydanticUserError: SQLDatabaseChain is not fully defined; you should define BaseCache, then call SQLDatabaseChain.model_rebuild().
Description
I saw this issue: https://github.com/langchain-ai/langchain/pull/28297 and that one (#28297) looked like it solved but it hasn't for me. I have to go back to 2.9.2 but now it's not compatible with autogen 0.4 and I have to get to the latest version.
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 24.2.0: Fri Dec 6 19:02:41 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6030
Python Version: 3.12.8 (main, Dec 3 2024, 18:42:41) [Clang 16.0.0 (clang-1600.0.26.4)]
You are using very old and experimental way of interacting with the database. You can do something as follow to construct a SQL Agent which talks with your data:
fromlangchain_community.agent_toolkits.sql.baseimportcreate_sql_agentfromlangchain_openaiimportChatOpenAIfromlangchain_community.utilities.sql_databaseimportSQLDatabasefromlangchain_community.agent_toolkits.sql.toolkitimportSQLDatabaseToolkitagent=create_sql_agent(llm=ChatOpenAI(model="gpt-4o-mini"),
agent_type="openai-tools",
verbose=True,
toolkit=SQLDatabaseToolkit(db=SQLDatabase.from_uri(database_uri="postgresql+psycopg2://root:password@localhost:5432/dev_db"),llm=ChatOpenAI(model="gpt-4o-mini")))
agent.invoke({"input": "How many calls happenend?"})
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
PydanticUserError Traceback (most recent call last)
Cell In[22], line 116
2 llm_config = {
3 "config_list": [
4 {
(...)
111 ]
112 }
115 # Initialize the database chains
--> 116 shipment_chain = SQLDatabaseChain(llm=azure_llm, database=shipment_db, verbose=True)
117 crm_chain = SQLDatabaseChain(llm=azure_llm, database=crm_db, verbose=True)
119 # Create assistant agents
File ~/Projects/multi-AI-test/azure-postgresql-openai-langchain-autogen-demo/new_env_0.4/lib/python3.12/site-packages/langchain_core/load/serializable.py:125, in Serializable.init(self, *args, **kwargs)
123 def init(self, *args: Any, **kwargs: Any) -> None:
124 """"""
--> 125 super().init(*args, **kwargs)
File ~/Projects/multi-AI-test/azure-postgresql-openai-langchain-autogen-demo/new_env_0.4/lib/python3.12/site-packages/pydantic/_internal/_mock_val_ser.py:100, in MockValSer.getattr(self, item)
98 # raise an AttributeError if
item
doesn't exist99 getattr(self._val_or_ser, item)
--> 100 raise PydanticUserError(self._error_message, code=self._code)
PydanticUserError:
SQLDatabaseChain
is not fully defined; you should defineBaseCache
, then callSQLDatabaseChain.model_rebuild()
.Description
I saw this issue: https://github.com/langchain-ai/langchain/pull/28297 and that one (#28297) looked like it solved but it hasn't for me. I have to go back to 2.9.2 but now it's not compatible with autogen 0.4 and I have to get to the latest version.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: