@opencode-ai/ai 0.0.0-dev-18051 → 0.0.0-dev-18053
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.
- package/dist/protocols/anthropic-messages.d.ts +250 -14
- package/dist/protocols/anthropic-messages.js +274 -14
- package/dist/protocols/gemini.d.ts +2 -2
- package/dist/protocols/open-responses.d.ts +3 -3
- package/dist/protocols/openai-compatible-responses.d.ts +1 -1
- package/dist/protocols/openai-responses.d.ts +5 -5
- package/dist/protocols/utils/bedrock-media.d.ts +1 -0
- package/dist/protocols/xai-responses.d.ts +1 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +1 -1
- package/dist/providers/anthropic-compatible.d.ts +72 -3
- package/dist/providers/anthropic.d.ts +72 -3
- package/dist/providers/azure.d.ts +1 -1
- package/dist/providers/google-vertex-messages.d.ts +72 -3
- package/dist/providers/google-vertex-responses.d.ts +1 -1
- package/dist/providers/google-vertex.d.ts +1 -1
- package/dist/providers/google.d.ts +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/schema/messages.d.ts +3 -0
- package/dist/schema/messages.js +1 -0
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
1
2
|
import { Effect, Schema } from "effect";
|
|
2
3
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
4
|
import { Route } from "../route/client.js";
|
|
@@ -40,23 +41,57 @@ const AnthropicTextBlock = Schema.Struct({
|
|
|
40
41
|
text: Schema.String,
|
|
41
42
|
cache_control: Schema.optional(AnthropicCacheControl),
|
|
42
43
|
});
|
|
44
|
+
// SDK: Base64ImageSource:201 {type:"base64", media_type:"image/jpeg"|... , data}, URLImageSource:3817 {type:"url", url}, FileImageSource:2350 {type:"file", file_id}
|
|
45
|
+
// SDK: ImageBlockParam:2356 {source: Base64|URL|File, cache_control, transformations:2381 {oversized_image?}}
|
|
46
|
+
const AnthropicBase64ImageSource = Schema.Struct({
|
|
47
|
+
type: Schema.tag("base64"),
|
|
48
|
+
media_type: Schema.String,
|
|
49
|
+
data: Schema.String,
|
|
50
|
+
});
|
|
51
|
+
const AnthropicURLImageSource = Schema.Struct({ type: Schema.tag("url"), url: Schema.String });
|
|
52
|
+
const AnthropicFileImageSource = Schema.Struct({ type: Schema.tag("file"), file_id: Schema.String });
|
|
53
|
+
const AnthropicImageSource = Schema.Union([
|
|
54
|
+
AnthropicBase64ImageSource,
|
|
55
|
+
AnthropicURLImageSource,
|
|
56
|
+
AnthropicFileImageSource,
|
|
57
|
+
]);
|
|
58
|
+
const AnthropicImageTransformations = Schema.Struct({
|
|
59
|
+
oversized_image: Schema.optional(Schema.Literals(["downsize", "error"])),
|
|
60
|
+
});
|
|
43
61
|
const AnthropicImageBlock = Schema.Struct({
|
|
44
62
|
type: Schema.tag("image"),
|
|
45
|
-
source:
|
|
46
|
-
type: Schema.tag("base64"),
|
|
47
|
-
media_type: Schema.String,
|
|
48
|
-
data: Schema.String,
|
|
49
|
-
}),
|
|
63
|
+
source: AnthropicImageSource,
|
|
50
64
|
cache_control: Schema.optional(AnthropicCacheControl),
|
|
65
|
+
transformations: Schema.optional(AnthropicImageTransformations),
|
|
66
|
+
});
|
|
67
|
+
// SDK: Base64PDFSource:209 {type:"base64", media_type:"application/pdf", data}, PlainTextSource:2716 {type:"text", media_type:"text/plain", data},
|
|
68
|
+
// SDK: URLPDFSource:3823 {type:"url", url}, FileDocumentSource:2344 {type:"file", file_id}, ContentBlockSource:2266 {type:"content", content}
|
|
69
|
+
// SDK: DocumentBlockParam:2297 {source: 5-way union, cache_control, citations, context, title}
|
|
70
|
+
const AnthropicBase64PDFSource = Schema.Struct({
|
|
71
|
+
type: Schema.tag("base64"),
|
|
72
|
+
media_type: Schema.Literal("application/pdf"),
|
|
73
|
+
data: Schema.String,
|
|
51
74
|
});
|
|
75
|
+
const AnthropicPlainTextSource = Schema.Struct({
|
|
76
|
+
type: Schema.tag("text"),
|
|
77
|
+
media_type: Schema.Literal("text/plain"),
|
|
78
|
+
data: Schema.String,
|
|
79
|
+
});
|
|
80
|
+
const AnthropicURLPDFSource = Schema.Struct({ type: Schema.tag("url"), url: Schema.String });
|
|
81
|
+
const AnthropicFileDocumentSource = Schema.Struct({ type: Schema.tag("file"), file_id: Schema.String });
|
|
82
|
+
const AnthropicDocumentSource = Schema.Union([
|
|
83
|
+
AnthropicBase64PDFSource,
|
|
84
|
+
AnthropicPlainTextSource,
|
|
85
|
+
AnthropicURLPDFSource,
|
|
86
|
+
AnthropicFileDocumentSource,
|
|
87
|
+
]);
|
|
52
88
|
const AnthropicDocumentBlock = Schema.Struct({
|
|
53
89
|
type: Schema.tag("document"),
|
|
54
|
-
source:
|
|
55
|
-
type: Schema.tag("base64"),
|
|
56
|
-
media_type: Schema.Literal("application/pdf"),
|
|
57
|
-
data: Schema.String,
|
|
58
|
-
}),
|
|
90
|
+
source: AnthropicDocumentSource,
|
|
59
91
|
cache_control: Schema.optional(AnthropicCacheControl),
|
|
92
|
+
title: Schema.optional(Schema.String),
|
|
93
|
+
context: Schema.optional(Schema.String),
|
|
94
|
+
citations: Schema.optional(Schema.Struct({ enabled: Schema.Boolean })),
|
|
60
95
|
});
|
|
61
96
|
const AnthropicThinkingBlock = Schema.Struct({
|
|
62
97
|
type: Schema.tag("thinking"),
|
|
@@ -159,9 +194,25 @@ const AnthropicThinking = Schema.Union([
|
|
|
159
194
|
type: Schema.tag("disabled"),
|
|
160
195
|
}),
|
|
161
196
|
]);
|
|
197
|
+
// SDK OutputConfig:2684 {effort?: "low"|"medium"|"high"|"xhigh"|"max"|null, format?: JSONOutputFormat:2399}
|
|
198
|
+
const AnthropicJsonOutputFormat = Schema.Struct({
|
|
199
|
+
type: Schema.Literal("json_schema"),
|
|
200
|
+
schema: JsonObject,
|
|
201
|
+
});
|
|
162
202
|
const AnthropicOutputConfig = Schema.Struct({
|
|
163
203
|
effort: Schema.optional(Schema.String),
|
|
204
|
+
format: Schema.optional(Schema.NullOr(AnthropicJsonOutputFormat)),
|
|
164
205
|
});
|
|
206
|
+
// SDK Metadata:2649 {user_id?: string|null}
|
|
207
|
+
const AnthropicMetadata = Schema.Struct({ user_id: optionalNull(Schema.String) });
|
|
208
|
+
// SDK MessageCreateParamsContainer:2596 ContainerParams|string; ContainerParams:2172 {id?, skills?}
|
|
209
|
+
const AnthropicContainer = Schema.Union([
|
|
210
|
+
Schema.String,
|
|
211
|
+
Schema.Struct({
|
|
212
|
+
id: optionalNull(Schema.String),
|
|
213
|
+
skills: optionalNull(Schema.Array(JsonObject)),
|
|
214
|
+
}),
|
|
215
|
+
]);
|
|
165
216
|
const AnthropicBodyFields = {
|
|
166
217
|
model: Schema.String,
|
|
167
218
|
system: optionalArray(AnthropicTextBlock),
|
|
@@ -176,6 +227,12 @@ const AnthropicBodyFields = {
|
|
|
176
227
|
stop_sequences: optionalArray(Schema.String),
|
|
177
228
|
thinking: Schema.optional(AnthropicThinking),
|
|
178
229
|
output_config: Schema.optional(AnthropicOutputConfig),
|
|
230
|
+
// SDK top-level passthrough: cache_control:4638, container:4643, inference_geo:4649, metadata:4654, service_tier:4670
|
|
231
|
+
cache_control: Schema.optional(AnthropicCacheControl),
|
|
232
|
+
container: Schema.optional(Schema.NullOr(AnthropicContainer)),
|
|
233
|
+
inference_geo: Schema.optional(Schema.NullOr(Schema.String)),
|
|
234
|
+
metadata: Schema.optional(AnthropicMetadata),
|
|
235
|
+
service_tier: Schema.optional(Schema.Literals(["auto", "standard_only"])),
|
|
179
236
|
};
|
|
180
237
|
export const AnthropicMessagesBody = Schema.Struct(AnthropicBodyFields);
|
|
181
238
|
const AnthropicUsage = Schema.StructWithRest(Schema.Struct({
|
|
@@ -325,7 +382,149 @@ const lowerServerToolResult = Effect.fn("AnthropicMessages.lowerServerToolResult
|
|
|
325
382
|
const payload = part.providerMetadata?.anthropic?.["result"] ?? part.result.value;
|
|
326
383
|
return { type: wireType, tool_use_id: scrubToolCallID(part.id), content: payload };
|
|
327
384
|
});
|
|
328
|
-
const
|
|
385
|
+
const fileIdFromMetadata = (metadata) => {
|
|
386
|
+
if (!ProviderShared.isRecord(metadata))
|
|
387
|
+
return undefined;
|
|
388
|
+
const anthropic = metadata.anthropic;
|
|
389
|
+
if (ProviderShared.isRecord(anthropic)) {
|
|
390
|
+
if (typeof anthropic.file_id === "string")
|
|
391
|
+
return anthropic.file_id;
|
|
392
|
+
if (typeof anthropic.fileId === "string")
|
|
393
|
+
return anthropic.fileId;
|
|
394
|
+
}
|
|
395
|
+
if (typeof metadata.file_id === "string")
|
|
396
|
+
return metadata.file_id;
|
|
397
|
+
if (typeof metadata.fileId === "string")
|
|
398
|
+
return metadata.fileId;
|
|
399
|
+
return undefined;
|
|
400
|
+
};
|
|
401
|
+
const transformationsFromMetadata = (metadata) => {
|
|
402
|
+
if (!ProviderShared.isRecord(metadata))
|
|
403
|
+
return undefined;
|
|
404
|
+
const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
|
|
405
|
+
const raw = anthropic?.transformations ?? metadata.transformations;
|
|
406
|
+
if (ProviderShared.isRecord(raw)) {
|
|
407
|
+
const value = raw.oversized_image;
|
|
408
|
+
if (value === "downsize" || value === "error")
|
|
409
|
+
return { oversized_image: value };
|
|
410
|
+
}
|
|
411
|
+
if (anthropic && (anthropic.oversized_image === "downsize" || anthropic.oversized_image === "error"))
|
|
412
|
+
return { oversized_image: anthropic.oversized_image };
|
|
413
|
+
return undefined;
|
|
414
|
+
};
|
|
415
|
+
const documentTitleFromPart = (part) => {
|
|
416
|
+
if (ProviderShared.isRecord(part.metadata)) {
|
|
417
|
+
const anthropic = part.metadata.anthropic;
|
|
418
|
+
if (ProviderShared.isRecord(anthropic) && typeof anthropic.title === "string")
|
|
419
|
+
return anthropic.title;
|
|
420
|
+
if (typeof part.metadata.title === "string")
|
|
421
|
+
return part.metadata.title;
|
|
422
|
+
}
|
|
423
|
+
if (typeof part.filename === "string" && part.filename.length > 0)
|
|
424
|
+
return part.filename;
|
|
425
|
+
return undefined;
|
|
426
|
+
};
|
|
427
|
+
const documentContextFromMetadata = (metadata) => {
|
|
428
|
+
if (!ProviderShared.isRecord(metadata))
|
|
429
|
+
return undefined;
|
|
430
|
+
const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
|
|
431
|
+
if (anthropic && typeof anthropic.context === "string")
|
|
432
|
+
return anthropic.context;
|
|
433
|
+
if (typeof metadata.context === "string")
|
|
434
|
+
return metadata.context;
|
|
435
|
+
return undefined;
|
|
436
|
+
};
|
|
437
|
+
const citationsFromMetadata = (metadata) => {
|
|
438
|
+
if (!ProviderShared.isRecord(metadata))
|
|
439
|
+
return undefined;
|
|
440
|
+
const raw = ProviderShared.isRecord(metadata.anthropic)
|
|
441
|
+
? (metadata.anthropic.citations ?? metadata.citations)
|
|
442
|
+
: metadata.citations;
|
|
443
|
+
if (ProviderShared.isRecord(raw) && typeof raw.enabled === "boolean")
|
|
444
|
+
return { enabled: raw.enabled };
|
|
445
|
+
return undefined;
|
|
446
|
+
};
|
|
447
|
+
const isHttpUrl = (value) => /^https?:\/\//i.test(value.trim());
|
|
448
|
+
const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part, breakpoints) {
|
|
449
|
+
const mime = part.mediaType.toLowerCase();
|
|
450
|
+
const cacheControlValue = breakpoints ? cacheControl(breakpoints, part.cache) : undefined;
|
|
451
|
+
const fileId = fileIdFromMetadata(part.metadata);
|
|
452
|
+
// SDK file sources: FileImageSource:2350 / FileDocumentSource:2344 {type:"file", file_id}
|
|
453
|
+
if (fileId) {
|
|
454
|
+
if (mime.startsWith("image/"))
|
|
455
|
+
return {
|
|
456
|
+
type: "image",
|
|
457
|
+
source: { type: "file", file_id: fileId },
|
|
458
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
459
|
+
...(transformationsFromMetadata(part.metadata) === undefined
|
|
460
|
+
? {}
|
|
461
|
+
: { transformations: transformationsFromMetadata(part.metadata) }),
|
|
462
|
+
};
|
|
463
|
+
return {
|
|
464
|
+
type: "document",
|
|
465
|
+
source: { type: "file", file_id: fileId },
|
|
466
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
467
|
+
...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
|
|
468
|
+
...(documentContextFromMetadata(part.metadata) === undefined
|
|
469
|
+
? {}
|
|
470
|
+
: { context: documentContextFromMetadata(part.metadata) }),
|
|
471
|
+
...(citationsFromMetadata(part.metadata) === undefined
|
|
472
|
+
? {}
|
|
473
|
+
: { citations: citationsFromMetadata(part.metadata) }),
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
const rawString = typeof part.data === "string" ? part.data.trim() : undefined;
|
|
477
|
+
// SDK URL sources: URLImageSource:3817 / URLPDFSource:3823 {type:"url", url}
|
|
478
|
+
if (rawString && isHttpUrl(rawString) && !rawString.startsWith("data:")) {
|
|
479
|
+
if (mime.startsWith("image/"))
|
|
480
|
+
return {
|
|
481
|
+
type: "image",
|
|
482
|
+
source: { type: "url", url: rawString },
|
|
483
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
484
|
+
...(transformationsFromMetadata(part.metadata) === undefined
|
|
485
|
+
? {}
|
|
486
|
+
: { transformations: transformationsFromMetadata(part.metadata) }),
|
|
487
|
+
};
|
|
488
|
+
if (mime === "application/pdf")
|
|
489
|
+
return {
|
|
490
|
+
type: "document",
|
|
491
|
+
source: { type: "url", url: rawString },
|
|
492
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
493
|
+
...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
|
|
494
|
+
...(documentContextFromMetadata(part.metadata) === undefined
|
|
495
|
+
? {}
|
|
496
|
+
: { context: documentContextFromMetadata(part.metadata) }),
|
|
497
|
+
...(citationsFromMetadata(part.metadata) === undefined
|
|
498
|
+
? {}
|
|
499
|
+
: { citations: citationsFromMetadata(part.metadata) }),
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
// SDK PlainTextSource:2716 {type:"text", media_type:"text/plain", data}
|
|
503
|
+
if (mime === "text/plain") {
|
|
504
|
+
const textData = typeof part.data !== "string"
|
|
505
|
+
? Buffer.from(part.data).toString("utf8")
|
|
506
|
+
: part.data.startsWith("data:")
|
|
507
|
+
? (() => {
|
|
508
|
+
const comma = part.data.indexOf(",");
|
|
509
|
+
const payload = comma >= 0 ? part.data.slice(comma + 1) : part.data;
|
|
510
|
+
return part.data.includes(";base64")
|
|
511
|
+
? Buffer.from(payload, "base64").toString("utf8")
|
|
512
|
+
: decodeURIComponent(payload);
|
|
513
|
+
})()
|
|
514
|
+
: part.data;
|
|
515
|
+
return {
|
|
516
|
+
type: "document",
|
|
517
|
+
source: { type: "text", media_type: "text/plain", data: textData },
|
|
518
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
519
|
+
...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
|
|
520
|
+
...(documentContextFromMetadata(part.metadata) === undefined
|
|
521
|
+
? {}
|
|
522
|
+
: { context: documentContextFromMetadata(part.metadata) }),
|
|
523
|
+
...(citationsFromMetadata(part.metadata) === undefined
|
|
524
|
+
? {}
|
|
525
|
+
: { citations: citationsFromMetadata(part.metadata) }),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
329
528
|
const media = ProviderShared.normalizeMedia(part);
|
|
330
529
|
if (media.mime === "application/pdf")
|
|
331
530
|
return {
|
|
@@ -335,6 +534,14 @@ const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part) {
|
|
|
335
534
|
media_type: "application/pdf",
|
|
336
535
|
data: media.base64,
|
|
337
536
|
},
|
|
537
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
538
|
+
...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
|
|
539
|
+
...(documentContextFromMetadata(part.metadata) === undefined
|
|
540
|
+
? {}
|
|
541
|
+
: { context: documentContextFromMetadata(part.metadata) }),
|
|
542
|
+
...(citationsFromMetadata(part.metadata) === undefined
|
|
543
|
+
? {}
|
|
544
|
+
: { citations: citationsFromMetadata(part.metadata) }),
|
|
338
545
|
};
|
|
339
546
|
if (!media.mime.startsWith("image/"))
|
|
340
547
|
return yield* invalid(`Anthropic Messages does not support media type ${part.mediaType}`);
|
|
@@ -345,6 +552,10 @@ const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part) {
|
|
|
345
552
|
media_type: media.mime,
|
|
346
553
|
data: media.base64,
|
|
347
554
|
},
|
|
555
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
556
|
+
...(transformationsFromMetadata(part.metadata) === undefined
|
|
557
|
+
? {}
|
|
558
|
+
: { transformations: transformationsFromMetadata(part.metadata) }),
|
|
348
559
|
};
|
|
349
560
|
});
|
|
350
561
|
// Tool results may carry structured text, images, and documents. Keep media as provider-native
|
|
@@ -440,7 +651,7 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
|
|
|
440
651
|
continue;
|
|
441
652
|
}
|
|
442
653
|
if (part.type === "media") {
|
|
443
|
-
content.push(yield* lowerMedia(part));
|
|
654
|
+
content.push(yield* lowerMedia(part, breakpoints));
|
|
444
655
|
continue;
|
|
445
656
|
}
|
|
446
657
|
return yield* ProviderShared.unsupportedContent("Anthropic Messages", "user", ["text", "media"]);
|
|
@@ -503,9 +714,52 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
|
|
|
503
714
|
});
|
|
504
715
|
const resolveOptions = Effect.fn("AnthropicMessages.resolveOptions")(function* (request) {
|
|
505
716
|
const input = request.providerOptions;
|
|
717
|
+
const rawServiceTier = input?.service_tier ?? input?.serviceTier;
|
|
718
|
+
const service_tier = rawServiceTier === "auto" || rawServiceTier === "standard_only"
|
|
719
|
+
? rawServiceTier
|
|
720
|
+
: undefined;
|
|
721
|
+
const rawMetadata = input?.metadata;
|
|
722
|
+
const metadata = ProviderShared.isRecord(rawMetadata) &&
|
|
723
|
+
(typeof rawMetadata.user_id === "string" || rawMetadata.user_id === null)
|
|
724
|
+
? { user_id: rawMetadata.user_id }
|
|
725
|
+
: undefined;
|
|
726
|
+
const container = typeof input?.container === "string" ||
|
|
727
|
+
ProviderShared.isRecord(input?.container)
|
|
728
|
+
? input.container
|
|
729
|
+
: undefined;
|
|
730
|
+
const rawInferenceGeo = input?.inference_geo ??
|
|
731
|
+
input?.inferenceGeo;
|
|
732
|
+
const inference_geo = typeof rawInferenceGeo === "string" ? rawInferenceGeo : undefined;
|
|
733
|
+
const rawCacheControl = input?.cache_control ??
|
|
734
|
+
input?.cacheControl;
|
|
735
|
+
const cache_control = ProviderShared.isRecord(rawCacheControl) && rawCacheControl.type === "ephemeral"
|
|
736
|
+
? rawCacheControl
|
|
737
|
+
: undefined;
|
|
738
|
+
const rawOutputConfig = input?.output_config ??
|
|
739
|
+
input?.outputConfig;
|
|
740
|
+
const outputConfigEffort = typeof input?.effort === "string"
|
|
741
|
+
? input.effort
|
|
742
|
+
: ProviderShared.isRecord(rawOutputConfig) && typeof rawOutputConfig.effort === "string"
|
|
743
|
+
? rawOutputConfig.effort
|
|
744
|
+
: undefined;
|
|
745
|
+
const outputConfigFormat = ProviderShared.isRecord(rawOutputConfig) && ProviderShared.isRecord(rawOutputConfig.format)
|
|
746
|
+
? rawOutputConfig.format
|
|
747
|
+
: undefined;
|
|
748
|
+
const output_config = outputConfigEffort === undefined && outputConfigFormat === undefined
|
|
749
|
+
? undefined
|
|
750
|
+
: {
|
|
751
|
+
...(outputConfigEffort === undefined ? {} : { effort: outputConfigEffort }),
|
|
752
|
+
...(outputConfigFormat === undefined ? {} : { format: outputConfigFormat }),
|
|
753
|
+
};
|
|
506
754
|
return {
|
|
507
755
|
thinking: yield* resolveThinking(input?.thinking),
|
|
508
|
-
effort:
|
|
756
|
+
effort: outputConfigEffort,
|
|
757
|
+
output_config,
|
|
758
|
+
service_tier,
|
|
759
|
+
metadata,
|
|
760
|
+
container,
|
|
761
|
+
inference_geo,
|
|
762
|
+
cache_control,
|
|
509
763
|
};
|
|
510
764
|
});
|
|
511
765
|
const resolveThinking = Effect.fn("AnthropicMessages.resolveThinking")(function* (input) {
|
|
@@ -566,7 +820,13 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
|
|
|
566
820
|
top_k: generation?.topK,
|
|
567
821
|
stop_sequences: generation?.stop,
|
|
568
822
|
thinking: options.thinking,
|
|
569
|
-
output_config: options.
|
|
823
|
+
output_config: options.output_config,
|
|
824
|
+
// top-level passthrough per SDK MessageCreateParamsBase:4638,4643,4649,4654,4670
|
|
825
|
+
cache_control: options.cache_control,
|
|
826
|
+
container: options.container,
|
|
827
|
+
inference_geo: options.inference_geo,
|
|
828
|
+
metadata: options.metadata,
|
|
829
|
+
service_tier: options.service_tier,
|
|
570
830
|
};
|
|
571
831
|
});
|
|
572
832
|
// =============================================================================
|
|
@@ -139,6 +139,7 @@ export declare const protocol: Protocol<{
|
|
|
139
139
|
} | undefined;
|
|
140
140
|
}[];
|
|
141
141
|
}[] | undefined;
|
|
142
|
+
readonly serviceTier?: string | undefined;
|
|
142
143
|
readonly toolConfig?: {
|
|
143
144
|
readonly functionCallingConfig: {
|
|
144
145
|
readonly mode: "AUTO" | "NONE" | "ANY";
|
|
@@ -150,7 +151,6 @@ export declare const protocol: Protocol<{
|
|
|
150
151
|
readonly category: string;
|
|
151
152
|
readonly threshold: string;
|
|
152
153
|
}[] | undefined;
|
|
153
|
-
readonly serviceTier?: string | undefined;
|
|
154
154
|
readonly labels?: {
|
|
155
155
|
readonly [x: string]: string;
|
|
156
156
|
} | undefined;
|
|
@@ -269,6 +269,7 @@ export declare const route: Route<{
|
|
|
269
269
|
} | undefined;
|
|
270
270
|
}[];
|
|
271
271
|
}[] | undefined;
|
|
272
|
+
readonly serviceTier?: string | undefined;
|
|
272
273
|
readonly toolConfig?: {
|
|
273
274
|
readonly functionCallingConfig: {
|
|
274
275
|
readonly mode: "AUTO" | "NONE" | "ANY";
|
|
@@ -280,7 +281,6 @@ export declare const route: Route<{
|
|
|
280
281
|
readonly category: string;
|
|
281
282
|
readonly threshold: string;
|
|
282
283
|
}[] | undefined;
|
|
283
|
-
readonly serviceTier?: string | undefined;
|
|
284
284
|
readonly labels?: {
|
|
285
285
|
readonly [x: string]: string;
|
|
286
286
|
} | undefined;
|
|
@@ -619,6 +619,7 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
619
619
|
readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
|
|
620
620
|
} | undefined;
|
|
621
621
|
readonly temperature?: number | undefined;
|
|
622
|
+
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
622
623
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
623
624
|
readonly type: "function";
|
|
624
625
|
readonly name: string;
|
|
@@ -642,7 +643,6 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
642
643
|
readonly presence_penalty?: number | undefined;
|
|
643
644
|
readonly safety_identifier?: string | undefined;
|
|
644
645
|
readonly top_logprobs?: number | undefined;
|
|
645
|
-
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
646
646
|
readonly max_output_tokens?: number | undefined;
|
|
647
647
|
readonly max_tool_calls?: number | undefined;
|
|
648
648
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -929,6 +929,7 @@ export declare const protocol: Protocol<{
|
|
|
929
929
|
readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
|
|
930
930
|
} | undefined;
|
|
931
931
|
readonly temperature?: number | undefined;
|
|
932
|
+
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
932
933
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
933
934
|
readonly type: "function";
|
|
934
935
|
readonly name: string;
|
|
@@ -952,7 +953,6 @@ export declare const protocol: Protocol<{
|
|
|
952
953
|
readonly presence_penalty?: number | undefined;
|
|
953
954
|
readonly safety_identifier?: string | undefined;
|
|
954
955
|
readonly top_logprobs?: number | undefined;
|
|
955
|
-
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
956
956
|
readonly max_output_tokens?: number | undefined;
|
|
957
957
|
readonly max_tool_calls?: number | undefined;
|
|
958
958
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -1100,6 +1100,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1100
1100
|
readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
|
|
1101
1101
|
} | undefined;
|
|
1102
1102
|
readonly temperature?: number | undefined;
|
|
1103
|
+
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
1103
1104
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
1104
1105
|
readonly type: "function";
|
|
1105
1106
|
readonly name: string;
|
|
@@ -1123,7 +1124,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1123
1124
|
readonly presence_penalty?: number | undefined;
|
|
1124
1125
|
readonly safety_identifier?: string | undefined;
|
|
1125
1126
|
readonly top_logprobs?: number | undefined;
|
|
1126
|
-
readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
|
|
1127
1127
|
readonly max_output_tokens?: number | undefined;
|
|
1128
1128
|
readonly max_tool_calls?: number | undefined;
|
|
1129
1129
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -94,6 +94,7 @@ export declare const route: Route<{
|
|
|
94
94
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
95
95
|
} | undefined;
|
|
96
96
|
readonly temperature?: number | undefined;
|
|
97
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
97
98
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
98
99
|
readonly type: "function";
|
|
99
100
|
readonly name: string;
|
|
@@ -117,7 +118,6 @@ export declare const route: Route<{
|
|
|
117
118
|
readonly presence_penalty?: number | undefined;
|
|
118
119
|
readonly safety_identifier?: string | undefined;
|
|
119
120
|
readonly top_logprobs?: number | undefined;
|
|
120
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
121
121
|
readonly max_output_tokens?: number | undefined;
|
|
122
122
|
readonly max_tool_calls?: number | undefined;
|
|
123
123
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -230,6 +230,7 @@ export declare const protocol: Protocol<{
|
|
|
230
230
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
231
231
|
} | undefined;
|
|
232
232
|
readonly temperature?: number | undefined;
|
|
233
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
233
234
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
234
235
|
readonly type: "function";
|
|
235
236
|
readonly name: string;
|
|
@@ -255,7 +256,6 @@ export declare const protocol: Protocol<{
|
|
|
255
256
|
readonly presence_penalty?: number | undefined;
|
|
256
257
|
readonly safety_identifier?: string | undefined;
|
|
257
258
|
readonly top_logprobs?: number | undefined;
|
|
258
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
259
259
|
readonly max_output_tokens?: number | undefined;
|
|
260
260
|
readonly max_tool_calls?: number | undefined;
|
|
261
261
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -413,6 +413,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
413
413
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
414
414
|
} | undefined;
|
|
415
415
|
readonly temperature?: number | undefined;
|
|
416
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
416
417
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
417
418
|
readonly type: "function";
|
|
418
419
|
readonly name: string;
|
|
@@ -438,7 +439,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
438
439
|
readonly presence_penalty?: number | undefined;
|
|
439
440
|
readonly safety_identifier?: string | undefined;
|
|
440
441
|
readonly top_logprobs?: number | undefined;
|
|
441
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
442
442
|
readonly max_output_tokens?: number | undefined;
|
|
443
443
|
readonly max_tool_calls?: number | undefined;
|
|
444
444
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -542,6 +542,7 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
542
542
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
543
543
|
} | undefined;
|
|
544
544
|
readonly temperature?: number | undefined;
|
|
545
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
545
546
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
546
547
|
readonly type: "function";
|
|
547
548
|
readonly name: string;
|
|
@@ -567,7 +568,6 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
567
568
|
readonly presence_penalty?: number | undefined;
|
|
568
569
|
readonly safety_identifier?: string | undefined;
|
|
569
570
|
readonly top_logprobs?: number | undefined;
|
|
570
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
571
571
|
readonly max_output_tokens?: number | undefined;
|
|
572
572
|
readonly max_tool_calls?: number | undefined;
|
|
573
573
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -671,6 +671,7 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
671
671
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
672
672
|
} | undefined;
|
|
673
673
|
readonly temperature?: number | undefined;
|
|
674
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
674
675
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
675
676
|
readonly type: "function";
|
|
676
677
|
readonly name: string;
|
|
@@ -696,7 +697,6 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
696
697
|
readonly presence_penalty?: number | undefined;
|
|
697
698
|
readonly safety_identifier?: string | undefined;
|
|
698
699
|
readonly top_logprobs?: number | undefined;
|
|
699
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
700
700
|
readonly max_output_tokens?: number | undefined;
|
|
701
701
|
readonly max_tool_calls?: number | undefined;
|
|
702
702
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -800,6 +800,7 @@ export declare const route: Route<{
|
|
|
800
800
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
801
801
|
} | undefined;
|
|
802
802
|
readonly temperature?: number | undefined;
|
|
803
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
803
804
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
804
805
|
readonly type: "function";
|
|
805
806
|
readonly name: string;
|
|
@@ -825,7 +826,6 @@ export declare const route: Route<{
|
|
|
825
826
|
readonly presence_penalty?: number | undefined;
|
|
826
827
|
readonly safety_identifier?: string | undefined;
|
|
827
828
|
readonly top_logprobs?: number | undefined;
|
|
828
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
829
829
|
readonly max_output_tokens?: number | undefined;
|
|
830
830
|
readonly max_tool_calls?: number | undefined;
|
|
831
831
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -29,6 +29,7 @@ export declare const lower: (part: {
|
|
|
29
29
|
readonly metadata?: {
|
|
30
30
|
readonly [x: string]: unknown;
|
|
31
31
|
} | undefined;
|
|
32
|
+
readonly cache?: import("../../schema/options.js").CacheHint | undefined;
|
|
32
33
|
readonly filename?: string | undefined;
|
|
33
34
|
}) => Effect.Effect<{
|
|
34
35
|
readonly document: {
|
|
@@ -89,6 +89,7 @@ export declare const protocol: Protocol<{
|
|
|
89
89
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
90
90
|
} | undefined;
|
|
91
91
|
readonly temperature?: number | undefined;
|
|
92
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
92
93
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
93
94
|
readonly type: "function";
|
|
94
95
|
readonly name: string;
|
|
@@ -112,7 +113,6 @@ export declare const protocol: Protocol<{
|
|
|
112
113
|
readonly presence_penalty?: number | undefined;
|
|
113
114
|
readonly safety_identifier?: string | undefined;
|
|
114
115
|
readonly top_logprobs?: number | undefined;
|
|
115
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
116
116
|
readonly max_output_tokens?: number | undefined;
|
|
117
117
|
readonly max_tool_calls?: number | undefined;
|
|
118
118
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -214,6 +214,7 @@ export declare const routes: (RouteDef<{
|
|
|
214
214
|
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
215
215
|
} | undefined;
|
|
216
216
|
readonly temperature?: number | undefined;
|
|
217
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
217
218
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
218
219
|
readonly type: "function";
|
|
219
220
|
readonly name: string;
|
|
@@ -239,7 +240,6 @@ export declare const routes: (RouteDef<{
|
|
|
239
240
|
readonly presence_penalty?: number | undefined;
|
|
240
241
|
readonly safety_identifier?: string | undefined;
|
|
241
242
|
readonly top_logprobs?: number | undefined;
|
|
242
|
-
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
243
243
|
readonly max_output_tokens?: number | undefined;
|
|
244
244
|
readonly max_tool_calls?: number | undefined;
|
|
245
245
|
readonly parallel_tool_calls?: boolean | undefined;
|