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
similar to "Unfortunately, I was not able to get your answers, because of the following error:\n\n'HuggingFaceLLM' object has no attribute '_llm_type'\n" #1322
importpandasaspdfromlangchain_openaiimportChatOpenAIfromlangchainimportLLMChainfrompandasai_langchainimportLangchainLLMfromlangchain_core.promptsimportPromptTemplate, MessagesPlaceholderfrompandasaiimportSmartDataframellm=ChatOpenAI(api_key="sk_xxxx")
systemPrompt="my system prompt"myQueryWrapperPrompt=" my query wrapper prompt"template=PromptTemplate(
input_variables=["query"],
template=systemPrompt+"{query}"+myQueryWrapperPrompt,
)
chain=LLMChain(llm=llm, prompt=template)
frompandasai_langchainimportLangchainLLMlangchainllm=LangchainLLM(chain)
df=pd.read_csv("/home/[email protected]/Downloads/titanic.csv")
smartdf=SmartDataframe(df,config={"llm":langchainllm})
smartdf.chat(query="How does the age (Age) of passengers affect their likelihood of survival (Survived)?")
error:
AttributeError: 'LangchainLLM' object has no attribute '_llm_type'"
See bellow complete error
{
"name": "AttributeError",
"message": "'LangchainLLM' object has no attribute '_llm_type'",
"stack": "---------------------------------------------------------------------------
AttributeError: 'LangchainLLM' object has no attribute '_llm_type'"
}
The text was updated successfully, but these errors were encountered:
jasongonin
changed the title
barrage to use the langchain integration : _llm_type not present in langchainllm
Missing required configuration to use LangChain integration: '_llm_type' parameter not found in PANDASAI LangChain LLM settings
Feb 14, 2025
System Info
similar to "Unfortunately, I was not able to get your answers, because of the following error:\n\n'HuggingFaceLLM' object has no attribute '_llm_type'\n" #1322
pandasai==3.0.0b10
Python 3.11
pandasai-langchain==0.1.4
langchain==0.1.16
langchain-community==0.0.38
langchain-core==0.1.53
langchain-openai==0.1.3
as described below
as simple code (to exec in Jupyter notebook)
using as a df source https://github.com/datasciencedojo/datasets/blob/master/titanic.csv
🐛 Describe the bug
cell 1 : setup venv one shot
cell 2 : actual test
error:
AttributeError: 'LangchainLLM' object has no attribute '_llm_type'"
See bellow complete error
{
AttributeError Traceback (most recent call last)
Cell In[22], line 21
---> 21 smartdf.chat(query="question?")
File ~/project/gpt-be-fastapi/jupyter.venv/lib/python3.11/site-packages/pandasai/smart_dataframe/init.py:80, in SmartDataframe.chat(self, query, output_type)
(...)
---> 80 return self._agent.chat(query, output_type)
File ~/project/gpt-be-fastapi/jupyter.venv/lib/python3.11/site-packages/pandasai/agent/base.py:92, in Agent.chat(self, query, output_type)
---> 92 return self._process_query(query, output_type)
File ~/project/gpt-be-fastapi/jupyter.venv/lib/python3.11/site-packages/pandasai/agent/base.py:247, in Agent._process_query(self, query, output_type)
--> 247 f"Running PandaAI with {self._state.config.llm.type} LLM..."
File ~/project/gpt-be-fastapi/jupyter.venv/lib/python3.11/site-packages/pandasai_langchain/langchain.py:60, in LangchainLLM.type(self)
---> 60 return f"langchain_{self.langchain_llm._llm_type}"
AttributeError: 'LangchainLLM' object has no attribute '_llm_type'"
}
The text was updated successfully, but these errors were encountered: