Skip to content

Conversation

@steebchen
Copy link
Member

Summary

  • Enhances the transformStreamingToOpenai function to include function call details in the delta object when present in streaming responses
  • Ensures the function_call object with name and arguments is serialized and added to the delta
  • Improves compatibility with OpenAI streaming response format by accurately reflecting function calls in the transformed data

Changes

Core Functionality

  • Extracts parts from the first candidate's content
  • Checks for presence of function calls within parts
  • Constructs a delta object with role "assistant" and conditionally adds a function_call field
  • The function_call field includes the function name and JSON-stringified arguments
  • Updates the transformedData choices to use the new delta object instead of a static role-only delta

Test plan

  • Verify that streaming responses with function calls include the function_call object in the delta
  • Confirm that responses without function calls remain unchanged
  • Test integration with downstream consumers expecting function_call in delta
  • Ensure no regressions in handling finish reasons and other response fields

🌿 Generated by Terry


ℹ️ Tag @terragon-labs to ask questions and address PR feedback

📎 Task: https://www.terragonlabs.com/task/47fa8651-661c-44a8-8529-d385c70578a9

…form

Enhance the transformStreamingToOpenai function to detect and include function calls from streaming responses. The delta object now includes a function_call property with the function name and arguments serialized as JSON. This allows proper handling of function calls in the transformed streaming data.

Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch terragon/include-function-call-in-delta

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot changed the title Include function_call in delta for streaming OpenAI responses feat(streaming): include function_call Sep 16, 2025
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

Successfully merging this pull request may close these issues.

2 participants