@opencode-ai/ai
Advanced tools
| import { Effect, Schema } from "effect"; | ||
| import { Route } from "../route/client.js"; | ||
| import { Framing } from "../route/framing.js"; | ||
| import { Protocol } from "../route/protocol.js"; | ||
| import { HttpTransport } from "../route/transport/index.js"; | ||
| import { AIError, LLMEvent, Usage, type FinishReasonDetails, type LLMRequest } from "../schema/index.js"; | ||
| import { Lifecycle } from "./utils/lifecycle.js"; | ||
| import { ToolStream } from "./utils/tool-stream.js"; | ||
| export declare const DEFAULT_BASE_URL = "https://api.mistral.ai/v1"; | ||
| export declare const PATH = "/chat/completions"; | ||
| declare const MistralThinkingContent: Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.Literal<"thinking">; | ||
| readonly thinking: Schema.$Array<Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.optional<Schema.String>; | ||
| readonly text: Schema.optional<Schema.String>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>; | ||
| type MistralThinkingContent = Schema.Schema.Type<typeof MistralThinkingContent>; | ||
| export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | (string & {}); | ||
| export type ProviderOptionsInput = { | ||
| readonly safePrompt?: boolean; | ||
| readonly documentImageLimit?: number; | ||
| readonly documentPageLimit?: number; | ||
| readonly parallelToolCalls?: boolean; | ||
| readonly reasoningEffort?: ReasoningEffort; | ||
| readonly promptMode?: "reasoning"; | ||
| readonly promptCacheKey?: string; | ||
| readonly [key: string]: unknown; | ||
| }; | ||
| declare const MistralBody: Schema.Struct<{ | ||
| readonly model: Schema.String; | ||
| readonly messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{ | ||
| readonly role: Schema.Literal<"system">; | ||
| readonly content: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly role: Schema.Literal<"user">; | ||
| readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.Literal<"text">; | ||
| readonly text: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.Literal<"image_url">; | ||
| readonly image_url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.Literal<"document_url">; | ||
| readonly document_url: Schema.String; | ||
| }>]>>]>; | ||
| }>, Schema.Struct<{ | ||
| readonly role: Schema.Literal<"assistant">; | ||
| readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.Literal<"text">; | ||
| readonly text: Schema.String; | ||
| }>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.Literal<"thinking">; | ||
| readonly thinking: Schema.$Array<Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.optional<Schema.String>; | ||
| readonly text: Schema.optional<Schema.String>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>]>; | ||
| readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| readonly id: Schema.String; | ||
| readonly type: Schema.Literal<"function">; | ||
| readonly function: Schema.Struct<{ | ||
| readonly name: Schema.String; | ||
| readonly arguments: Schema.String; | ||
| }>; | ||
| }>>>; | ||
| readonly prefix: Schema.optional<Schema.Literal<true>>; | ||
| }>, Schema.Struct<{ | ||
| readonly role: Schema.Literal<"tool">; | ||
| readonly tool_call_id: Schema.String; | ||
| readonly name: Schema.String; | ||
| readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.Literal<"text">; | ||
| readonly text: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.Literal<"image_url">; | ||
| readonly image_url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.Literal<"document_url">; | ||
| readonly document_url: Schema.String; | ||
| }>]>>]>; | ||
| }>]>>; | ||
| readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| readonly type: Schema.Literal<"function">; | ||
| readonly function: Schema.Struct<{ | ||
| readonly name: Schema.String; | ||
| readonly description: Schema.String; | ||
| readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>; | ||
| readonly strict: Schema.Literal<false>; | ||
| }>; | ||
| }>>>; | ||
| readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "any"]>, Schema.Struct<{ | ||
| readonly type: Schema.Literal<"function">; | ||
| readonly function: Schema.Struct<{ | ||
| readonly name: Schema.String; | ||
| }>; | ||
| }>]>>; | ||
| readonly stream: Schema.Literal<true>; | ||
| readonly max_tokens: Schema.optional<Schema.Number>; | ||
| readonly random_seed: Schema.optional<Schema.Number>; | ||
| readonly temperature: Schema.optional<Schema.Number>; | ||
| readonly top_p: Schema.optional<Schema.Number>; | ||
| readonly frequency_penalty: Schema.optional<Schema.Number>; | ||
| readonly presence_penalty: Schema.optional<Schema.Number>; | ||
| readonly stop: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly prompt_cache_key: Schema.optional<Schema.String>; | ||
| readonly safe_prompt: Schema.optional<Schema.Boolean>; | ||
| readonly document_image_limit: Schema.optional<Schema.Number>; | ||
| readonly document_page_limit: Schema.optional<Schema.Number>; | ||
| readonly parallel_tool_calls: Schema.optional<Schema.Boolean>; | ||
| readonly reasoning_effort: Schema.optional<Schema.String>; | ||
| readonly prompt_mode: Schema.optional<Schema.Literal<"reasoning">>; | ||
| }>; | ||
| export type MistralBody = Schema.Schema.Type<typeof MistralBody>; | ||
| export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{ | ||
| model: string & import("effect/Brand").Brand<"AI.ModelID">; | ||
| messages: ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| tools: { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| tool_choice: "auto" | "none" | "any" | { | ||
| type: "function"; | ||
| function: { | ||
| name: string; | ||
| }; | ||
| } | undefined; | ||
| stream: true; | ||
| max_tokens: number | undefined; | ||
| random_seed: number | undefined; | ||
| temperature: number | undefined; | ||
| top_p: number | undefined; | ||
| frequency_penalty: number | undefined; | ||
| presence_penalty: number | undefined; | ||
| stop: readonly string[] | undefined; | ||
| prompt_cache_key: string | undefined; | ||
| safe_prompt: boolean | undefined; | ||
| document_image_limit: number | undefined; | ||
| document_page_limit: number | undefined; | ||
| parallel_tool_calls: boolean | undefined; | ||
| reasoning_effort: string | undefined; | ||
| prompt_mode: "reasoning" | undefined; | ||
| }, AIError, never>; | ||
| type ToolKey = string | number; | ||
| interface PendingTool { | ||
| readonly id: string; | ||
| readonly name?: string; | ||
| readonly input: string; | ||
| } | ||
| interface ActiveContent { | ||
| readonly type: "text" | "reasoning"; | ||
| readonly id: string; | ||
| readonly thinking?: MistralThinkingContent; | ||
| } | ||
| export interface ParserState { | ||
| readonly tools: ToolStream.State<ToolKey>; | ||
| readonly pendingTools: Partial<Record<ToolKey, PendingTool>>; | ||
| readonly toolIDs: ReadonlyMap<string, string>; | ||
| readonly usedToolIDs: ReadonlySet<string>; | ||
| readonly completedTools: ReadonlyArray<LLMEvent>; | ||
| readonly latestToolKey?: ToolKey; | ||
| readonly generatedTools: number; | ||
| readonly lifecycle: Lifecycle.State; | ||
| readonly active?: ActiveContent; | ||
| readonly nextContent: number; | ||
| readonly usage?: Usage; | ||
| readonly finishReason?: FinishReasonDetails; | ||
| } | ||
| export declare const protocol: Protocol<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly tool_choice?: "auto" | "none" | "any" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly random_seed?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly safe_prompt?: boolean | undefined; | ||
| readonly document_image_limit?: number | undefined; | ||
| readonly document_page_limit?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: string | undefined; | ||
| readonly prompt_mode?: "reasoning" | undefined; | ||
| }, string, "[DONE]" | { | ||
| readonly [x: string]: unknown; | ||
| readonly error?: { | ||
| readonly [x: string]: unknown; | ||
| readonly message: string; | ||
| readonly code?: string | number | null | undefined; | ||
| } | null | undefined; | ||
| readonly usage?: { | ||
| readonly [x: string]: unknown; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly num_cached_tokens?: number | null | undefined; | ||
| readonly prompt_token_details?: { | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| } | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| } | null | undefined; | ||
| } | null | undefined; | ||
| readonly choices?: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly delta?: { | ||
| readonly [x: string]: unknown; | ||
| readonly content?: string | readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type: string; | ||
| readonly text?: string | null | undefined; | ||
| readonly thinking?: unknown; | ||
| }[] | null | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly function?: { | ||
| readonly name?: string | null | undefined; | ||
| readonly arguments?: string | { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | null | undefined; | ||
| readonly id?: string | null | undefined; | ||
| readonly index?: number | null | undefined; | ||
| }[] | null | undefined; | ||
| } | null | undefined; | ||
| readonly finish_reason?: string | null | undefined; | ||
| }[] | null | undefined; | ||
| }, ParserState>; | ||
| export declare const framing: Framing.Definition<string>; | ||
| export declare const httpTransport: HttpTransport.HttpJsonTransport<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly tool_choice?: "auto" | "none" | "any" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly random_seed?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly safe_prompt?: boolean | undefined; | ||
| readonly document_image_limit?: number | undefined; | ||
| readonly document_page_limit?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: string | undefined; | ||
| readonly prompt_mode?: "reasoning" | undefined; | ||
| }, string>; | ||
| export declare const route: Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly tool_choice?: "auto" | "none" | "any" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly random_seed?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly safe_prompt?: boolean | undefined; | ||
| readonly document_image_limit?: number | undefined; | ||
| readonly document_page_limit?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: string | undefined; | ||
| readonly prompt_mode?: "reasoning" | undefined; | ||
| }, HttpTransport.HttpPrepared<string>>; | ||
| export * as MistralChat from "./mistral-chat.js"; |
| import { Effect, Schema } from "effect"; | ||
| import { Auth } from "../route/auth.js"; | ||
| import { Route } from "../route/client.js"; | ||
| import { Endpoint } from "../route/endpoint.js"; | ||
| import { Framing } from "../route/framing.js"; | ||
| import { Protocol } from "../route/protocol.js"; | ||
| import { HttpTransport } from "../route/transport/index.js"; | ||
| import { AIError, InvalidProviderOutputError, LLMEvent, Usage, } from "../schema/index.js"; | ||
| import { classifyProviderFailure } from "../provider-error.js"; | ||
| import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js"; | ||
| import { Lifecycle } from "./utils/lifecycle.js"; | ||
| import { ToolStream } from "./utils/tool-stream.js"; | ||
| const ADAPTER = "mistral-chat"; | ||
| const DONE = "[DONE]"; | ||
| const TOOL_ID = /^[A-Za-z0-9]{9}$/; | ||
| export const DEFAULT_BASE_URL = "https://api.mistral.ai/v1"; | ||
| export const PATH = "/chat/completions"; | ||
| const MistralTextContent = Schema.Struct({ | ||
| type: Schema.Literal("text"), | ||
| text: Schema.String, | ||
| }); | ||
| const MistralThinkingUnit = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.optional(Schema.String), | ||
| text: Schema.optional(Schema.String), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralThinkingContent = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.Literal("thinking"), | ||
| thinking: Schema.Array(MistralThinkingUnit), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const isMistralThinkingContent = Schema.is(MistralThinkingContent); | ||
| const MistralUserContent = Schema.Union([ | ||
| MistralTextContent, | ||
| Schema.Struct({ type: Schema.Literal("image_url"), image_url: Schema.String }), | ||
| Schema.Struct({ type: Schema.Literal("document_url"), document_url: Schema.String }), | ||
| ]); | ||
| const MistralAssistantToolCall = Schema.Struct({ | ||
| id: Schema.String, | ||
| type: Schema.Literal("function"), | ||
| function: Schema.Struct({ name: Schema.String, arguments: Schema.String }), | ||
| }); | ||
| const MistralMessage = Schema.Union([ | ||
| Schema.Struct({ role: Schema.Literal("system"), content: Schema.String }), | ||
| Schema.Struct({ | ||
| role: Schema.Literal("user"), | ||
| content: Schema.Union([Schema.String, Schema.Array(MistralUserContent)]), | ||
| }), | ||
| Schema.Struct({ | ||
| role: Schema.Literal("assistant"), | ||
| content: Schema.Union([Schema.String, Schema.Array(Schema.Union([MistralTextContent, MistralThinkingContent]))]), | ||
| tool_calls: optionalArray(MistralAssistantToolCall), | ||
| prefix: Schema.optional(Schema.Literal(true)), | ||
| }), | ||
| Schema.Struct({ | ||
| role: Schema.Literal("tool"), | ||
| tool_call_id: Schema.String, | ||
| name: Schema.String, | ||
| content: Schema.Union([Schema.String, Schema.Array(MistralUserContent)]), | ||
| }), | ||
| ]).pipe(Schema.toTaggedUnion("role")); | ||
| const MistralTool = Schema.Struct({ | ||
| type: Schema.Literal("function"), | ||
| function: Schema.Struct({ | ||
| name: Schema.String, | ||
| description: Schema.String, | ||
| parameters: JsonObject, | ||
| strict: Schema.Literal(false), | ||
| }), | ||
| }); | ||
| const MistralOptions = Schema.Struct({ | ||
| safePrompt: Schema.optional(Schema.Boolean), | ||
| documentImageLimit: Schema.optional(Schema.Number), | ||
| documentPageLimit: Schema.optional(Schema.Number), | ||
| parallelToolCalls: Schema.optional(Schema.Boolean), | ||
| reasoningEffort: Schema.optional(Schema.String), | ||
| promptMode: Schema.optional(Schema.Literal("reasoning")), | ||
| promptCacheKey: Schema.optional(Schema.String), | ||
| }); | ||
| const MistralBody = Schema.Struct({ | ||
| model: Schema.String, | ||
| messages: Schema.Array(MistralMessage), | ||
| tools: optionalArray(MistralTool), | ||
| tool_choice: Schema.optional(Schema.Union([ | ||
| Schema.Literals(["auto", "none", "any"]), | ||
| Schema.Struct({ type: Schema.Literal("function"), function: Schema.Struct({ name: Schema.String }) }), | ||
| ])), | ||
| stream: Schema.Literal(true), | ||
| max_tokens: Schema.optional(Schema.Number), | ||
| random_seed: Schema.optional(Schema.Number), | ||
| temperature: Schema.optional(Schema.Number), | ||
| top_p: Schema.optional(Schema.Number), | ||
| frequency_penalty: Schema.optional(Schema.Number), | ||
| presence_penalty: Schema.optional(Schema.Number), | ||
| stop: optionalArray(Schema.String), | ||
| prompt_cache_key: Schema.optional(Schema.String), | ||
| safe_prompt: Schema.optional(Schema.Boolean), | ||
| document_image_limit: Schema.optional(Schema.Number), | ||
| document_page_limit: Schema.optional(Schema.Number), | ||
| parallel_tool_calls: Schema.optional(Schema.Boolean), | ||
| reasoning_effort: Schema.optional(Schema.String), | ||
| prompt_mode: Schema.optional(Schema.Literal("reasoning")), | ||
| }); | ||
| const MistralUsageDetails = Schema.StructWithRest(Schema.Struct({ cached_tokens: optionalNull(Schema.Number) }), [ | ||
| Schema.Record(Schema.String, Schema.Unknown), | ||
| ]); | ||
| const MistralUsage = Schema.StructWithRest(Schema.Struct({ | ||
| prompt_tokens: optionalNull(Schema.Number), | ||
| completion_tokens: optionalNull(Schema.Number), | ||
| total_tokens: optionalNull(Schema.Number), | ||
| num_cached_tokens: optionalNull(Schema.Number), | ||
| prompt_token_details: optionalNull(MistralUsageDetails), | ||
| prompt_tokens_details: optionalNull(MistralUsageDetails), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralOutputContent = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.String, | ||
| text: optionalNull(Schema.String), | ||
| thinking: optionalNull(Schema.Unknown), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralToolDelta = Schema.Struct({ | ||
| index: optionalNull(Schema.Number), | ||
| id: optionalNull(Schema.String), | ||
| function: optionalNull(Schema.Struct({ | ||
| name: optionalNull(Schema.String), | ||
| arguments: optionalNull(Schema.Union([Schema.String, JsonObject])), | ||
| })), | ||
| }); | ||
| const MistralChoice = Schema.StructWithRest(Schema.Struct({ | ||
| delta: optionalNull(Schema.StructWithRest(Schema.Struct({ | ||
| content: optionalNull(Schema.Union([Schema.String, Schema.Array(MistralOutputContent)])), | ||
| tool_calls: optionalNull(Schema.Array(MistralToolDelta)), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)])), | ||
| finish_reason: optionalNull(Schema.String), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralError = Schema.StructWithRest(Schema.Struct({ | ||
| message: Schema.String, | ||
| code: optionalNull(Schema.Union([Schema.String, Schema.Number])), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralEvent = Schema.StructWithRest(Schema.Struct({ | ||
| choices: optionalNull(Schema.Array(MistralChoice)), | ||
| usage: optionalNull(MistralUsage), | ||
| error: optionalNull(MistralError), | ||
| }), [Schema.Record(Schema.String, Schema.Unknown)]); | ||
| const MistralStreamEvent = Schema.Union([Schema.Literal(DONE), Protocol.jsonEvent(MistralEvent)]); | ||
| const hashID = (value) => { | ||
| const hash = (seed) => { | ||
| let result = seed; | ||
| for (const char of value) | ||
| result = Math.imul(result ^ char.charCodeAt(0), 16777619); | ||
| return (result >>> 0).toString(36); | ||
| }; | ||
| return `${hash(2166136261).padStart(7, "0")}${hash(2246822519).padStart(7, "0")}`.slice(-9); | ||
| }; | ||
| const toolIDNormalizer = (request) => { | ||
| const ids = request.messages.flatMap((message) => message.content.flatMap((part) => (part.type === "tool-call" || part.type === "tool-result" ? [part.id] : []))); | ||
| const used = new Set(ids.filter((id) => TOOL_ID.test(id))); | ||
| const normalized = new Map(); | ||
| return (id) => { | ||
| if (TOOL_ID.test(id)) | ||
| return id; | ||
| const previous = normalized.get(id); | ||
| if (previous) | ||
| return previous; | ||
| let attempt = 0; | ||
| let candidate = hashID(id); | ||
| while (used.has(candidate)) | ||
| candidate = hashID(`${id}:${++attempt}`); | ||
| used.add(candidate); | ||
| normalized.set(id, candidate); | ||
| return candidate; | ||
| }; | ||
| }; | ||
| const lowerMedia = Effect.fn("MistralChat.lowerMedia")(function* (part) { | ||
| const media = ProviderShared.normalizeMedia(part); | ||
| const url = typeof part.data === "string" && /^(?:https?:|data:)/.test(part.data) ? part.data : media.dataUrl; | ||
| if (media.mime.startsWith("image/")) | ||
| return { type: "image_url", image_url: url }; | ||
| if (media.mime === "application/pdf") | ||
| return { type: "document_url", document_url: url }; | ||
| return yield* ProviderShared.invalidRequest(`Mistral Chat does not support media type ${part.mediaType}`); | ||
| }); | ||
| const lowerUser = Effect.fn("MistralChat.lowerUser")(function* (message) { | ||
| const content = []; | ||
| for (const part of message.content) { | ||
| if (part.type === "text") { | ||
| content.push({ type: "text", text: part.text }); | ||
| continue; | ||
| } | ||
| if (part.type === "media") { | ||
| content.push(yield* lowerMedia(part)); | ||
| continue; | ||
| } | ||
| return yield* ProviderShared.unsupportedContent("Mistral Chat", "user", ["text", "media"]); | ||
| } | ||
| if (content.every((part) => part.type === "text")) | ||
| return { role: "user", content: content.map((part) => part.text).join("") }; | ||
| return { role: "user", content }; | ||
| }); | ||
| const lowerToolCall = (part, normalizeID) => ({ | ||
| id: normalizeID(part.id), | ||
| type: "function", | ||
| function: { name: part.name, arguments: ProviderShared.encodeJson(part.input) }, | ||
| }); | ||
| const lowerAssistant = Effect.fn("MistralChat.lowerAssistant")(function* (message, normalizeID, prefix) { | ||
| const structured = message.content.some((part) => part.type === "reasoning" && isMistralThinkingContent(part.providerMetadata?.mistral?.thinking)); | ||
| const content = []; | ||
| const text = []; | ||
| const toolCalls = []; | ||
| for (const part of message.content) { | ||
| if (part.type === "text") { | ||
| if (structured) | ||
| content.push({ type: "text", text: part.text }); | ||
| else | ||
| text.push(part.text); | ||
| continue; | ||
| } | ||
| if (part.type === "reasoning") { | ||
| const native = part.providerMetadata?.mistral?.thinking; | ||
| if (structured && isMistralThinkingContent(native)) | ||
| content.push(native); | ||
| else if (structured) | ||
| content.push({ type: "text", text: part.text }); | ||
| else | ||
| text.push(part.text); | ||
| continue; | ||
| } | ||
| if (part.type === "tool-call") { | ||
| toolCalls.push(lowerToolCall(part, normalizeID)); | ||
| continue; | ||
| } | ||
| return yield* ProviderShared.unsupportedContent("Mistral Chat", "assistant", ["text", "reasoning", "tool-call"]); | ||
| } | ||
| return { | ||
| role: "assistant", | ||
| content: structured ? content : text.join(""), | ||
| ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}), | ||
| ...(prefix ? { prefix: true } : {}), | ||
| }; | ||
| }); | ||
| const lowerToolResults = Effect.fn("MistralChat.lowerToolResults")(function* (message, normalizeID) { | ||
| const output = []; | ||
| for (const part of message.content) { | ||
| if (part.type !== "tool-result") | ||
| return yield* ProviderShared.unsupportedContent("Mistral Chat", "tool", ["tool-result"]); | ||
| if (part.result.type !== "content") { | ||
| output.push({ | ||
| role: "tool", | ||
| tool_call_id: normalizeID(part.id), | ||
| name: part.name, | ||
| content: ProviderShared.toolResultText(part), | ||
| }); | ||
| continue; | ||
| } | ||
| const content = []; | ||
| for (const item of part.result.value) { | ||
| if (item.type === "text") { | ||
| content.push({ type: "text", text: item.text }); | ||
| continue; | ||
| } | ||
| content.push(yield* lowerMedia({ type: "media", mediaType: item.mime, data: item.uri, filename: item.name })); | ||
| } | ||
| output.push({ | ||
| role: "tool", | ||
| tool_call_id: normalizeID(part.id), | ||
| name: part.name, | ||
| content: content.some((item) => item.type !== "text") | ||
| ? content | ||
| : content.map((item) => (item.type === "text" ? item.text : "")).join(""), | ||
| }); | ||
| } | ||
| return output; | ||
| }); | ||
| const lowerMessages = Effect.fn("MistralChat.lowerMessages")(function* (request) { | ||
| const normalizeID = toolIDNormalizer(request); | ||
| const messages = request.system.length === 0 ? [] : [{ role: "system", content: ProviderShared.joinText(request.system) }]; | ||
| for (const message of request.messages) { | ||
| if (message.role === "system") { | ||
| const update = yield* ProviderShared.wrappedSystemUpdate("Mistral Chat", message); | ||
| messages.push({ | ||
| role: "user", | ||
| content: update.text, | ||
| }); | ||
| continue; | ||
| } | ||
| if (message.role === "user") { | ||
| messages.push(yield* lowerUser(message)); | ||
| continue; | ||
| } | ||
| if (message.role === "assistant") { | ||
| const hasToolCalls = message.content.some((part) => part.type === "tool-call"); | ||
| const hasNativeThinking = message.content.some((part) => part.type === "reasoning" && isMistralThinkingContent(part.providerMetadata?.mistral?.thinking)); | ||
| const text = message.content | ||
| .flatMap((part) => (part.type === "text" || part.type === "reasoning" ? [part.text] : [])) | ||
| .join(""); | ||
| if (!hasToolCalls && !hasNativeThinking && text.trim() === "") | ||
| continue; | ||
| messages.push(yield* lowerAssistant(message, normalizeID, !hasToolCalls && message === request.messages.at(-1))); | ||
| continue; | ||
| } | ||
| messages.push(...(yield* lowerToolResults(message, normalizeID))); | ||
| } | ||
| return messages; | ||
| }); | ||
| const lowerTool = (tool) => ({ | ||
| type: "function", | ||
| function: { name: tool.name, description: tool.description, parameters: tool.inputSchema, strict: false }, | ||
| }); | ||
| export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (request) { | ||
| const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MistralOptions))(request.providerOptions ?? {}); | ||
| const selected = request.toolChoice?.type === "tool" ? request.toolChoice.name : undefined; | ||
| if (request.toolChoice?.type === "tool" && !selected) | ||
| return yield* ProviderShared.invalidRequest("Mistral Chat tool choice requires a tool name"); | ||
| if (options.reasoningEffort !== undefined && options.promptMode !== undefined) | ||
| return yield* ProviderShared.invalidRequest("Mistral Chat reasoningEffort and promptMode provider options are mutually exclusive"); | ||
| const toolChoice = request.toolChoice | ||
| ? yield* ProviderShared.matchToolChoice("Mistral Chat", request.toolChoice, { | ||
| auto: () => "auto", | ||
| none: () => "none", | ||
| required: () => "any", | ||
| tool: (name) => ({ type: "function", function: { name } }), | ||
| }) | ||
| : undefined; | ||
| return { | ||
| model: request.model.id, | ||
| messages: yield* lowerMessages(request), | ||
| tools: request.tools.length > 0 ? request.tools.map(lowerTool) : undefined, | ||
| tool_choice: toolChoice, | ||
| stream: true, | ||
| max_tokens: request.generation?.maxTokens, | ||
| random_seed: request.generation?.seed, | ||
| temperature: request.generation?.temperature, | ||
| top_p: request.generation?.topP, | ||
| frequency_penalty: request.generation?.frequencyPenalty, | ||
| presence_penalty: request.generation?.presencePenalty, | ||
| stop: request.generation?.stop, | ||
| prompt_cache_key: request.cache === "none" ? undefined : (options.promptCacheKey ?? request.promptCacheKey), | ||
| safe_prompt: options.safePrompt, | ||
| document_image_limit: options.documentImageLimit, | ||
| document_page_limit: options.documentPageLimit, | ||
| parallel_tool_calls: options.parallelToolCalls ?? (request.toolChoice?.disableParallelToolUse === true ? false : undefined), | ||
| reasoning_effort: options.reasoningEffort, | ||
| prompt_mode: options.promptMode, | ||
| }; | ||
| }); | ||
| const mapUsage = (usage) => { | ||
| if (!usage) | ||
| return undefined; | ||
| const input = usage.prompt_tokens ?? undefined; | ||
| const reported = usage.num_cached_tokens ?? | ||
| usage.prompt_tokens_details?.cached_tokens ?? | ||
| usage.prompt_token_details?.cached_tokens ?? | ||
| undefined; | ||
| const cached = input === undefined || reported === undefined ? undefined : Math.max(0, Math.min(input, reported)); | ||
| const output = usage.completion_tokens ?? undefined; | ||
| return new Usage({ | ||
| inputTokens: input, | ||
| outputTokens: output, | ||
| nonCachedInputTokens: ProviderShared.subtractTokens(input, cached), | ||
| cacheReadInputTokens: cached, | ||
| totalTokens: ProviderShared.totalTokens(input, output, usage.total_tokens ?? undefined), | ||
| providerMetadata: { mistral: usage }, | ||
| }); | ||
| }; | ||
| const mapFinishReason = (reason) => { | ||
| switch (reason) { | ||
| case "stop": | ||
| return "stop"; | ||
| case "length": | ||
| case "model_length": | ||
| return "length"; | ||
| case "tool_calls": | ||
| return "tool-calls"; | ||
| case "content_filter": | ||
| return "content-filter"; | ||
| case "error": | ||
| case "network_error": | ||
| return "error"; | ||
| default: | ||
| return "unknown"; | ||
| } | ||
| }; | ||
| const thinkingUnits = (value) => { | ||
| if (typeof value === "string") | ||
| return [{ type: "text", text: value }]; | ||
| if (!Array.isArray(value)) | ||
| return []; | ||
| return value.filter(Schema.is(MistralThinkingUnit)); | ||
| }; | ||
| const thinkingText = (thinking) => thinking.flatMap((unit) => (typeof unit.text === "string" ? [unit.text] : [])).join(""); | ||
| const thinkingMetadata = (thinking) => ({ mistral: { thinking } }); | ||
| const closeActive = (state, events) => { | ||
| if (!state.active) | ||
| return state; | ||
| const lifecycle = state.active.type === "text" | ||
| ? Lifecycle.textEnd(state.lifecycle, events, state.active.id) | ||
| : Lifecycle.reasoningEnd(state.lifecycle, events, state.active.id, thinkingMetadata(state.active.thinking ?? { type: "thinking", thinking: [] }), thinkingText(state.active.thinking?.thinking ?? [])); | ||
| return { ...state, lifecycle, active: undefined }; | ||
| }; | ||
| const appendText = (state, events, text) => { | ||
| if (text.length === 0) | ||
| return state; | ||
| const current = state.active?.type === "text" ? state : closeActive(state, events); | ||
| const active = current.active ?? { type: "text", id: `text-${current.nextContent}` }; | ||
| return { | ||
| ...current, | ||
| lifecycle: Lifecycle.textDelta(current.lifecycle, events, active.id, text), | ||
| active, | ||
| nextContent: current.active ? current.nextContent : current.nextContent + 1, | ||
| }; | ||
| }; | ||
| const appendThinking = (state, events, part) => { | ||
| const current = state.active?.type === "reasoning" ? state : closeActive(state, events); | ||
| const units = thinkingUnits(part.thinking); | ||
| const active = current.active ?? { type: "reasoning", id: `reasoning-${current.nextContent}` }; | ||
| const thinking = { | ||
| ...active.thinking, | ||
| ...part, | ||
| type: "thinking", | ||
| thinking: [...(active.thinking?.thinking ?? []), ...units], | ||
| }; | ||
| const text = thinkingText(units); | ||
| return { | ||
| ...current, | ||
| lifecycle: text.length > 0 | ||
| ? Lifecycle.reasoningDelta(current.lifecycle, events, active.id, text, thinkingMetadata(thinking)) | ||
| : Lifecycle.reasoningStart(current.lifecycle, events, active.id, thinkingMetadata(thinking)), | ||
| active: { ...active, thinking }, | ||
| nextContent: current.active ? current.nextContent : current.nextContent + 1, | ||
| }; | ||
| }; | ||
| const appendContent = (state, events, content) => { | ||
| if (typeof content === "string") | ||
| return appendText(state, events, content); | ||
| return content.reduce((current, part) => { | ||
| if (part.type === "text") | ||
| return appendText(current, events, part.text ?? ""); | ||
| if (part.type === "thinking") | ||
| return appendThinking(current, events, part); | ||
| return closeActive(current, events); | ||
| }, state); | ||
| }; | ||
| const normalizeStreamToolID = (state, source) => { | ||
| if (TOOL_ID.test(source)) | ||
| return { id: source, state: { ...state, usedToolIDs: new Set([...state.usedToolIDs, source]) } }; | ||
| const previous = state.toolIDs.get(source); | ||
| if (previous) | ||
| return { id: previous, state }; | ||
| let attempt = 0; | ||
| let id = hashID(source); | ||
| while (state.usedToolIDs.has(id)) | ||
| id = hashID(`${source}:${++attempt}`); | ||
| return { | ||
| id, | ||
| state: { | ||
| ...state, | ||
| toolIDs: new Map([...state.toolIDs, [source, id]]), | ||
| usedToolIDs: new Set([...state.usedToolIDs, id]), | ||
| }, | ||
| }; | ||
| }; | ||
| const toolText = (tool) => { | ||
| const value = tool.function?.arguments; | ||
| if (typeof value === "string") | ||
| return value; | ||
| return value === null || value === undefined ? "" : ProviderShared.encodeJson(value); | ||
| }; | ||
| const appendTools = Effect.fn("MistralChat.appendTools")(function* (initial, events, deltas) { | ||
| if (deltas.length === 0) | ||
| return initial; | ||
| let state = closeActive(initial, events); | ||
| for (const [position, delta] of deltas.entries()) { | ||
| const wireID = delta.id?.trim() || undefined; | ||
| const providedID = wireID === "null" ? undefined : wireID; | ||
| const key = delta.index ?? | ||
| (providedID | ||
| ? `id:${providedID}` | ||
| : deltas.length > 1 | ||
| ? `position:${position}` | ||
| : (state.latestToolKey ?? `missing:${state.generatedTools}`)); | ||
| const existing = state.tools[key]; | ||
| const pending = state.pendingTools[key]; | ||
| const source = providedID ?? `generated:${String(key)}`; | ||
| const normalized = existing || pending ? { id: existing?.id ?? pending?.id ?? "", state } : normalizeStreamToolID(state, source); | ||
| state = normalized.state; | ||
| const name = existing?.name ?? pending?.name ?? (delta.function?.name?.trim() || undefined); | ||
| const text = `${pending?.input ?? ""}${toolText(delta)}`; | ||
| if (!name) { | ||
| state = { | ||
| ...state, | ||
| pendingTools: { ...state.pendingTools, [key]: { id: normalized.id, input: text } }, | ||
| latestToolKey: key, | ||
| generatedTools: state.generatedTools + (!providedID && !pending ? 1 : 0), | ||
| }; | ||
| continue; | ||
| } | ||
| const result = ToolStream.appendOrStart(ADAPTER, state.tools, key, { id: normalized.id, name, text }, "Mistral Chat tool call delta is missing a name"); | ||
| if (ToolStream.isError(result)) | ||
| return yield* result; | ||
| if (result.events.length > 0) | ||
| state = { ...state, lifecycle: Lifecycle.stepStart(state.lifecycle, events) }; | ||
| events.push(...result.events); | ||
| const pendingTools = { ...state.pendingTools }; | ||
| delete pendingTools[key]; | ||
| state = { | ||
| ...state, | ||
| tools: result.tools, | ||
| pendingTools, | ||
| latestToolKey: key, | ||
| generatedTools: state.generatedTools + (!providedID && !existing && !pending ? 1 : 0), | ||
| }; | ||
| } | ||
| return state; | ||
| }); | ||
| const hasLateContent = (event) => { | ||
| const delta = event.choices?.[0]?.delta; | ||
| if (typeof delta?.content === "string" && delta.content.length > 0) | ||
| return true; | ||
| if (Array.isArray(delta?.content) && delta.content.length > 0) | ||
| return true; | ||
| return (delta?.tool_calls ?? []).some((tool) => Boolean(tool.id) || Boolean(tool.function?.name) || tool.function?.arguments !== undefined); | ||
| }; | ||
| const step = Effect.fn("MistralChat.step")(function* (state, event) { | ||
| if (event.error) { | ||
| const body = ProviderShared.encodeJson(event); | ||
| return yield* new AIError({ | ||
| reason: classifyProviderFailure({ | ||
| message: event.error.message, | ||
| status: typeof event.error.code === "number" ? event.error.code : undefined, | ||
| rawBody: body, | ||
| }), | ||
| }); | ||
| } | ||
| const events = []; | ||
| const usage = mapUsage(event.usage) ?? state.usage; | ||
| if (state.finishReason) { | ||
| if (hasLateContent(event)) | ||
| return yield* ProviderShared.eventError(ADAPTER, "Mistral Chat received content after the finish reason", ProviderShared.encodeJson(event)); | ||
| return [{ ...state, usage }, events]; | ||
| } | ||
| const choice = event.choices?.[0]; | ||
| const withContent = choice?.delta?.content == null ? state : appendContent(state, events, choice.delta.content); | ||
| const withTools = yield* appendTools(withContent, events, choice?.delta?.tool_calls ?? []); | ||
| if (!choice?.finish_reason) | ||
| return [{ ...withTools, usage }, events]; | ||
| const finishReason = { | ||
| normalized: mapFinishReason(choice.finish_reason), | ||
| raw: choice.finish_reason, | ||
| }; | ||
| const incomplete = finishReason.normalized === "length" || finishReason.normalized === "content-filter"; | ||
| if (!incomplete && Object.keys(withTools.pendingTools).length > 0) | ||
| return yield* ProviderShared.eventError(ADAPTER, "Mistral Chat tool call delta is missing a name", ProviderShared.encodeJson(event)); | ||
| const finished = !incomplete && Object.keys(withTools.tools).length > 0 | ||
| ? yield* ToolStream.finishAll(ADAPTER, withTools.tools) | ||
| : undefined; | ||
| return [ | ||
| { | ||
| ...withTools, | ||
| tools: finished?.tools ?? withTools.tools, | ||
| completedTools: finished?.events ?? withTools.completedTools, | ||
| usage, | ||
| finishReason, | ||
| }, | ||
| events, | ||
| ]; | ||
| }); | ||
| const finishEvents = Effect.fn("MistralChat.finishEvents")(function* (state) { | ||
| if (!state.finishReason) | ||
| return yield* new AIError({ | ||
| reason: new InvalidProviderOutputError({ | ||
| message: "Mistral Chat stream ended without finish_reason", | ||
| classification: "incomplete-stream", | ||
| route: ADAPTER, | ||
| }), | ||
| }); | ||
| const events = []; | ||
| const closed = closeActive(state, events); | ||
| const lifecycle = closed.completedTools.length > 0 ? Lifecycle.stepStart(closed.lifecycle, events) : closed.lifecycle; | ||
| events.push(...closed.completedTools); | ||
| const reason = state.finishReason.normalized === "stop" && closed.completedTools.some(LLMEvent.is.toolCall) | ||
| ? { ...state.finishReason, normalized: "tool-calls" } | ||
| : state.finishReason; | ||
| Lifecycle.finish(lifecycle, events, { reason, usage: closed.usage }); | ||
| return events; | ||
| }); | ||
| export const protocol = Protocol.make({ | ||
| id: ADAPTER, | ||
| body: { schema: MistralBody, from: fromRequest }, | ||
| stream: { | ||
| event: MistralStreamEvent, | ||
| initial: () => ({ | ||
| tools: ToolStream.empty(), | ||
| pendingTools: {}, | ||
| toolIDs: new Map(), | ||
| usedToolIDs: new Set(), | ||
| completedTools: [], | ||
| generatedTools: 0, | ||
| lifecycle: Lifecycle.initial(), | ||
| nextContent: 0, | ||
| }), | ||
| step: (state, event) => (event === DONE ? Effect.succeed([state, []]) : step(state, event)), | ||
| terminal: (event) => event === DONE, | ||
| onHalt: finishEvents, | ||
| }, | ||
| }); | ||
| export const framing = Framing.sseWithDone; | ||
| export const httpTransport = HttpTransport.sseJson.with().with({ framing }); | ||
| export const route = Route.make({ | ||
| id: ADAPTER, | ||
| provider: "mistral", | ||
| providerMetadataKey: "mistral", | ||
| protocol, | ||
| endpoint: Endpoint.path(PATH, { baseURL: DEFAULT_BASE_URL }), | ||
| auth: Auth.none, | ||
| transport: httpTransport, | ||
| }); | ||
| export * as MistralChat from "./mistral-chat.js"; |
| import type { ProviderPackage } from "../provider-package.js"; | ||
| import { MistralChat } from "../protocols/mistral-chat.js"; | ||
| import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| import type { RouteDefaultsInput } from "../route/client.js"; | ||
| import { type ModelID } from "../schema/index.js"; | ||
| export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| export type ProviderOptions = MistralChat.ProviderOptionsInput; | ||
| export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: ProviderOptions; | ||
| }; | ||
| export interface Settings extends ProviderPackage.Settings { | ||
| readonly apiKey?: string; | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: ProviderOptions; | ||
| } | ||
| export declare const route: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly tool_choice?: "auto" | "none" | "any" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly random_seed?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly safe_prompt?: boolean | undefined; | ||
| readonly document_image_limit?: number | undefined; | ||
| readonly document_page_limit?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: string | undefined; | ||
| readonly prompt_mode?: "reasoning" | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
| export declare const routes: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| } | { | ||
| readonly content: string | readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly type: "thinking"; | ||
| readonly thinking: readonly { | ||
| readonly [x: string]: unknown; | ||
| readonly type?: string | undefined; | ||
| readonly text?: string | undefined; | ||
| }[]; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| })[]; | ||
| readonly role: "assistant"; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly prefix?: true | undefined; | ||
| } | { | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly name: string; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: string; | ||
| } | { | ||
| readonly type: "document_url"; | ||
| readonly document_url: string; | ||
| })[]; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly description: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict: false; | ||
| }; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly tool_choice?: "auto" | "none" | "any" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly random_seed?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly safe_prompt?: boolean | undefined; | ||
| readonly document_image_limit?: number | undefined; | ||
| readonly document_page_limit?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: string | undefined; | ||
| readonly prompt_mode?: "reasoning" | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
| export declare const configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => /*elided*/ any; | ||
| }; | ||
| export declare const provider: { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput>; | ||
| configure: /*elided*/ any; | ||
| }; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, ProviderOptions>["model"]; | ||
| export * as Mistral from "./mistral.js"; |
| import { MistralChat } from "../protocols/mistral-chat.js"; | ||
| import { AuthOptions } from "../route/auth-options.js"; | ||
| import { ProviderID } from "../schema/index.js"; | ||
| export const id = ProviderID.make("mistral"); | ||
| export const route = MistralChat.route; | ||
| export const routes = [route]; | ||
| export const configure = (input = {}) => { | ||
| const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input; | ||
| const configured = route.with({ | ||
| ...defaults, | ||
| endpoint: { baseURL: baseURL ?? MistralChat.DEFAULT_BASE_URL }, | ||
| auth: AuthOptions.bearer(input, "MISTRAL_API_KEY"), | ||
| }); | ||
| return { | ||
| id, | ||
| model: (modelID) => configured.model({ id: modelID }), | ||
| configure, | ||
| }; | ||
| }; | ||
| export const provider = configure(); | ||
| export const model = (modelID, settings) => configure({ | ||
| apiKey: settings.apiKey, | ||
| baseURL: settings.baseURL, | ||
| headers: settings.headers === undefined ? undefined : { ...settings.headers }, | ||
| http: settings.body === undefined ? undefined : { body: { ...settings.body } }, | ||
| providerOptions: settings.providerOptions, | ||
| }).model(modelID); | ||
| export * as Mistral from "./mistral.js"; |
| export * as AnthropicMessages from "./anthropic-messages.js"; | ||
| export * as BedrockConverse from "./bedrock-converse.js"; | ||
| export * as Gemini from "./gemini.js"; | ||
| export * as MistralChat from "./mistral-chat.js"; | ||
| export * as OpenAIChat from "./openai-chat.js"; | ||
@@ -5,0 +6,0 @@ export * as OpenAIImages from "./openai-images.js"; |
| export * as AnthropicMessages from "./anthropic-messages.js"; | ||
| export * as BedrockConverse from "./bedrock-converse.js"; | ||
| export * as Gemini from "./gemini.js"; | ||
| export * as MistralChat from "./mistral-chat.js"; | ||
| export * as OpenAIChat from "./openai-chat.js"; | ||
@@ -5,0 +6,0 @@ export * as OpenAIImages from "./openai-images.js"; |
@@ -790,2 +790,6 @@ import { Effect, Schema } from "effect"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -797,5 +801,2 @@ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -805,3 +806,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, AIError, never>; | ||
@@ -1141,2 +1141,6 @@ export declare const providerMetadata: (state: ParserState, metadata: Record<string, unknown>) => ProviderMetadata; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -1148,5 +1152,2 @@ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -1156,3 +1157,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, string, { | ||
@@ -1360,2 +1360,6 @@ readonly [x: string]: unknown; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -1367,5 +1371,2 @@ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -1375,4 +1376,3 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, string>; | ||
| export * as OpenResponses from "./open-responses.js"; |
@@ -582,2 +582,6 @@ import { Effect, Schema } from "effect"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -587,7 +591,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, string, "[DONE]" | { | ||
@@ -602,7 +602,6 @@ readonly [x: string]: unknown; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -613,2 +612,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -642,7 +642,6 @@ readonly [x: string]: unknown; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -653,2 +652,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -755,2 +755,6 @@ readonly [x: string]: unknown; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -760,7 +764,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, string>; | ||
@@ -856,2 +856,6 @@ export declare const route: Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -861,8 +865,4 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, HttpTransport.HttpPrepared<string>>; | ||
| export * as OpenAIChat from "./openai-chat.js"; |
@@ -99,2 +99,6 @@ import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -104,8 +108,4 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
| export * as OpenAICompatibleChat from "./openai-compatible-chat.js"; |
@@ -144,2 +144,6 @@ import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -151,5 +155,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -159,4 +160,3 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
| export * as OpenAICompatibleResponses from "./openai-compatible-responses.js"; |
@@ -353,2 +353,6 @@ import { Schema } from "effect"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -360,5 +364,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -368,3 +369,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, string, { | ||
@@ -612,2 +612,6 @@ readonly [x: string]: unknown; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -619,5 +623,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -627,3 +628,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, string>; | ||
@@ -806,2 +806,6 @@ export declare const channelTransport: (options: import("./open-responses-channel.js").Options) => import("../route/transport/index.js").Transport<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -813,5 +817,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -821,3 +822,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("./open-responses-channel.js").Prepared, string>; | ||
@@ -1000,2 +1000,6 @@ export declare const transport: import("../route/transport/index.js").Transport<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -1007,5 +1011,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -1015,3 +1016,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("./open-responses-channel.js").Prepared, string>; | ||
@@ -1194,2 +1194,6 @@ export declare const route: Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -1201,5 +1205,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -1209,4 +1210,3 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("./open-responses-channel.js").Prepared>; | ||
| export * as OpenAIResponses from "./openai-responses.js"; |
@@ -154,2 +154,6 @@ import { Protocol } from "../route/protocol.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -161,5 +165,2 @@ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -169,3 +170,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, string, { | ||
@@ -172,0 +172,0 @@ readonly [x: string]: unknown; |
@@ -112,2 +112,6 @@ import { Route, type RouteDefaultsInput } from "../route/client.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -117,7 +121,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>> | Route<{ | ||
@@ -299,2 +299,6 @@ readonly input: readonly ({ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -306,5 +310,2 @@ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -314,3 +315,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>)[]; | ||
@@ -317,0 +317,0 @@ export declare const configure: (input?: Config) => { |
@@ -114,2 +114,6 @@ import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -119,7 +123,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{ | ||
@@ -301,2 +301,6 @@ readonly input: readonly ({ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -308,5 +312,2 @@ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -316,3 +317,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../protocols/open-responses-channel.js").Prepared>)[]; | ||
@@ -319,0 +319,0 @@ export declare const configure: (input: Config) => { |
@@ -105,2 +105,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -110,7 +114,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -206,2 +206,6 @@ export declare const routes: import("../route/client.js").Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -211,7 +215,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -218,0 +218,0 @@ export declare const configure: (input?: LanguageModelOptions) => { |
@@ -120,2 +120,6 @@ import type { Config, Redacted } from "effect"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -125,7 +129,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -221,2 +221,6 @@ export declare const workersAIRoute: import("../route/client.js").Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -226,7 +230,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -322,2 +322,6 @@ export declare const routes: import("../route/client.js").Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -327,7 +331,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -334,0 +334,0 @@ export declare const CloudflareAIGateway: { |
@@ -105,2 +105,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -110,7 +114,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -206,2 +206,6 @@ export declare const routes: import("../route/client.js").Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -211,7 +215,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -218,0 +218,0 @@ export declare const configure: (input?: LanguageModelOptions) => { |
@@ -110,2 +110,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -115,7 +119,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -122,0 +122,0 @@ export declare const configure: (input?: Config) => { |
@@ -157,2 +157,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -164,5 +168,2 @@ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -172,3 +173,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -175,0 +175,0 @@ export declare const configure: (input?: Config) => { |
+14
-14
@@ -116,2 +116,7 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -121,8 +126,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_format?: "parsed" | undefined; | ||
@@ -139,7 +139,6 @@ readonly include_reasoning?: boolean | undefined; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -150,2 +149,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -179,7 +179,6 @@ readonly [x: string]: unknown; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -190,2 +189,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -293,2 +293,7 @@ readonly [x: string]: unknown; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -298,8 +303,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly reasoning_format?: "parsed" | undefined; | ||
@@ -306,0 +306,0 @@ readonly include_reasoning?: boolean | undefined; |
@@ -16,2 +16,3 @@ export * as Anthropic from "./anthropic.js"; | ||
| export * as Groq from "./groq.js"; | ||
| export * as Mistral from "./mistral.js"; | ||
| export * as OpenAI from "./openai.js"; | ||
@@ -18,0 +19,0 @@ export * as OpenAICompatible from "./openai-compatible.js"; |
@@ -16,2 +16,3 @@ export * as Anthropic from "./anthropic.js"; | ||
| export * as Groq from "./groq.js"; | ||
| export * as Mistral from "./mistral.js"; | ||
| export * as OpenAI from "./openai.js"; | ||
@@ -18,0 +19,0 @@ export * as OpenAICompatible from "./openai-compatible.js"; |
@@ -155,2 +155,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -162,5 +166,2 @@ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -170,3 +171,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -173,0 +173,0 @@ export declare const configure: (input: Config) => { |
@@ -111,2 +111,6 @@ import { type ModelID } from "../schema/index.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -116,7 +120,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -123,0 +123,0 @@ export declare const configure: (input: GenericModelOptions) => { |
@@ -99,2 +99,6 @@ import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -104,7 +108,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>> | Route<{ | ||
@@ -286,2 +286,6 @@ readonly input: readonly ({ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -293,5 +297,2 @@ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly safety_identifier?: string | undefined; | ||
@@ -301,3 +302,2 @@ readonly top_logprobs?: number | undefined; | ||
| readonly max_tool_calls?: number | undefined; | ||
| readonly parallel_tool_calls?: boolean | undefined; | ||
| }, import("../protocols/open-responses-channel.js").Prepared>)[]; | ||
@@ -304,0 +304,0 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & { |
@@ -276,2 +276,6 @@ import { Schema } from "effect"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -281,7 +285,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, string, "[DONE]" | { | ||
@@ -296,7 +296,6 @@ readonly [x: string]: unknown; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -307,2 +306,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -336,7 +336,6 @@ readonly [x: string]: unknown; | ||
| readonly [x: string]: unknown; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_tokens?: number | null | undefined; | ||
| readonly completion_tokens?: number | null | undefined; | ||
| readonly total_tokens?: number | null | undefined; | ||
| readonly cached_tokens?: number | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly prompt_tokens_details?: { | ||
@@ -347,2 +346,3 @@ readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly prompt_cache_hit_tokens?: number | null | undefined; | ||
| readonly completion_tokens_details?: { | ||
@@ -449,2 +449,6 @@ readonly [x: string]: unknown; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -454,7 +458,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -551,2 +551,6 @@ export declare const routes: Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -556,7 +560,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -563,0 +563,0 @@ export declare const configure: (input?: LanguageModelOptions) => { |
@@ -105,2 +105,6 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -110,7 +114,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
@@ -206,2 +206,6 @@ export declare const routes: import("../route/client.js").Route<{ | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -211,7 +215,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
@@ -218,0 +218,0 @@ export declare const configure: (input?: LanguageModelOptions) => { |
@@ -107,2 +107,6 @@ import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly top_p?: number | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly store?: boolean | undefined; | ||
@@ -112,7 +116,3 @@ readonly stream_options?: { | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>> | Route<unknown, import("../protocols/open-responses-channel.js").Prepared>)[]; | ||
@@ -119,0 +119,0 @@ export declare const configure: (input?: LanguageModelOptions) => { |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18696", | ||
| "version": "0.0.0-dev-18697", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.112", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18696", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18697", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -43,3 +43,3 @@ "@types/bun": "1.3.13", | ||
| "@smithy/util-utf8": "4.2.2", | ||
| "@opencode-ai/schema": "0.0.0-dev-18696", | ||
| "@opencode-ai/schema": "0.0.0-dev-18697", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.112", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1541645
3.88%216
1.89%35549
4.08%+ Added
- Removed