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
Title:
AttributeError: 'tuple' object has no attribute 'invoke' when using OpenRouter with LangChain on Colab
Issue Description:
I encountered the following error when running my LangChain app in Google Colab:
AttributeError: 'tuple' object has no attribute 'invoke'
The only change I've made to the original code is replacing the LLM with an OpenRouter model:
llm = ChatOpenAI(
model="openai/gpt-4o-mini",
openai_api_base="https://openrouter.ai/api/v1",
temperature=0
)
The traceback points specifically to the invocation of the LLM:
classification = llm.invoke([message]).content.strip()
Full error traceback:
Title:
AttributeError: 'tuple' object has no attribute 'invoke' when using OpenRouter with LangChain on Colab
Issue Description:
I encountered the following error when running my LangChain app in Google Colab:
AttributeError: 'tuple' object has no attribute 'invoke'
The only change I've made to the original code is replacing the LLM with an OpenRouter model:
llm = ChatOpenAI(
model="openai/gpt-4o-mini",
openai_api_base="https://openrouter.ai/api/v1",
temperature=0
)
The traceback points specifically to the invocation of the LLM:
classification = llm.invoke([message]).content.strip()
Full error traceback:
AttributeError Traceback (most recent call last)
in <cell line: 0>()
5
6 state_input = {"text": sample_text}
----> 7 result = app.invoke(state_input)
8
9 print("Classification:", result["classification"])
6 frames
in classification_node(state)
6 )
7 message = HumanMessage(content=prompt.format(text=state["text"]))
----> 8 classification = llm.invoke([message]).content.strip()
9 return {"classification": classification}
10
AttributeError: 'tuple' object has no attribute 'invoke'
Could anyone help identify why this is happening? Thanks!
The text was updated successfully, but these errors were encountered: