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

OCI Generative AI tool calling bug fix #26910

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

raveharpaz
Copy link
Contributor

  • PR title:
    "community: OCI Generative AI tool calling bug fix

  • PR message:

    • Description: bug fix for streaming chat responses with tool calls. Update to PR 24693
    • Issue: chat response content is repeated when streaming
    • Dependencies: NA
    • Twitter handle: NA
  • Add tests and docs: NA

  • Lint and test: make format, make lint and make test we run successfully

Copy link

vercel bot commented Sep 26, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Sep 26, 2024 6:15pm

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

@efriis efriis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the error? could you add a unit test that triggers the case you're reporting?

Comment on lines +161 to +164
if "finishedReason" in event_data or "toolCalls" in event_data:
return ""
else:
return event_data["text"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if "finishedReason" in event_data or "toolCalls" in event_data:
return ""
else:
return event_data["text"]
return event_data.get("text")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@efriis It is actually not a key error. It is the mechanism of our API. When finishedReason and toolCalls exists in the response, "text" field will output all the previous content generated and combine them together. This will make the streaming result to be duplicated two to three times.

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 size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Status: Needs support
Development

Successfully merging this pull request may close these issues.

3 participants