mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 15:41:40 +00:00
docs: clarify Anthropic context1m long-context requirements
This commit is contained in:
@@ -103,6 +103,27 @@ describe("resolveContextTokensForModel", () => {
|
||||
expect(result).toBe(ANTHROPIC_CONTEXT_1M_TOKENS);
|
||||
});
|
||||
|
||||
it("does not force 1M context when context1m is not enabled", () => {
|
||||
const result = resolveContextTokensForModel({
|
||||
cfg: {
|
||||
agents: {
|
||||
defaults: {
|
||||
models: {
|
||||
"anthropic/claude-opus-4-6": {
|
||||
params: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
provider: "anthropic",
|
||||
model: "claude-opus-4-6",
|
||||
fallbackContextTokens: 200_000,
|
||||
});
|
||||
|
||||
expect(result).toBe(200_000);
|
||||
});
|
||||
|
||||
it("does not force 1M context for non-opus/sonnet Anthropic models", () => {
|
||||
const result = resolveContextTokensForModel({
|
||||
cfg: {
|
||||
|
||||
@@ -763,6 +763,19 @@ describe("applyExtraParamsToAgent", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("does not add Anthropic 1M beta header when context1m is not enabled", () => {
|
||||
const cfg = buildAnthropicModelConfig("anthropic/claude-opus-4-6", {
|
||||
temperature: 0.2,
|
||||
});
|
||||
const headers = runAnthropicHeaderCase({
|
||||
cfg,
|
||||
modelId: "claude-opus-4-6",
|
||||
options: { headers: { "X-Custom": "1" } },
|
||||
});
|
||||
|
||||
expect(headers).toEqual({ "X-Custom": "1" });
|
||||
});
|
||||
|
||||
it("skips context1m beta for OAuth tokens but preserves OAuth-required betas", () => {
|
||||
const calls: Array<SimpleStreamOptions | undefined> = [];
|
||||
const baseStreamFn: StreamFn = (_model, _context, options) => {
|
||||
|
||||
Reference in New Issue
Block a user