fix(archiegateway,agentexec,agentworker): rely on ai-sdk reasoning token selection

Bump github.com/samcharles93/ai-sdk v0.1.40 -> v0.1.41. ai-sdk now sends
max_completion_tokens for reasoning models and omits temperature when the
model rejects it, so the max_tokens workarounds are no longer needed: the
chat-turn bound is set directly and MCP sampling loses its reasoning
branch. Classic models keep their existing bounds.
This commit is contained in:
sam committed 2026-10-05 22:56:48 +11:00
1 parent e50a381992
commit 2c447708e9
6 files changed
+17 -33

No files matched your search

+4 -5
View File
@@ -41,8 +41,10 @@ func SamplingMessages(req protocol.SamplingRequest) ([]chat.Message, error) {
}
// SamplingMaxTokens returns the request's maxTokens or the default, capped at
// the model's ceiling. Reasoning models get no bound.
func SamplingMaxTokens(requested, modelCeiling int, reasoning bool) int {
// the model's ceiling. The ai-sdk runtime picks max_completion_tokens or
// max_tokens from the model's catalog metadata, so there is no reasoning
// branch here.
func SamplingMaxTokens(requested, modelCeiling int) int {
maxTokens := requested
if maxTokens <= 0 {
maxTokens = DefaultSamplingMaxTokens
@@ -50,8 +52,5 @@ func SamplingMaxTokens(requested, modelCeiling int, reasoning bool) int {
if modelCeiling > 0 && maxTokens > modelCeiling {
maxTokens = modelCeiling
}
if reasoning {
return 0
}
return maxTokens
}