Open
Conversation
This reverts commit e7a78da.
There was a problem hiding this comment.
Pull request overview
This PR adds support for annotations in chat stream results, enabling the handling of web search tool citations in streaming mode. The Annotation struct is extracted into a shared model and added to ChatStreamResult.
Key Changes:
- Extracted
Annotationstruct fromChatResult.Choiceinto a standalone public model - Added
annotationsproperty toChatStreamResult.Choice.Delta
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Sources/OpenAI/Public/Models/ChatStreamResult.swift | Added annotations field to Delta struct with documentation referencing web search tool |
| Sources/OpenAI/Public/Models/ChatResult.swift | Removed nested Annotation struct from Choice |
| Sources/OpenAI/Public/Models/Annotation.swift | Created new file with extracted Annotation struct, updated access modifiers to public |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+29
| /// Annotations for the message, when applicable, as when using the web search tool. | ||
| /// Web search tool: https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat |
There was a problem hiding this comment.
The documentation comment spans multiple lines unnecessarily. Consider consolidating into a single-line comment or using a more concise format that doesn't require a URL on a separate line.
Suggested change
| /// Annotations for the message, when applicable, as when using the web search tool. | |
| /// Web search tool: https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat | |
| /// Annotations for the message, when applicable, as when using the web search tool: https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add Annotations property to ChatStreamResult object
Why
When OpenAI uses web tool call in stream mode - it returns annotation object for ChatStreamResult as well
Affected Areas
ChatStreamResult,Annotationstructs