Closed dawsontoth closed 9 months ago
🤖
Hello,
Thank you for your interest in the compatibility of the langchainjs framework with the OAI functions agent and Anthropic Functions.
Based on the context provided, the langchainjs framework appears to be fully compatible with the OAI functions agent. The framework can be used to create an OpenAPI agent that interacts with the OpenAI model. You can find an example of this in the openapi.ts file in the examples directory of the langchainjs repository.
Regarding the parsing errors you're encountering with the structured-chat-zero-shot-react-description
agent executor and Anthropic Functions, could you provide more specific details about the errors? This would help in identifying the root cause and proposing a solution.
The structured-chat-zero-shot-react-description
agent executor in the langchainjs codebase is an instance of the AgentExecutor
class. You can find more details about its structure in the structured_chat.ts and executor.ts files in the langchainjs repository.
As for the OAI functions agent features that could improve compatibility with Anthropic Functions, the langchainjs framework provides an experimental wrapper around Anthropic that gives it the same API as OpenAI Functions. This means that you can use the same methods and properties as you would with OpenAI, improving compatibility. You can find more details about this in the anthropic_functions.mdx file in the docs directory of the langchainjs repository.
I hope this information is helpful. If you have any further questions or need more specific details, please don't hesitate to ask.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
@efriis you up for this one?
@efriis @jacoblee93 Happy to touch base and discuss how we can collaborate to accelerate this effort.
Hey @mbednarzAWS ! Just continuing the conversation here.
I started looking at this last week but haven't had a chance to get to coding.
The general plan is to add an equivalent OpenAIFunctionsAgentOutputParser to python, such that you can construct a Functions agent using Anthropic in the same way you would in python, using LCEL
https://python.langchain.com/docs/modules/agents/agent_types/openai_functions_agent#using-lcel
Would you be interested in owning this implementation?
The general plan is to add an equivalent OpenAIFunctionsAgentOutputParser to python
Hey folks, new here. Thanks for the work. Just checking, did you mean to say "to JS" here?
Also, is this work already done?
Yes and yes!
I believe there's some more underlying work being sorted out, the agent executor isn't quite straightened out on bedrock yet.
Ah I recall now - still need to implement the functions parser separately, so it plays nicely
If anyone wants to take a stab at it, it would essentially be a similar output parser to this python implementation (but in js)! https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/output_parsers/openai_functions.py
Hi, @dawsontoth,
I'm helping the langchainjs team manage their backlog and am marking this issue as stale. The issue involves parsing errors when working with the structured-chat-zero-shot-react-description
agent executor, with the goal of improving compatibility with the OAI functions agent to address the parsing errors. The discussion in the comments includes potential solutions and a reference to an existing pull request related to this issue.
Could you please let us know if this issue is still relevant to the latest version of the langchainjs repository? If it is, please comment on the issue to let the langchainjs team know. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!
Anthropic Functions partially works with the
structured-chat-zero-shot-react-description
agent executor, but gets blocked by parsing errors. Implementing OAI functions agent compatibility would improve things pretty drastically, I hear!