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, community: Found problems in calling openai #28844

Closed
wants to merge 2 commits into from

Conversation

reatang
Copy link

@reatang reatang commented Dec 20, 2024

Description:

Problems found during use:

  1. OpenAI requires that the last message can only be user or tool
    error info
openai.BadRequestError: Error code: 400 - {'chat_id': '', 'message': 'last message role must be user or tool', 'stream': False, 'error_code': 0, 'refer_blocks': None}
  1. OpenAI's call_tools may return a function without a name
    trace info
https://smith.langchain.com/public/b8f96ad1-1c14-4846-95b6-bd129ba72a03/r

There is no need to merge. I believe the official has a better solution.

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 9:35am

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. community Related to langchain-community langchain Related to the langchain package 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Dec 20, 2024
@ccurme
Copy link
Collaborator

ccurme commented Dec 20, 2024

Can you post a full reproducible example?

I suspect something else is going on. The agent scratchpad should be getting formatted into tool messages, so we shouldn't need additional human messages.

From your LangSmith trace, the input query should be after the system message and before the AIMessage tool calls. It looks like there is no human message following the system message, so unclear how the model should know what tool calls to generate.

@ccurme ccurme closed this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature community Related to langchain-community langchain Related to the langchain package size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants