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

langchain-ask-human example is using deprecated design #158

Open
jleonelion opened this issue Nov 13, 2024 · 1 comment
Open

langchain-ask-human example is using deprecated design #158

jleonelion opened this issue Nov 13, 2024 · 1 comment

Comments

@jleonelion
Copy link

jleonelion commented Nov 13, 2024

This example calls initialize_agent function: https://github.com/Chainlit/cookbook/blob/main/langchain-ask-human/app.py#L55
But that is deprecated: https://github.com/langchain-ai/langchain/blob/2ab5673eb1eae4a8945ed090d81b6f47e4639d58/libs/langchain/langchain/agents/initialize.py#L15-L22
In fact, the alternative suggested create_react_agent is also not recommended: https://github.com/langchain-ai/langchain/blob/2ab5673eb1eae4a8945ed090d81b6f47e4639d58/libs/langchain/langchain/agents/react/agent.py#L30-L34
And using langgraph prebuilt is recommended: https://github.com/langchain-ai/langgraph/blob/6906e12edb551162f5fede5d9f55b4bb206bb59c/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py#L197

All in all, this example is inspirational, but doesn't really hit the mark in terms of a recommended approach for building a ReAct agent with LangChain/LangGraph

@jleonelion
Copy link
Author

I've made good progress on implementing the LangGraph aspects using pattern here: https://github.com/langchain-ai/langchain-academy/blob/main/module-1/agent.ipynb

And I added the HumanInputChainlit tool (with some logging)

App logs show the tool class being called but I am never prompted in the UI nor do I see log message to indicate response is returned...it's just hanging.

   logger.debug(f"query: {query}")
    res = run_sync(cl.AskUserMessage(content=query).send())
    logger.debug(f"response: {res}")

I have verified the LangGraph logic by creating a Jupyter notebook (that approach uses the built-in input instead of AskUserMessage) - this problem is unique to running in the Chainlit server.

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