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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def chat_response_to_text(self, response: Any) -> str:

def chat_stream_to_text(self, event_data: Dict) -> str:
if "text" in event_data:
return event_data["text"]
if "finishedReason" in event_data or "toolCalls" in event_data:
return ""
else:
return event_data["text"]
Comment on lines +161 to +164
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.

else:
return ""

Expand Down
Loading