-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Adding extra content to OpenAI LLM. Improving function call grouping. #4170
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
Conversation
|
I don't see extra_content from the ChoiceDelta: |
My testing shows it working OpenAI SDK's Pydantic models use extra='allow' 1, which preserves any additional fields from the JSON response. We access it via getattr(delta, "extra_content", None). This allows providers to include additional metadata like thought signatures. Context around google though signatures: https://ai.google.dev/gemini-api/docs/thought-signatures?authuser=1#openai |
theomonnom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise lgtm!
| name: str | ||
| arguments: str | ||
| call_id: str | ||
| extra_content: dict[str, Any] | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still name this extra IMO
| extra_content: dict[str, Any] | None = None | |
| extra: dict[str, Any] | None = None |
| role: ChatRole | None = None | ||
| content: str | None = None | ||
| tool_calls: list[FunctionToolCall] = Field(default_factory=list) | ||
| extra_content: dict[str, Any] | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| extra_content: dict[str, Any] | None = None | |
| extra: dict[str, Any] | None = None |
- Introduced `extra_content` field in `FunctionToolCall`, `ChoiceDelta`, and `ChatMessage` models to accommodate provider-specific data (e.g., Google thought signatures). - Updated `LLMStream` and related methods to handle `extra_content` during tool calls and message processing. - Enhanced serialization in OpenAI provider format to include `extra_content` where applicable. - Improved grouping logic for function calls to utilize `group_id` when available for better parallel processing.
069fcf3 to
e46596f
Compare
No description provided.