@opencode-ai/ai 0.0.0-beta-17963 → 0.0.0-beta-18027
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.js +3 -2
- package/dist/protocols/gemini.d.ts +40 -40
- package/dist/protocols/gemini.js +68 -50
- package/dist/protocols/open-responses.d.ts +6 -6
- package/dist/protocols/open-responses.js +10 -3
- package/dist/protocols/openai-chat.d.ts +42 -2
- package/dist/protocols/openai-chat.js +34 -5
- package/dist/protocols/openai-compatible-responses.d.ts +1 -1
- package/dist/protocols/openai-responses.d.ts +6 -6
- package/dist/protocols/openai-responses.js +1 -2
- package/dist/protocols/utils/open-responses-options.d.ts +4 -3
- package/dist/protocols/utils/open-responses-options.js +2 -1
- package/dist/protocols/utils/openai-options.d.ts +3 -3
- package/dist/protocols/utils/openai-options.js +1 -1
- package/dist/protocols/xai-responses.d.ts +1 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +11 -11
- package/dist/providers/azure.d.ts +8 -8
- package/dist/providers/cloudflare.d.ts +2 -2
- package/dist/providers/google-vertex-chat.d.ts +2 -2
- package/dist/providers/google-vertex-responses.d.ts +1 -1
- package/dist/providers/google-vertex.d.ts +7 -7
- package/dist/providers/google-vertex.js +13 -1
- package/dist/providers/google.d.ts +7 -7
- package/dist/providers/openai-compatible-responses.d.ts +1 -1
- package/dist/providers/openai-compatible.d.ts +9 -9
- package/dist/providers/openai-options.d.ts +6 -2
- package/dist/providers/openai.d.ts +12 -12
- package/dist/providers/openrouter.d.ts +22 -0
- package/dist/providers/xai.d.ts +11 -11
- package/package.json +5 -5
|
@@ -123,6 +123,9 @@ const OpenAIChatUsage = Schema.StructWithRest(Schema.Struct({
|
|
|
123
123
|
prompt_tokens: optionalNull(Schema.Number),
|
|
124
124
|
completion_tokens: optionalNull(Schema.Number),
|
|
125
125
|
total_tokens: optionalNull(Schema.Number),
|
|
126
|
+
// Zai reports cache hits as top-level `cached_tokens`; DeepSeek uses `prompt_cache_hit_tokens`.
|
|
127
|
+
cached_tokens: optionalNull(Schema.Number),
|
|
128
|
+
prompt_cache_hit_tokens: optionalNull(Schema.Number),
|
|
126
129
|
prompt_tokens_details: optionalNull(Schema.StructWithRest(Schema.Struct({
|
|
127
130
|
cached_tokens: optionalNull(Schema.Number),
|
|
128
131
|
cache_write_tokens: optionalNull(Schema.Number),
|
|
@@ -151,11 +154,13 @@ const OpenAIChatDelta = Schema.StructWithRest(Schema.Struct({
|
|
|
151
154
|
reasoning_details: optionalNull(Schema.Unknown),
|
|
152
155
|
tool_calls: optionalNull(Schema.Array(OpenAIChatToolCallDelta)),
|
|
153
156
|
}), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
154
|
-
const OpenAIChatChoice = Schema.Struct({
|
|
157
|
+
const OpenAIChatChoice = Schema.StructWithRest(Schema.Struct({
|
|
155
158
|
delta: optionalNull(OpenAIChatDelta),
|
|
156
159
|
finish_reason: optionalNull(Schema.String),
|
|
157
160
|
native_finish_reason: optionalNull(Schema.String),
|
|
158
|
-
|
|
161
|
+
// Moonshot streams usage on `choice.usage` instead of top-level `usage`.
|
|
162
|
+
usage: optionalNull(OpenAIChatUsage),
|
|
163
|
+
}), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
159
164
|
const OpenAIChatError = Schema.Struct({
|
|
160
165
|
code: optionalNull(Schema.Union([Schema.String, Schema.Number])),
|
|
161
166
|
message: Schema.String,
|
|
@@ -396,6 +401,18 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request,
|
|
|
396
401
|
flushImages();
|
|
397
402
|
return messages;
|
|
398
403
|
});
|
|
404
|
+
// Anthropic via LiteLLM and Amazon Bedrock require `tools` to be present
|
|
405
|
+
// whenever the conversation history contains tool calls/results. Send an
|
|
406
|
+
// explicit empty array when we have history but no active tools.
|
|
407
|
+
const hasToolHistory = (messages) => {
|
|
408
|
+
for (const message of messages) {
|
|
409
|
+
if (message.role === "tool")
|
|
410
|
+
return true;
|
|
411
|
+
if (message.role === "assistant" && message.content.some((part) => part.type === "tool-call"))
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
};
|
|
399
416
|
const lowerOptions = (request) => {
|
|
400
417
|
const options = OpenAIOptions.resolve(request);
|
|
401
418
|
return {
|
|
@@ -413,11 +430,14 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
|
|
|
413
430
|
const generation = request.generation;
|
|
414
431
|
const toolSchemaCompatibility = request.model.compatibility?.toolSchema;
|
|
415
432
|
const maxTokensField = request.model.compatibility?.maxTokensField ?? "max_tokens";
|
|
433
|
+
const hasHistory = hasToolHistory(request.messages);
|
|
416
434
|
return {
|
|
417
435
|
model: request.model.id,
|
|
418
436
|
messages: yield* lowerMessages(request, options),
|
|
419
437
|
tools: request.tools.length === 0
|
|
420
|
-
?
|
|
438
|
+
? hasHistory
|
|
439
|
+
? []
|
|
440
|
+
: undefined
|
|
421
441
|
: request.tools.map((tool) => lowerTool(tool, ToolSchemaProjection.modelCompatibility(tool.inputSchema, toolSchemaCompatibility), options)),
|
|
422
442
|
tool_choice: request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined,
|
|
423
443
|
stream: true,
|
|
@@ -458,12 +478,18 @@ const mapFinishReason = (reason) => {
|
|
|
458
478
|
// total) with a `reasoning_tokens` subset. We pass the inclusive totals
|
|
459
479
|
// through and derive the non-cached breakdown so the `AI.Usage` contract is
|
|
460
480
|
// satisfied on both sides.
|
|
481
|
+
// Providers differ on cache-hit location: OpenAI uses
|
|
482
|
+
// `prompt_tokens_details.cached_tokens`, DeepSeek uses
|
|
483
|
+
// `prompt_cache_hit_tokens`, and Zai uses top-level `cached_tokens`.
|
|
461
484
|
const mapUsage = (usage) => {
|
|
462
485
|
if (!usage)
|
|
463
486
|
return undefined;
|
|
464
487
|
const input = usage.prompt_tokens ?? undefined;
|
|
465
488
|
const output = usage.completion_tokens ?? undefined;
|
|
466
|
-
const cached = usage.prompt_tokens_details?.cached_tokens ??
|
|
489
|
+
const cached = (usage.prompt_tokens_details?.cached_tokens ??
|
|
490
|
+
usage.prompt_cache_hit_tokens ??
|
|
491
|
+
usage.cached_tokens ??
|
|
492
|
+
undefined);
|
|
467
493
|
const cacheWrite = usage.prompt_tokens_details?.cache_write_tokens ?? undefined;
|
|
468
494
|
const reasoning = usage.completion_tokens_details?.reasoning_tokens ?? undefined;
|
|
469
495
|
const nonCached = ProviderShared.subtractTokens(input, ProviderShared.sumTokens(cached, cacheWrite));
|
|
@@ -554,8 +580,11 @@ const step = (state, event) => Effect.gen(function* () {
|
|
|
554
580
|
}),
|
|
555
581
|
});
|
|
556
582
|
const events = [];
|
|
557
|
-
const usage = mapUsage(event.usage) ?? state.usage;
|
|
558
583
|
const choice = event.choices?.[0];
|
|
584
|
+
// Moonshot (and a few other OpenAI-compatible providers) attach usage to
|
|
585
|
+
// `choice.usage` instead of the top-level `usage` field.
|
|
586
|
+
const choiceUsage = choice?.usage;
|
|
587
|
+
const usage = mapUsage(event.usage) ?? (choiceUsage ? mapUsage(choiceUsage) : undefined) ?? state.usage;
|
|
559
588
|
const rawFinishReason = choice?.finish_reason;
|
|
560
589
|
const finishReason = rawFinishReason !== undefined && rawFinishReason !== null
|
|
561
590
|
? { normalized: mapFinishReason(rawFinishReason), raw: choice?.native_finish_reason ?? rawFinishReason }
|
|
@@ -117,7 +117,7 @@ export declare const route: Route<{
|
|
|
117
117
|
readonly presence_penalty?: number | undefined;
|
|
118
118
|
readonly safety_identifier?: string | undefined;
|
|
119
119
|
readonly top_logprobs?: number | undefined;
|
|
120
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -112,7 +112,7 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
112
112
|
}>>;
|
|
113
113
|
readonly top_logprobs: Schema.optional<Schema.Int>;
|
|
114
114
|
readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
|
|
115
|
-
readonly service_tier: Schema.optional<Schema.
|
|
115
|
+
readonly service_tier: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").ServiceTier, import("./utils/open-responses-options.js").ServiceTier>>;
|
|
116
116
|
readonly prompt_cache_key: Schema.optional<Schema.String>;
|
|
117
117
|
readonly include: Schema.optional<Schema.$Array<Schema.declare<import("./utils/open-responses-options.js").ResponseIncludable, import("./utils/open-responses-options.js").ResponseIncludable>>>;
|
|
118
118
|
readonly reasoning: Schema.optional<Schema.Struct<{
|
|
@@ -255,7 +255,7 @@ export declare const protocol: Protocol<{
|
|
|
255
255
|
readonly presence_penalty?: number | undefined;
|
|
256
256
|
readonly safety_identifier?: string | undefined;
|
|
257
257
|
readonly top_logprobs?: number | undefined;
|
|
258
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -438,7 +438,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
438
438
|
readonly presence_penalty?: number | undefined;
|
|
439
439
|
readonly safety_identifier?: string | undefined;
|
|
440
440
|
readonly top_logprobs?: number | undefined;
|
|
441
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -567,7 +567,7 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
567
567
|
readonly presence_penalty?: number | undefined;
|
|
568
568
|
readonly safety_identifier?: string | undefined;
|
|
569
569
|
readonly top_logprobs?: number | undefined;
|
|
570
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -696,7 +696,7 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
696
696
|
readonly presence_penalty?: number | undefined;
|
|
697
697
|
readonly safety_identifier?: string | undefined;
|
|
698
698
|
readonly top_logprobs?: number | undefined;
|
|
699
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -825,7 +825,7 @@ export declare const route: Route<{
|
|
|
825
825
|
readonly presence_penalty?: number | undefined;
|
|
826
826
|
readonly safety_identifier?: string | undefined;
|
|
827
827
|
readonly top_logprobs?: number | undefined;
|
|
828
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -109,13 +109,12 @@ const HOSTED_TOOLS = {
|
|
|
109
109
|
name: "code_interpreter",
|
|
110
110
|
input: (item) => ({ code: item.code, container_id: item.container_id }),
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
computer_call: { name: "computer_use", input: (item) => item.action ?? {} },
|
|
113
113
|
image_generation_call: { name: "image_generation", input: () => ({}), result: hostedToolResult },
|
|
114
114
|
mcp_call: {
|
|
115
115
|
name: "mcp",
|
|
116
116
|
input: (item) => ({ server_label: item.server_label, name: item.name, arguments: item.arguments }),
|
|
117
117
|
},
|
|
118
|
-
local_shell_call: { name: "local_shell", input: (item) => item.action ?? {} },
|
|
119
118
|
};
|
|
120
119
|
const step = (state, event) => {
|
|
121
120
|
if (event.type === "response.reasoning_text.delta" || event.type === "response.reasoning_summary.delta")
|
|
@@ -9,12 +9,13 @@ export declare const TextVerbosity: Schema.declare<TextVerbosity, TextVerbosity>
|
|
|
9
9
|
export declare const ResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
|
|
10
10
|
export type ResponseIncludable = (typeof ResponseIncludables)[number] | (string & {});
|
|
11
11
|
export declare const ServiceTiers: readonly ["auto", "default", "flex", "priority"];
|
|
12
|
-
export type ServiceTier = (typeof ServiceTiers)[number];
|
|
12
|
+
export type ServiceTier = (typeof ServiceTiers)[number] | (string & {});
|
|
13
|
+
export declare const ServiceTier: Schema.declare<ServiceTier, ServiceTier>;
|
|
13
14
|
export declare const Truncations: readonly ["auto", "disabled"];
|
|
14
15
|
export type Truncation = (typeof Truncations)[number];
|
|
15
16
|
export declare const TextVerbositySchema: Schema.declare<TextVerbosity, TextVerbosity>;
|
|
16
17
|
export declare const ResponseIncludableSchema: Schema.declare<ResponseIncludable, ResponseIncludable>;
|
|
17
|
-
export declare const ServiceTierSchema: Schema.
|
|
18
|
+
export declare const ServiceTierSchema: Schema.declare<ServiceTier, ServiceTier>;
|
|
18
19
|
export declare const TruncationSchema: Schema.Literals<readonly ["auto", "disabled"]>;
|
|
19
20
|
export declare const AllowedTools: Schema.Struct<{
|
|
20
21
|
readonly toolNames: Schema.$Array<Schema.String>;
|
|
@@ -37,7 +38,7 @@ export declare const Options: Schema.Struct<{
|
|
|
37
38
|
readonly reasoningSummary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
|
|
38
39
|
readonly include: Schema.optional<Schema.$Array<Schema.declare<ResponseIncludable, ResponseIncludable>>>;
|
|
39
40
|
readonly textVerbosity: Schema.optional<Schema.declare<TextVerbosity, TextVerbosity>>;
|
|
40
|
-
readonly serviceTier: Schema.optional<Schema.
|
|
41
|
+
readonly serviceTier: Schema.optional<Schema.declare<ServiceTier, ServiceTier>>;
|
|
41
42
|
readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
|
|
42
43
|
readonly allowedTools: Schema.optional<Schema.Struct<{
|
|
43
44
|
readonly toolNames: Schema.$Array<Schema.String>;
|
|
@@ -14,10 +14,11 @@ export const ResponseIncludables = [
|
|
|
14
14
|
"message.output_text.logprobs",
|
|
15
15
|
];
|
|
16
16
|
export const ServiceTiers = ["auto", "default", "flex", "priority"];
|
|
17
|
+
export const ServiceTier = Schema.declare((value) => typeof value === "string", { title: "ServiceTier" });
|
|
17
18
|
export const Truncations = ["auto", "disabled"];
|
|
18
19
|
export const TextVerbositySchema = TextVerbosity;
|
|
19
20
|
export const ResponseIncludableSchema = Schema.declare((value) => typeof value === "string", { title: "ResponseIncludable" });
|
|
20
|
-
export const ServiceTierSchema =
|
|
21
|
+
export const ServiceTierSchema = ServiceTier;
|
|
21
22
|
export const TruncationSchema = Schema.Literals(Truncations);
|
|
22
23
|
export const AllowedTools = Schema.Struct({
|
|
23
24
|
toolNames: Schema.Array(Schema.String),
|
|
@@ -5,12 +5,12 @@ export declare const OpenAITextVerbosities: readonly ["low", "medium", "high"];
|
|
|
5
5
|
export type OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
|
|
6
6
|
export declare const OpenAIResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
|
|
7
7
|
export type OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludable;
|
|
8
|
-
export declare const OpenAIServiceTiers: readonly ["auto", "default", "flex", "priority"];
|
|
9
|
-
export type OpenAIServiceTier =
|
|
8
|
+
export declare const OpenAIServiceTiers: readonly ["auto", "default", "flex", "priority", "scale"];
|
|
9
|
+
export type OpenAIServiceTier = (typeof OpenAIServiceTiers)[number] | (string & {});
|
|
10
10
|
export declare const OpenAIReasoningEffort: import("effect/Schema").declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>;
|
|
11
11
|
export declare const OpenAITextVerbosity: import("effect/Schema").declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>;
|
|
12
12
|
export declare const OpenAIResponseIncludable: import("effect/Schema").declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>;
|
|
13
|
-
export declare const OpenAIServiceTier: import("effect/Schema").
|
|
13
|
+
export declare const OpenAIServiceTier: import("effect/Schema").declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>;
|
|
14
14
|
export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
|
|
15
15
|
export declare const resolve: (request: import("../../index.js").LLMRequest) => OpenResponsesOptions.Resolved;
|
|
16
16
|
export * as OpenAIOptions from "./openai-options.js";
|
|
@@ -4,7 +4,7 @@ export const OpenAITextVerbosities = OpenResponsesOptions.TextVerbosities;
|
|
|
4
4
|
// Mirrors OpenAI's `ResponseIncludable` union from the official SDK. Keep this
|
|
5
5
|
// in lockstep with `openai-node/src/resources/responses/responses.ts`.
|
|
6
6
|
export const OpenAIResponseIncludables = OpenResponsesOptions.ResponseIncludables;
|
|
7
|
-
export const OpenAIServiceTiers = OpenResponsesOptions.ServiceTiers;
|
|
7
|
+
export const OpenAIServiceTiers = [...OpenResponsesOptions.ServiceTiers, "scale"];
|
|
8
8
|
export const OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
|
|
9
9
|
export const OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
|
|
10
10
|
export const OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludableSchema;
|
|
@@ -112,7 +112,7 @@ export declare const protocol: Protocol<{
|
|
|
112
112
|
readonly presence_penalty?: number | undefined;
|
|
113
113
|
readonly safety_identifier?: string | undefined;
|
|
114
114
|
readonly top_logprobs?: number | undefined;
|
|
115
|
-
readonly service_tier?: "
|
|
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;
|
|
@@ -239,31 +239,31 @@ export declare const routes: (RouteDef<{
|
|
|
239
239
|
readonly presence_penalty?: number | undefined;
|
|
240
240
|
readonly safety_identifier?: string | undefined;
|
|
241
241
|
readonly top_logprobs?: number | undefined;
|
|
242
|
-
readonly service_tier?: "
|
|
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;
|
|
246
246
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
247
247
|
export declare const configure: (input?: Config) => {
|
|
248
248
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
249
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
250
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
251
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
249
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
250
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
251
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
252
252
|
configure: (input?: Config) => /*elided*/ any;
|
|
253
253
|
};
|
|
254
254
|
export declare const provider: {
|
|
255
255
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
256
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
257
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
258
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
256
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
257
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
258
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
259
259
|
configure: (input?: Config) => {
|
|
260
260
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
261
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
262
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
263
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
261
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
262
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
263
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
264
264
|
configure: /*elided*/ any;
|
|
265
265
|
};
|
|
266
266
|
};
|
|
267
267
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
268
268
|
export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
269
|
-
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./
|
|
269
|
+
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
@@ -242,29 +242,29 @@ export declare const routes: (RouteDef<{
|
|
|
242
242
|
readonly presence_penalty?: number | undefined;
|
|
243
243
|
readonly safety_identifier?: string | undefined;
|
|
244
244
|
readonly top_logprobs?: number | undefined;
|
|
245
|
-
readonly service_tier?: "
|
|
245
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
246
246
|
readonly max_output_tokens?: number | undefined;
|
|
247
247
|
readonly max_tool_calls?: number | undefined;
|
|
248
248
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
249
249
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
250
250
|
export declare const configure: (input: Config) => {
|
|
251
251
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
252
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
253
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
254
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
252
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
253
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
254
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
255
255
|
configure: (input: Config) => /*elided*/ any;
|
|
256
256
|
};
|
|
257
257
|
export declare const provider: {
|
|
258
258
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
259
259
|
configure: (input: Config) => {
|
|
260
260
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
261
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
262
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
263
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
261
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
262
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
263
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
264
264
|
configure: /*elided*/ any;
|
|
265
265
|
};
|
|
266
266
|
};
|
|
267
267
|
export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
268
268
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
269
|
-
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./
|
|
269
|
+
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
270
270
|
export {};
|
|
@@ -323,7 +323,7 @@ export declare const CloudflareAIGateway: {
|
|
|
323
323
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
324
324
|
configure: (options: AIGatewayOptions) => {
|
|
325
325
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
326
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
326
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
327
327
|
configure: /*elided*/ any;
|
|
328
328
|
};
|
|
329
329
|
};
|
|
@@ -331,7 +331,7 @@ export declare const CloudflareWorkersAI: {
|
|
|
331
331
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
332
332
|
configure: (options: WorkersAIOptions) => {
|
|
333
333
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
334
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
334
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
335
335
|
configure: /*elided*/ any;
|
|
336
336
|
};
|
|
337
337
|
};
|
|
@@ -117,14 +117,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
117
117
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
118
118
|
export declare const configure: (input?: Config) => {
|
|
119
119
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
120
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
120
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
121
121
|
configure: (input?: Config) => /*elided*/ any;
|
|
122
122
|
};
|
|
123
123
|
export declare const provider: {
|
|
124
124
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
125
125
|
configure: (input?: Config) => {
|
|
126
126
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
127
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
127
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
128
128
|
configure: /*elided*/ any;
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -130,7 +130,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
130
130
|
readonly presence_penalty?: number | undefined;
|
|
131
131
|
readonly safety_identifier?: string | undefined;
|
|
132
132
|
readonly top_logprobs?: number | undefined;
|
|
133
|
-
readonly service_tier?: "
|
|
133
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
134
134
|
readonly max_output_tokens?: number | undefined;
|
|
135
135
|
readonly max_tool_calls?: number | undefined;
|
|
136
136
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -28,23 +28,22 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
28
28
|
};
|
|
29
29
|
export declare const routes: Route<{
|
|
30
30
|
readonly contents: readonly {
|
|
31
|
-
readonly
|
|
32
|
-
readonly parts: readonly ({
|
|
31
|
+
readonly parts?: readonly ({
|
|
33
32
|
readonly inlineData: {
|
|
34
33
|
readonly mimeType: string;
|
|
35
34
|
readonly data: string;
|
|
36
35
|
};
|
|
37
36
|
} | {
|
|
38
37
|
readonly text: string;
|
|
39
|
-
readonly thought?: boolean | undefined;
|
|
40
|
-
readonly thoughtSignature?: string | undefined;
|
|
38
|
+
readonly thought?: boolean | null | undefined;
|
|
39
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
41
40
|
} | {
|
|
42
41
|
readonly functionCall: {
|
|
43
42
|
readonly name: string;
|
|
44
|
-
readonly id?: string | undefined;
|
|
43
|
+
readonly id?: string | null | undefined;
|
|
45
44
|
readonly args?: unknown;
|
|
46
45
|
};
|
|
47
|
-
readonly thoughtSignature?: string | undefined;
|
|
46
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
48
47
|
} | {
|
|
49
48
|
readonly functionResponse: {
|
|
50
49
|
readonly name: string;
|
|
@@ -57,7 +56,8 @@ export declare const routes: Route<{
|
|
|
57
56
|
};
|
|
58
57
|
}[] | undefined;
|
|
59
58
|
};
|
|
60
|
-
})[];
|
|
59
|
+
})[] | null | undefined;
|
|
60
|
+
readonly role?: "model" | "user" | null | undefined;
|
|
61
61
|
}[];
|
|
62
62
|
readonly tools?: readonly {
|
|
63
63
|
readonly functionDeclarations: readonly {
|
|
@@ -10,11 +10,23 @@ import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
|
10
10
|
export const id = ProviderID.make("google-vertex");
|
|
11
11
|
const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
|
|
12
12
|
const body = yield* Gemini.protocol.body.from(request);
|
|
13
|
+
// Vertex's native REST schema rejects `id` on FunctionCall/FunctionResponse parts with HTTP 400,
|
|
14
|
+
// unlike AI Studio, so history minted there cannot be lowered verbatim.
|
|
15
|
+
const contents = body.contents.map((content) => ({
|
|
16
|
+
...content,
|
|
17
|
+
parts: (content.parts ?? []).map((part) => {
|
|
18
|
+
if ("functionCall" in part)
|
|
19
|
+
return { ...part, functionCall: { ...part.functionCall, id: undefined } };
|
|
20
|
+
if ("functionResponse" in part)
|
|
21
|
+
return { ...part, functionResponse: { ...part.functionResponse, id: undefined } };
|
|
22
|
+
return part;
|
|
23
|
+
}),
|
|
24
|
+
}));
|
|
13
25
|
const value = request.providerOptions?.labels;
|
|
14
26
|
const labels = ProviderShared.isRecord(value)
|
|
15
27
|
? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"))
|
|
16
28
|
: undefined;
|
|
17
|
-
return { ...body, labels };
|
|
29
|
+
return { ...body, contents, labels };
|
|
18
30
|
});
|
|
19
31
|
const protocol = {
|
|
20
32
|
...Gemini.protocol,
|
|
@@ -9,23 +9,22 @@ export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput;
|
|
|
9
9
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
10
|
export declare const routes: import("../route/client.js").Route<{
|
|
11
11
|
readonly contents: readonly {
|
|
12
|
-
readonly
|
|
13
|
-
readonly parts: readonly ({
|
|
12
|
+
readonly parts?: readonly ({
|
|
14
13
|
readonly inlineData: {
|
|
15
14
|
readonly mimeType: string;
|
|
16
15
|
readonly data: string;
|
|
17
16
|
};
|
|
18
17
|
} | {
|
|
19
18
|
readonly text: string;
|
|
20
|
-
readonly thought?: boolean | undefined;
|
|
21
|
-
readonly thoughtSignature?: string | undefined;
|
|
19
|
+
readonly thought?: boolean | null | undefined;
|
|
20
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
22
21
|
} | {
|
|
23
22
|
readonly functionCall: {
|
|
24
23
|
readonly name: string;
|
|
25
|
-
readonly id?: string | undefined;
|
|
24
|
+
readonly id?: string | null | undefined;
|
|
26
25
|
readonly args?: unknown;
|
|
27
26
|
};
|
|
28
|
-
readonly thoughtSignature?: string | undefined;
|
|
27
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
29
28
|
} | {
|
|
30
29
|
readonly functionResponse: {
|
|
31
30
|
readonly name: string;
|
|
@@ -38,7 +37,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
38
37
|
};
|
|
39
38
|
}[] | undefined;
|
|
40
39
|
};
|
|
41
|
-
})[];
|
|
40
|
+
})[] | null | undefined;
|
|
41
|
+
readonly role?: "model" | "user" | null | undefined;
|
|
42
42
|
}[];
|
|
43
43
|
readonly tools?: readonly {
|
|
44
44
|
readonly functionDeclarations: readonly {
|
|
@@ -128,7 +128,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
128
128
|
readonly presence_penalty?: number | undefined;
|
|
129
129
|
readonly safety_identifier?: string | undefined;
|
|
130
130
|
readonly top_logprobs?: number | undefined;
|
|
131
|
-
readonly service_tier?: "
|
|
131
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
132
132
|
readonly max_output_tokens?: number | undefined;
|
|
133
133
|
readonly max_tool_calls?: number | undefined;
|
|
134
134
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -118,51 +118,51 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
118
118
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
119
119
|
export declare const configure: (input: GenericModelOptions) => {
|
|
120
120
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
121
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
121
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
122
122
|
configure: (input: GenericModelOptions) => /*elided*/ any;
|
|
123
123
|
};
|
|
124
124
|
export declare const provider: {
|
|
125
125
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
126
126
|
configure: (input: GenericModelOptions) => {
|
|
127
127
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
128
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
128
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
129
129
|
configure: /*elided*/ any;
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
133
133
|
export declare const baseten: {
|
|
134
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
135
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
135
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
136
136
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
137
137
|
};
|
|
138
138
|
export declare const cerebras: {
|
|
139
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
140
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
140
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
141
141
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
142
142
|
};
|
|
143
143
|
export declare const deepinfra: {
|
|
144
144
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
145
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
145
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
146
146
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
147
147
|
};
|
|
148
148
|
export declare const deepseek: {
|
|
149
149
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
150
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
150
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
151
151
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
152
152
|
};
|
|
153
153
|
export declare const fireworks: {
|
|
154
154
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
155
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
155
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
156
156
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
157
157
|
};
|
|
158
158
|
export declare const groq: {
|
|
159
159
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
160
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
160
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
161
161
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
162
162
|
};
|
|
163
163
|
export declare const togetherai: {
|
|
164
164
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
165
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
165
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
166
166
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
167
167
|
};
|
|
168
168
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type ProviderOptions } from "../schema/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
3
|
+
import type { Options } from "../protocols/utils/open-responses-options.js";
|
|
3
4
|
export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
4
|
-
export type OpenAIOptionsInput =
|
|
5
|
+
export type OpenAIOptionsInput = Omit<Options, "serviceTier"> & {
|
|
6
|
+
readonly serviceTier?: OpenAIServiceTier;
|
|
7
|
+
readonly [key: string]: unknown;
|
|
8
|
+
};
|
|
5
9
|
export type OpenAIProviderOptionsInput = OpenAIOptionsInput;
|
|
6
10
|
export declare const gpt5DefaultOptions: (modelID: string, options?: {
|
|
7
11
|
readonly textVerbosity?: boolean;
|