praxis-agent 0.62.2 → 0.62.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ import { transportFailureKind } from './provider-errors.js';
|
|
|
3
3
|
import { reportProviderTransportActivity } from './provider-transport-activity.js';
|
|
4
4
|
import { markNonStreamingFallbackEligible } from './non-streaming-fallback-provider.js';
|
|
5
5
|
import { createAnthropicPromptCachePolicyResolver, } from './anthropic-prompt-cache.js';
|
|
6
|
-
import { resolveAnthropicModelSpec } from './anthropic-model-spec.js';
|
|
6
|
+
import { resolveAnthropicEffort, resolveAnthropicModelSpec, } from './anthropic-model-spec.js';
|
|
7
7
|
function isRecord(value) {
|
|
8
8
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
9
9
|
}
|
|
@@ -666,12 +666,7 @@ export class AnthropicCompatibleProvider {
|
|
|
666
666
|
this.providerBetas = Object.freeze([...modelSpec.betas]);
|
|
667
667
|
this.streaming = options.streaming ?? true;
|
|
668
668
|
this.fetchImplementation = options.fetchImplementation ?? fetch;
|
|
669
|
-
this.maxOutputTokens = positiveInteger(options.maxOutputTokens ??
|
|
670
|
-
(this.wireModel.includes('claude-opus-4-6')
|
|
671
|
-
? 64_000
|
|
672
|
-
: this.wireModel.startsWith('claude-')
|
|
673
|
-
? 32_000
|
|
674
|
-
: 8192), 'Max output tokens');
|
|
669
|
+
this.maxOutputTokens = positiveInteger(options.maxOutputTokens ?? modelSpec.defaultMaxOutputTokens, 'Max output tokens');
|
|
675
670
|
this.capabilities = {
|
|
676
671
|
streaming: this.streaming,
|
|
677
672
|
usage: true,
|
|
@@ -739,6 +734,7 @@ export class AnthropicCompatibleProvider {
|
|
|
739
734
|
].filter((beta, index, all) => all.indexOf(beta) === index);
|
|
740
735
|
const serialized = serializeMessages(request.messages, request.stableSystemMessageCount, this.promptCaching);
|
|
741
736
|
const requestTools = request.tools;
|
|
737
|
+
const effort = resolveAnthropicEffort(this.wireModel, request.effort);
|
|
742
738
|
const requestInit = {
|
|
743
739
|
method: 'POST',
|
|
744
740
|
headers: {
|
|
@@ -750,12 +746,11 @@ export class AnthropicCompatibleProvider {
|
|
|
750
746
|
body: JSON.stringify({
|
|
751
747
|
model: this.wireModel,
|
|
752
748
|
max_tokens: maxTokens,
|
|
749
|
+
...(thinking?.mode === 'disabled' ? { temperature: 1 } : {}),
|
|
753
750
|
messages: serialized.messages,
|
|
754
751
|
stream: this.streaming,
|
|
755
752
|
...(thinkingPayload ? { thinking: thinkingPayload } : {}),
|
|
756
|
-
...(
|
|
757
|
-
? { output_config: { effort: request.effort } }
|
|
758
|
-
: {}),
|
|
753
|
+
...(effort ? { output_config: { effort } } : {}),
|
|
759
754
|
...(serialized.system.length ? { system: serialized.system } : {}),
|
|
760
755
|
...(request.webSearch
|
|
761
756
|
? {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const ANTHROPIC_LONG_CONTEXT_BETA = "context-1m-2025-08-07";
|
|
2
|
+
export declare function resolveAnthropicEffort(wireModel: string, effort: string | undefined): string | undefined;
|
|
2
3
|
export interface ResolvedAnthropicModelSpec {
|
|
3
4
|
readonly model: string;
|
|
4
5
|
readonly wireModel: string;
|
|
5
6
|
readonly contextWindowTokens: number;
|
|
7
|
+
readonly defaultMaxOutputTokens: number;
|
|
6
8
|
readonly betas: readonly string[];
|
|
7
9
|
readonly supportsAdaptiveThinking: boolean;
|
|
8
10
|
}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
export const ANTHROPIC_LONG_CONTEXT_BETA = 'context-1m-2025-08-07';
|
|
2
|
+
function defaultMaxOutputTokens(wireModel) {
|
|
3
|
+
if (/(?:^|[^a-z0-9])claude-(?:opus-4-[678]|opus-5|sonnet-5)(?=$|[-@.:/_])/.test(wireModel)) {
|
|
4
|
+
return 64_000;
|
|
5
|
+
}
|
|
6
|
+
return wireModel.startsWith('claude-') ? 32_000 : 8192;
|
|
7
|
+
}
|
|
8
|
+
export function resolveAnthropicEffort(wireModel, effort) {
|
|
9
|
+
if (effort === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
if (wireModel === 'claude-sonnet-4-6' || wireModel === 'claude-opus-4-6') {
|
|
12
|
+
return effort === 'xhigh' ? 'high' : effort;
|
|
13
|
+
}
|
|
14
|
+
if (/^claude-opus-4-5(?:-|$)/.test(wireModel)) {
|
|
15
|
+
return effort === 'xhigh' || effort === 'max' ? 'high' : effort;
|
|
16
|
+
}
|
|
17
|
+
return effort;
|
|
18
|
+
}
|
|
2
19
|
export function resolveAnthropicModelSpec(model, explicitContextWindowTokens) {
|
|
3
20
|
const longContext = model.endsWith('[1m]');
|
|
4
21
|
const wireModel = longContext ? model.slice(0, -'[1m]'.length) : model;
|
|
@@ -8,6 +25,7 @@ export function resolveAnthropicModelSpec(model, explicitContextWindowTokens) {
|
|
|
8
25
|
return Object.freeze({
|
|
9
26
|
model,
|
|
10
27
|
wireModel,
|
|
28
|
+
defaultMaxOutputTokens: defaultMaxOutputTokens(wireModel),
|
|
11
29
|
contextWindowTokens: explicitContextWindowTokens ?? (longContext ? 1_000_000 : 200_000),
|
|
12
30
|
betas: Object.freeze(longContext ? [ANTHROPIC_LONG_CONTEXT_BETA] : []),
|
|
13
31
|
supportsAdaptiveThinking: wireModel === 'claude-sonnet-4-6' || wireModel === 'claude-opus-4-6',
|