Skip to content

Forward all generation options to FoundationModels - #230

Merged
mattt merged 1 commit into
mainfrom
mattt/forward-generation-options
Sep 11, 2026
Merged

mattt merged 1 commit into
mainfrom
mattt/forward-generation-options

Conversation

@mattt

@mattt mattt commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

GenerationOptions.toFoundationModels() only forwarded temperature, causing SystemLanguageModel to ignore sampling modes and maximumResponseTokens. This forwards greedy, top-k, and nucleus sampling (including seeds), forwards the maximum token limit, and preserves nil defaults.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues were identified, and the changes include conversion tests.

Pull request overview

Updates SystemLanguageModel to forward all generation options to FoundationModels.

Changes:

  • Maps greedy, top-k, and nucleus sampling, including seeds.
  • Forwards temperature and maximum response tokens.
  • Adds tests for option conversion and nil defaults.
File summaries
File Description
Tests/AnyLanguageModelTests/SystemLanguageModelTests.swift Verifies option conversion behavior.
Sources/AnyLanguageModel/Models/SystemLanguageModel.swift Converts supported generation options to FoundationModels.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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