Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Empty builders now produce zero-segment prompts that provider adapters may reject.
1 open finding
What changed in this PR
Adds Foundation Models 27-style image attachments to prompts and tool outputs, including transcript/provider bridging and documentation.
Changes:
- Preserves ordered text and image prompt segments.
- Bridges attachments through Foundation Models and Gemini tool responses.
- Documents attachment support and the compatibility SPI.
| File | Description |
|---|---|
README.md |
Documents attachments and compatibility behavior. |
Sources/AnyLanguageModel/Attachment.swift |
Adds typed image attachments. |
Sources/AnyLanguageModel/Prompt.swift |
Stores and lowers ordered prompt components. |
Sources/AnyLanguageModel/Tool.swift |
Preserves segments in tool outputs. |
Sources/AnyLanguageModel/LanguageModelSession.swift |
Records attachment-bearing prompts. |
Sources/AnyLanguageModel/Models/SystemLanguageModel.swift |
Bridges attachments to Foundation Models. |
Sources/AnyLanguageModel/Models/FoundationLanguageModel.swift |
Handles throwing prompt conversion. |
Sources/AnyLanguageModel/Models/GeminiLanguageModel.swift |
Serializes image tool responses. |
Tests/AnyLanguageModelTests/PromptAttachmentTests.swift |
Tests attachment preservation and bridging. |
Tests/AnyLanguageModelTests/GeminiThoughtSignatureTests.swift |
Tests Gemini image tool responses. |
Tests/AnyLanguageModelTests/ToolExecutionDelegateTests.swift |
Imports the compatibility SPI. |
Tests/AnyLanguageModelTests/DynamicInstructionsTests.swift |
Imports the compatibility SPI. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.

Summary
CompatibilitySPI used by back-deployment provider adaptersStack
The prompt-attachment foundation from #310 landed through #321. This documentation PR now contains the current #312 head and depends only on #312; compared with that branch, its change remains README-only.
Verification
git diff --checkAttachmentinitializers andTool.makeOutputSegments(from:)verified against source