Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langgraph-tutorial.ipynb: AttributeError: 'tuple' object has no attribute 'invoke' i need help #81

Open
xiongzhenglong opened this issue Feb 28, 2025 · 0 comments

Comments

@xiongzhenglong
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant