summarize() sends temperature 0.3 to models that reject sampling parameters (e.g. claude-sonnet-5-5)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
TanStack AI version
@tanstack/ai 0.68.0, @tanstack/ai-anthropic 0.21.1
Framework/Library version
TypeScript 7.0.2 (framework-independent)
Describe the bug and the steps to reproduce it
ChatStreamSummarizeAdapter.buildTextOptions always calls applyDefaultTemperature(this.name, 0.3, working) (chat-stream-summarize.ts#L375), which adds temperature: 0.3 unless the caller already set one. Several Anthropic models don't accept sampling parameters: their model meta leaves out AnthropicSamplingOptions (claude-sonnet-5, claude-sonnet-5-5, claude-opus-4-7, claude-opus-4-8, claude-fable-5, claude-fable-5-1, claude-haiku-5-5), and the AnthropicMaxTokensOptions doc comment notes that Fable 5 and Opus 4.7/4.8 reject them outright while Sonnet 5 returns a 400 for a non-default value. summarize() against these models still sends temperature: 0.3.
The documented opt-out ("the caller always wins") isn't available either: temperature isn't part of these models' modelOptions type, so summarize({ ..., modelOptions: { temperature: 1 } }) fails with TS2353.
Steps:
import { summarize } from "@tanstack/ai";
import { createAnthropicSummarize } from "@tanstack/ai-anthropic";
const bodies: Array<Record<string, unknown>> = [];
const fetch = async (_url: string, init: RequestInit) => {
bodies.push(JSON.parse(String(init.body)));
return new Response(JSON.stringify({ type: "error", error: { type: "invalid_request_error", message: "captured" } }), {
status: 400,
headers: { "content-type": "application/json" },
});
};
try {
await summarize({
adapter: createAnthropicSummarize("claude-sonnet-5-5", "key", { fetch, maxRetries: 0 }),
text: "Some long text.",
});
} catch {}
console.log(bodies[0]);
The captured request contains "model": "claude-sonnet-5-5", "temperature": 0.3, "max_tokens": 128000.
Expected: no temperature for models that reject sampling parameters, or a typed way to turn the default off.
A possible fix: let the text adapter report whether its model accepts sampling parameters (the provider model meta already knows) and skip the default when it doesn't. Meanwhile we wrap the text adapter handed to ChatStreamSummarizeAdapter and drop temperature from modelOptions in chatStream.
Possibly related: Anthropic's model docs list claude-opus-5 and claude-opus-5-5 as rejecting sampling parameters as well, while their model meta still includes AnthropicSamplingOptions. Might be worth a check.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Inline above.
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.2k
- Fork
- 361
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 266
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/ai
-
Discriminate status-dependent record and option types (RunRecord, SessionIndexEntry, InputState, durable-only options)Có thể đã có người làm @jherr đã nhận hôm nay. Đang mởenhancement waiting-on: maintainer
TanStack/ai#1799 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-harness: an input with no principal runs with the owner session's principalCó thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
TanStack/ai#1797 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-harness: a forwarded command completes with no result, also when the owner rejects itCó thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
TanStack/ai#1796 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-harness: recovery runs a turn without the user message when the turn never startedCó thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
TanStack/ai#1795 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-mcp: modern tool calls omit x-mcp-header parameter headers in 0.9.0Có thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
TanStack/ai#1794 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/rocketmq-dashboard#6872 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fab-geocommuns/RNB-site#539 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Guest multiview tile label leaks raw virtual-source-id "Whip" instead of the guest name / slot labelĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Eyevinn/open-live-studio#211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ehmpathy/rhachet-roles-bhuild#468 ·
Maintainer thường phản hồi trong vòng 1 ngày