@opencode-ai/ai
Advanced tools
| import type { ProviderPackage } from "../provider-package.js"; | ||
| import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| import type { RouteDefaultsInput } from "../route/client.js"; | ||
| import { type ModelID } from "../schema/index.js"; | ||
| import type { OpenAIProviderOptionsInput } from "./openai-options.js"; | ||
| export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| }; | ||
| export interface Settings extends ProviderPackage.Settings { | ||
| readonly apiKey?: string; | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| } | ||
| export declare const route: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>; | ||
| export declare const routes: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>[]; | ||
| export declare const configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| 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<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: /*elided*/ any; | ||
| }; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"]; |
| import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js"; | ||
| import { AuthOptions } from "../route/auth-options.js"; | ||
| import { ProviderID } from "../schema/index.js"; | ||
| import { profiles } from "./openai-compatible-profile.js"; | ||
| export const id = ProviderID.make("cerebras"); | ||
| export const route = OpenAICompatibleChat.route.with({ | ||
| id: "cerebras-chat", | ||
| provider: id, | ||
| endpoint: { baseURL: profiles.cerebras.baseURL }, | ||
| }); | ||
| export const routes = [route]; | ||
| export const configure = (input = {}) => { | ||
| const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input; | ||
| const configured = route.with({ | ||
| ...defaults, | ||
| endpoint: { baseURL: baseURL ?? profiles.cerebras.baseURL }, | ||
| auth: AuthOptions.bearer(input, "CEREBRAS_API_KEY"), | ||
| }); | ||
| return { | ||
| id, | ||
| model: (modelID) => configured.model({ | ||
| id: modelID, | ||
| compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning", supportsStore: false }, | ||
| }), | ||
| 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); |
| import type { ProviderPackage } from "../provider-package.js"; | ||
| import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| import type { RouteDefaultsInput } from "../route/client.js"; | ||
| import { type ModelID } from "../schema/index.js"; | ||
| import type { OpenAIProviderOptionsInput } from "./openai-options.js"; | ||
| export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| }; | ||
| export interface Settings extends ProviderPackage.Settings { | ||
| readonly apiKey?: string; | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| } | ||
| export declare const route: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>; | ||
| export declare const routes: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>[]; | ||
| export declare const configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| 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<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: /*elided*/ any; | ||
| }; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"]; |
| import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js"; | ||
| import { AuthOptions } from "../route/auth-options.js"; | ||
| import { ProviderID } from "../schema/index.js"; | ||
| import { profiles } from "./openai-compatible-profile.js"; | ||
| export const id = ProviderID.make("deepinfra"); | ||
| export const route = OpenAICompatibleChat.route.with({ | ||
| id: "deepinfra-chat", | ||
| provider: id, | ||
| endpoint: { baseURL: profiles.deepinfra.baseURL }, | ||
| }); | ||
| export const routes = [route]; | ||
| export const configure = (input = {}) => { | ||
| const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input; | ||
| const root = baseURL?.replace(/\/+$/, ""); | ||
| const configured = route.with({ | ||
| ...defaults, | ||
| endpoint: { | ||
| baseURL: root === undefined ? profiles.deepinfra.baseURL : root.endsWith("/openai") ? root : `${root}/openai`, | ||
| }, | ||
| auth: AuthOptions.bearer(input, "DEEPINFRA_API_KEY"), | ||
| }); | ||
| return { | ||
| id, | ||
| model: (modelID) => configured.model({ | ||
| id: modelID, | ||
| compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false }, | ||
| }), | ||
| 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); |
| import type { ProviderPackage } from "../provider-package.js"; | ||
| import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| import type { RouteDefaultsInput } from "../route/client.js"; | ||
| import { type ModelID } from "../schema/index.js"; | ||
| import type { OpenAIProviderOptionsInput } from "./openai-options.js"; | ||
| export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| }; | ||
| export interface Settings extends ProviderPackage.Settings { | ||
| readonly apiKey?: string; | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| } | ||
| export declare const route: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>; | ||
| export declare const routes: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | 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>>[]; | ||
| export declare const configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| 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<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: /*elided*/ any; | ||
| }; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"]; |
| import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js"; | ||
| import { AuthOptions } from "../route/auth-options.js"; | ||
| import { ProviderID } from "../schema/index.js"; | ||
| import { profiles } from "./openai-compatible-profile.js"; | ||
| export const id = ProviderID.make("togetherai"); | ||
| export const route = OpenAICompatibleChat.route.with({ | ||
| id: "togetherai-chat", | ||
| provider: id, | ||
| endpoint: { baseURL: profiles.togetherai.baseURL }, | ||
| }); | ||
| export const routes = [route]; | ||
| export const configure = (input = {}) => { | ||
| const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input; | ||
| const configured = route.with({ | ||
| ...defaults, | ||
| endpoint: { baseURL: baseURL ?? profiles.togetherai.baseURL }, | ||
| auth: AuthOptions.bearer(input, ["TOGETHER_API_KEY", "TOGETHER_AI_API_KEY"]), | ||
| }); | ||
| return { | ||
| id, | ||
| model: (modelID) => configured.model({ | ||
| id: modelID, | ||
| compatibility: { maxTokensField: "max_tokens", supportsStore: false, supportsStrictMode: false }, | ||
| }), | ||
| 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); |
@@ -37,3 +37,3 @@ // Apply an `LLMRequest.cache` policy by injecting `CacheHint`s onto the parts | ||
| // whole policy pass for these — emitting hints would be harmless but pointless. | ||
| const RESPECTS_INLINE_HINTS = new Set(["anthropic-messages", "bedrock-converse", "openrouter"]); | ||
| const RESPECTS_INLINE_HINTS = new Set(["anthropic-messages", "google-vertex-messages", "bedrock-converse", "openrouter"]); | ||
| const makeHint = (ttlSeconds) => ttlSeconds !== undefined ? new CacheHint({ type: "ephemeral", ttlSeconds }) : new CacheHint({ type: "ephemeral" }); | ||
@@ -40,0 +40,0 @@ const markLastTool = (tools, hint, budget) => { |
@@ -615,5 +615,9 @@ import { Buffer } from "node:buffer"; | ||
| }; | ||
| const canUseNativeSystemUpdate = (messages, index) => { | ||
| const previous = messages[index - 1]; | ||
| const next = messages[index + 1]; | ||
| const canUseNativeSystemUpdate = (request, index) => { | ||
| const previous = request.messages[index - 1]; | ||
| const next = request.messages[index + 1]; | ||
| // Vertex currently rejects/404s for a system message after local tool results, | ||
| // so fold it into the user tool-result turn across continuations and history. | ||
| if (request.model.route.id === "google-vertex-messages" && previous?.role === "tool") | ||
| return false; | ||
| return (previous !== undefined && | ||
@@ -654,3 +658,3 @@ previous.role !== "system" && | ||
| return yield* invalid("Anthropic Messages system updates cannot split a local tool call from its tool result"); | ||
| if (supportsNativeSystemUpdates(request) && canUseNativeSystemUpdate(request.messages, index)) { | ||
| if (supportsNativeSystemUpdates(request) && canUseNativeSystemUpdate(request, index)) { | ||
| messages.push(yield* lowerNativeSystemUpdate(message, breakpoints)); | ||
@@ -657,0 +661,0 @@ continue; |
@@ -22,2 +22,31 @@ import { Effect, Schema } from "effect"; | ||
| type MessagePhase = Schema.Schema.Type<typeof MessagePhase>; | ||
| export declare const HostedToolItem: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>; | ||
| export type HostedToolItem = Schema.Schema.Type<typeof HostedToolItem>; | ||
| export declare const InputItem: Schema.Union<readonly [Schema.Struct<{ | ||
@@ -61,5 +90,2 @@ readonly role: Schema.tag<"system">; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -88,5 +114,37 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>; | ||
| type OpenResponsesInputItem = Schema.Schema.Type<typeof InputItem>; | ||
| type LoweredInputItem = OpenResponsesInputItem | { | ||
| export type ExtendedHostedToolItem = { | ||
| readonly type: string; | ||
| readonly id: string; | ||
| readonly [key: string]: unknown; | ||
| }; | ||
| type LoweredInputItem = OpenResponsesInputItem | ExtendedHostedToolItem | { | ||
| readonly type: "message"; | ||
@@ -159,5 +217,2 @@ readonly id?: string; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -186,3 +241,30 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| instructions: Schema.optional<Schema.String>; | ||
@@ -274,5 +356,2 @@ tools: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -301,3 +380,30 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| readonly instructions: Schema.optional<Schema.String>; | ||
@@ -454,3 +560,2 @@ readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| export type Event = Schema.Schema.Type<typeof Event>; | ||
| export type ItemKind = "message" | "reasoning" | "function-call" | "reference"; | ||
| export interface Extension { | ||
@@ -464,3 +569,3 @@ readonly id: string; | ||
| }) => MediaInput | undefined; | ||
| readonly acceptsItemID?: (kind: ItemKind, id: string) => boolean; | ||
| readonly lowerHostedToolItem?: (item: unknown) => ExtendedHostedToolItem | undefined; | ||
| } | ||
@@ -478,3 +583,2 @@ export interface ParserState { | ||
| readonly reasoningItems: Readonly<Record<string, ReasoningStreamItem>>; | ||
| readonly store: boolean | undefined; | ||
| } | ||
@@ -558,2 +662,39 @@ type ReasoningSummaryStatus = "active" | "can-conclude" | "concluded"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -567,5 +708,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -872,2 +1010,39 @@ readonly content: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -881,5 +1056,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -1056,2 +1228,39 @@ readonly content: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -1065,5 +1274,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -1070,0 +1276,0 @@ readonly content: string; |
@@ -57,6 +57,39 @@ import { Effect, Schema } from "effect"; | ||
| }); | ||
| const OpenResponsesItemReference = Schema.Struct({ | ||
| type: Schema.tag("item_reference"), | ||
| const OpenResponsesWebSearchCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("web_search_call"), | ||
| id: Schema.String, | ||
| }); | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]); | ||
| const OpenResponsesFileSearchCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("file_search_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| queries: Schema.optional(Schema.Array(Schema.String)), | ||
| results: optionalNull(Schema.Array(JsonObject)), | ||
| }), [JsonObject]); | ||
| const OpenResponsesCodeInterpreterCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("code_interpreter_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| code: optionalNull(Schema.String), | ||
| container_id: optionalNull(Schema.String), | ||
| outputs: optionalNull(Schema.Array(JsonObject)), | ||
| }), [JsonObject]); | ||
| const OpenResponsesMCPCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("mcp_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| server_label: Schema.optional(Schema.String), | ||
| name: Schema.optional(Schema.String), | ||
| arguments: Schema.optional(Schema.String), | ||
| output: optionalNull(Schema.String), | ||
| error: Schema.optional(Schema.Unknown), | ||
| }), [JsonObject]); | ||
| export const HostedToolItem = Schema.Union([ | ||
| OpenResponsesWebSearchCall, | ||
| OpenResponsesFileSearchCall, | ||
| OpenResponsesCodeInterpreterCall, | ||
| OpenResponsesMCPCall, | ||
| ]); | ||
| // `function_call_output.output` accepts either a plain string or an ordered | ||
@@ -87,3 +120,2 @@ // array of content items so tools can return images and files in addition to text. | ||
| OpenResponsesReasoningItem, | ||
| OpenResponsesItemReference, | ||
| Schema.Struct({ | ||
@@ -101,2 +133,3 @@ type: Schema.tag("function_call"), | ||
| }), | ||
| HostedToolItem, | ||
| ]); | ||
@@ -254,21 +287,16 @@ export const Tool = Schema.Struct({ | ||
| }); | ||
| // Servers validate item ids on replayed history, and a malformed or oversized | ||
| // id can fail an otherwise valid request. Only server-issued tokens are worth | ||
| // resending; anything else is treated as absent so the item is resent without | ||
| // an id (or skipped, for items that cannot be expressed without one). | ||
| const ITEM_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/; | ||
| // Server-issued item ids need a nonempty prefix and suffix, but the prefix is | ||
| // provider-defined and does not necessarily identify the item's semantic type. | ||
| const itemID = (providerMetadata, providerMetadataKey) => { | ||
| const metadata = providerMetadata?.[providerMetadataKey]; | ||
| return ProviderShared.isRecord(metadata) && | ||
| typeof metadata.itemId === "string" && | ||
| ITEM_ID_PATTERN.test(metadata.itemId) | ||
| ? metadata.itemId | ||
| : undefined; | ||
| if (!ProviderShared.isRecord(metadata) || typeof metadata.itemId !== "string") | ||
| return undefined; | ||
| const separator = metadata.itemId.indexOf("_"); | ||
| return separator > 0 && separator < metadata.itemId.length - 1 ? metadata.itemId : undefined; | ||
| }; | ||
| const acceptsItemID = (extension, kind, id) => id !== undefined && (extension.acceptsItemID?.(kind, id) ?? true); | ||
| const lowerToolCall = (part, providerMetadataKey, extension) => { | ||
| const lowerToolCall = (part, providerMetadataKey) => { | ||
| const id = itemID(part.providerMetadata, providerMetadataKey); | ||
| return { | ||
| type: "function_call", | ||
| ...(acceptsItemID(extension, "function-call", id) ? { id } : {}), | ||
| ...(id === undefined ? {} : { id }), | ||
| call_id: part.id, | ||
@@ -279,7 +307,7 @@ name: part.name, | ||
| }; | ||
| const lowerReasoning = (part, providerMetadataKey, extension) => { | ||
| const lowerReasoning = (part, providerMetadataKey) => { | ||
| const metadata = part.providerMetadata?.[providerMetadataKey]; | ||
| if (!ProviderShared.isRecord(metadata)) | ||
| return undefined; | ||
| const id = itemID(part.providerMetadata, providerMetadataKey); | ||
| if (!ProviderShared.isRecord(metadata) || !acceptsItemID(extension, "reasoning", id)) | ||
| return undefined; | ||
| const encryptedContent = typeof metadata.reasoningEncryptedContent === "string" || metadata.reasoningEncryptedContent === null | ||
@@ -290,3 +318,3 @@ ? metadata.reasoningEncryptedContent | ||
| type: "reasoning", | ||
| id, | ||
| ...(id === undefined ? {} : { id }), | ||
| summary: part.text.length > 0 ? [{ type: "summary_text", text: part.text }] : [], | ||
@@ -350,5 +378,3 @@ encrypted_content: encryptedContent, | ||
| const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (request, extension) { | ||
| const system = request.system.length === 0 ? [] : [{ role: "system", content: ProviderShared.joinText(request.system) }]; | ||
| const input = [...system]; | ||
| const store = OpenResponsesOptions.resolve(request).store; | ||
| const input = []; | ||
| const providerMetadataKey = request.model.route.providerMetadataKey ?? "openresponses"; | ||
@@ -373,4 +399,3 @@ for (const message of request.messages) { | ||
| const reasoningItems = {}; | ||
| const reasoningReferences = new Set(); | ||
| const hostedToolReferences = new Set(); | ||
| const hostedToolItems = new Set(); | ||
| const flushText = () => { | ||
@@ -381,4 +406,3 @@ if (content.length === 0) | ||
| const metadata = part.providerMetadata?.[providerMetadataKey]; | ||
| const rawID = itemID(part.providerMetadata, providerMetadataKey); | ||
| const id = acceptsItemID(extension, "message", rawID) ? rawID : undefined; | ||
| const id = itemID(part.providerMetadata, providerMetadataKey); | ||
| const phase = ProviderShared.isRecord(metadata) ? messagePhase(metadata.phase) : undefined; | ||
@@ -408,12 +432,6 @@ const group = groups.at(-1); | ||
| flushText(); | ||
| const reasoning = lowerReasoning(part, providerMetadataKey, extension); | ||
| const reasoning = lowerReasoning(part, providerMetadataKey); | ||
| if (!reasoning) | ||
| continue; | ||
| if (store !== false) { | ||
| if (!reasoningReferences.has(reasoning.id)) | ||
| input.push({ type: "item_reference", id: reasoning.id }); | ||
| reasoningReferences.add(reasoning.id); | ||
| continue; | ||
| } | ||
| const existing = reasoningItems[reasoning.id]; | ||
| const existing = reasoning.id === undefined ? undefined : reasoningItems[reasoning.id]; | ||
| if (existing) { | ||
@@ -425,3 +443,4 @@ existing.summary.push(...reasoning.summary); | ||
| } | ||
| reasoningItems[reasoning.id] = reasoning; | ||
| if (reasoning.id !== undefined) | ||
| reasoningItems[reasoning.id] = reasoning; | ||
| input.push(reasoning); | ||
@@ -434,3 +453,3 @@ continue; | ||
| continue; | ||
| input.push(lowerToolCall(part, providerMetadataKey, extension)); | ||
| input.push(lowerToolCall(part, providerMetadataKey)); | ||
| continue; | ||
@@ -441,18 +460,21 @@ } | ||
| const id = itemID(part.providerMetadata, providerMetadataKey); | ||
| const reference = acceptsItemID(extension, "reference", id) ? id : undefined; | ||
| if (store !== false && reference && !hostedToolReferences.has(reference)) | ||
| input.push({ type: "item_reference", id: reference }); | ||
| if (store === false) { | ||
| // The server is not storing this exchange, so the tool outcome has to | ||
| // travel in the input. Non-content results degrade to their text form. | ||
| const content = part.result.type === "content" | ||
| const hosted = part.result.type !== "json" | ||
| ? undefined | ||
| : Schema.is(HostedToolItem)(part.result.value) | ||
| ? part.result.value | ||
| : [{ type: "text", text: ProviderShared.toolResultText(part) }]; | ||
| input.push({ | ||
| role: "user", | ||
| content: yield* Effect.forEach(content, (item) => lowerHostedToolResultContentItem(item, request, extension)), | ||
| }); | ||
| : extension.lowerHostedToolItem?.(part.result.value); | ||
| if (id !== undefined && hosted?.id === id) { | ||
| if (!hostedToolItems.has(id)) { | ||
| input.push(hosted); | ||
| hostedToolItems.add(id); | ||
| } | ||
| continue; | ||
| } | ||
| if (reference) | ||
| hostedToolReferences.add(reference); | ||
| const content = part.result.type === "content" | ||
| ? part.result.value | ||
| : [{ type: "text", text: ProviderShared.toolResultText(part) }]; | ||
| input.push({ | ||
| role: "user", | ||
| content: yield* Effect.forEach(content, (item) => lowerHostedToolResultContentItem(item, request, extension)), | ||
| }); | ||
| continue; | ||
@@ -484,6 +506,7 @@ } | ||
| const options = OpenResponsesOptions.resolve(request); | ||
| const instructions = ProviderShared.joinText(request.system); | ||
| const cacheKey = ProviderShared.promptCacheKey(request); | ||
| const parallelToolCalls = resolveParallelToolCalls(request); | ||
| return { | ||
| ...(options.instructions ? { instructions: options.instructions } : {}), | ||
| ...(instructions ? { instructions } : {}), | ||
| ...(options.store !== undefined ? { store: options.store } : {}), | ||
@@ -692,5 +715,6 @@ ...(options.metadata ? { metadata: options.metadata } : {}), | ||
| } | ||
| if (item?.type !== "function_call" || !item.id) | ||
| if (item?.type !== "function_call" || !item.call_id) | ||
| return [state, NO_EVENTS]; | ||
| const metadata = providerMetadata(state, { itemId: item.id }); | ||
| const id = item.id ?? item.call_id; | ||
| const metadata = item.id ? providerMetadata(state, { itemId: item.id }) : undefined; | ||
| const events = []; | ||
@@ -702,4 +726,4 @@ const lifecycle = Lifecycle.stepStart(state.lifecycle, events); | ||
| lifecycle, | ||
| tools: ToolStream.start(state.tools, item.id, { | ||
| id: item.call_id ?? item.id, | ||
| tools: ToolStream.start(state.tools, id, { | ||
| id: item.call_id, | ||
| name: item.name ?? "", | ||
@@ -710,6 +734,3 @@ input: item.arguments ?? "", | ||
| }, | ||
| [ | ||
| ...events, | ||
| LLMEvent.toolInputStart({ id: item.call_id ?? item.id, name: item.name ?? "", providerMetadata: metadata }), | ||
| ], | ||
| [...events, LLMEvent.toolInputStart({ id: item.call_id, name: item.name ?? "", providerMetadata: metadata })], | ||
| ]; | ||
@@ -753,9 +774,5 @@ }; | ||
| return [state, NO_EVENTS]; | ||
| const events = []; | ||
| return [ | ||
| { | ||
| ...state, | ||
| lifecycle: state.store !== false | ||
| ? Lifecycle.reasoningEnd(state.lifecycle, events, `${event.item_id}:${event.summary_index}`, providerMetadata(state, { itemId: event.item_id })) | ||
| : state.lifecycle, | ||
| reasoningItems: { | ||
@@ -767,3 +784,3 @@ ...state.reasoningItems, | ||
| ...item.summaryParts, | ||
| [event.summary_index]: state.store !== false ? "concluded" : "can-conclude", | ||
| [event.summary_index]: "can-conclude", | ||
| }, | ||
@@ -773,3 +790,3 @@ }, | ||
| }, | ||
| events, | ||
| NO_EVENTS, | ||
| ]; | ||
@@ -824,14 +841,15 @@ }; | ||
| if (item.type === "function_call") { | ||
| if (!item.id || !item.call_id || !item.name) | ||
| if (!item.call_id || !item.name) | ||
| return [state, NO_EVENTS]; | ||
| const tools = state.tools[item.id] | ||
| const id = item.id ?? item.call_id; | ||
| const tools = state.tools[id] | ||
| ? state.tools | ||
| : ToolStream.start(state.tools, item.id, { | ||
| : ToolStream.start(state.tools, id, { | ||
| id: item.call_id, | ||
| name: item.name, | ||
| providerMetadata: providerMetadata(state, { itemId: item.id }), | ||
| providerMetadata: item.id ? providerMetadata(state, { itemId: item.id }) : undefined, | ||
| }); | ||
| const result = item.arguments === undefined | ||
| ? yield* ToolStream.finish(state.id, tools, item.id) | ||
| : yield* ToolStream.finishWithInput(state.id, tools, item.id, item.arguments); | ||
| ? yield* ToolStream.finish(state.id, tools, id) | ||
| : yield* ToolStream.finishWithInput(state.id, tools, id, item.arguments); | ||
| const events = []; | ||
@@ -879,5 +897,6 @@ const resultEvents = result.events ?? []; | ||
| ? yield* Effect.reduce(event.response?.output ?? [], () => [state, NO_EVENTS], ([current, events], item) => { | ||
| if (!item.id || | ||
| ((item.type !== "function_call" || !current.tools[item.id]) && | ||
| (item.type !== "reasoning" || !current.reasoningItems[item.id]))) | ||
| const id = item.id ?? (item.type === "function_call" ? item.call_id : undefined); | ||
| if (!id || | ||
| ((item.type !== "function_call" || !current.tools[id]) && | ||
| (item.type !== "reasoning" || !current.reasoningItems[id]))) | ||
| return Effect.succeed([current, events]); | ||
@@ -992,4 +1011,5 @@ return onOutputItemDone(current, { type: "response.output_item.done", item }).pipe(Effect.map(([next, emitted]) => [next, [...events, ...emitted]])); | ||
| return ProviderShared.eventError(state.id, `${event.type} message is missing id`); | ||
| return Effect.succeed(onOutputItemAdded(event.output_index !== undefined && event.item?.id | ||
| ? { ...state, outputItems: { ...state.outputItems, [event.output_index]: event.item.id } } | ||
| const id = event.item?.id ?? (event.item?.type === "function_call" ? event.item.call_id : undefined); | ||
| return Effect.succeed(onOutputItemAdded(event.output_index !== undefined && id | ||
| ? { ...state, outputItems: { ...state.outputItems, [event.output_index]: id } } | ||
| : state, event)); | ||
@@ -1032,3 +1052,2 @@ } | ||
| reasoningItems: {}, | ||
| store: OpenResponsesOptions.resolve(request).store, | ||
| }); | ||
@@ -1035,0 +1054,0 @@ export const protocol = Protocol.make({ |
@@ -244,3 +244,3 @@ import { Effect, Schema } from "effect"; | ||
| }); | ||
| const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(function* (message, configuredField, options = {}) { | ||
| const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(function* (message, configuredField, requireReasoning, options) { | ||
| const content = []; | ||
@@ -271,6 +271,6 @@ const reasoning = []; | ||
| const field = (() => { | ||
| if (configuredField !== undefined) | ||
| if (configuredField !== undefined && (requireReasoning || reasoning.length > 0 || nativeReasoning !== undefined)) | ||
| return configuredField; | ||
| if (reasoning.length === 0) | ||
| return undefined; | ||
| return requireReasoning ? "reasoning_content" : undefined; | ||
| if (observedField !== undefined) | ||
@@ -280,3 +280,3 @@ return observedField; | ||
| return "reasoning_content"; | ||
| if (!fullyStructured) | ||
| if (!fullyStructured || requireReasoning) | ||
| return "reasoning_content"; | ||
@@ -286,5 +286,5 @@ })(); | ||
| if (configuredField !== undefined) | ||
| return reasoning.length === 0 ? (nativeReasoning ?? "") : text; | ||
| return reasoning.length === 0 ? (nativeReasoning ?? (requireReasoning ? "" : undefined)) : text; | ||
| if (reasoning.length === 0) | ||
| return nativeReasoning; | ||
| return nativeReasoning ?? (requireReasoning ? "" : undefined); | ||
| return text; | ||
@@ -333,7 +333,7 @@ })(); | ||
| }); | ||
| const lowerMessage = Effect.fn("OpenAIChat.lowerMessage")(function* (message, reasoningField, options = {}) { | ||
| const lowerMessage = Effect.fn("OpenAIChat.lowerMessage")(function* (message, reasoningField, requireReasoning, options) { | ||
| if (message.role === "user") | ||
| return [yield* lowerUserMessage(message, options)]; | ||
| if (message.role === "assistant") | ||
| return [yield* lowerAssistantMessage(message, reasoningField, options)]; | ||
| return [yield* lowerAssistantMessage(message, reasoningField, requireReasoning, options)]; | ||
| return (yield* lowerToolMessages(message, options)).messages; | ||
@@ -358,2 +358,8 @@ }); | ||
| const modelID = request.model.id.toLowerCase(); | ||
| const requireReasoning = request.model.compatibility?.requireReasoning ?? | ||
| (request.model.compatibility?.reasoningField !== undefined || | ||
| request.model.provider === "deepseek" || | ||
| request.model.route.endpoint.baseURL?.toLowerCase().includes("deepseek.com") || | ||
| modelID.includes("deepseek")); | ||
| const reasoningField = request.model.compatibility?.reasoningField; | ||
| const mistral = ["mistral", "devstral", "codestral", "pixtral", "mixtral"].some((family) => modelID.includes(family)); | ||
@@ -436,3 +442,3 @@ const lowering = { | ||
| flushImages(); | ||
| messages.push(...(yield* lowerMessage(message, request.model.compatibility?.reasoningField, lowering))); | ||
| messages.push(...(yield* lowerMessage(message, reasoningField, requireReasoning, lowering))); | ||
| } | ||
@@ -439,0 +445,0 @@ flushImages(); |
@@ -10,2 +10,39 @@ import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -19,5 +56,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -24,0 +58,0 @@ readonly content: string; |
@@ -10,34 +10,3 @@ import { Schema } from "effect"; | ||
| readonly stream: Schema.Literal<true>; | ||
| readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| readonly description: Schema.String; | ||
| readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>; | ||
| readonly strict: Schema.optional<Schema.Boolean>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>; | ||
| readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>; | ||
| readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>; | ||
| readonly output_compression: Schema.optional<Schema.Int>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly partial_images: Schema.optional<Schema.Int>; | ||
| readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>; | ||
| readonly size: Schema.optional<Schema.String>; | ||
| }>]>>>; | ||
| readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"allowed_tools">; | ||
| readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>; | ||
| readonly tools: Schema.$Array<Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>>; | ||
| }>]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| }>]>>; | ||
| readonly model: Schema.String; | ||
| readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly input: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{ | ||
| readonly role: Schema.tag<"system">; | ||
@@ -80,5 +49,2 @@ readonly content: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -107,3 +73,80 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"computer_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly call_id: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| readonly pending_safety_checks: Schema.optional<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_preview_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly result: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly revised_prompt: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| readonly description: Schema.String; | ||
| readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>; | ||
| readonly strict: Schema.optional<Schema.Boolean>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>; | ||
| readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>; | ||
| readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>; | ||
| readonly output_compression: Schema.optional<Schema.Int>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly partial_images: Schema.optional<Schema.Int>; | ||
| readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>; | ||
| readonly size: Schema.optional<Schema.String>; | ||
| }>]>>>; | ||
| readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"allowed_tools">; | ||
| readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>; | ||
| readonly tools: Schema.$Array<Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>>; | ||
| }>]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| }>]>>; | ||
| readonly model: Schema.String; | ||
| readonly instructions: Schema.optional<Schema.String>; | ||
@@ -139,2 +182,39 @@ readonly store: Schema.optional<Schema.Boolean>; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -148,5 +228,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -204,2 +281,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -336,2 +441,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -345,5 +487,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -401,2 +540,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -468,2 +635,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -477,5 +681,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -533,2 +734,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -600,2 +829,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -609,5 +875,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -665,2 +928,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -732,2 +1023,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -741,5 +1069,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -797,2 +1122,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -799,0 +1152,0 @@ readonly model: string; |
@@ -10,3 +10,3 @@ import { Effect, Encoding, Schema } from "effect"; | ||
| import { OpenResponses } from "./open-responses.js"; | ||
| import { optionalArray, ProviderShared } from "./shared.js"; | ||
| import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js"; | ||
| import { OpenAIImage } from "./utils/openai-image.js"; | ||
@@ -33,2 +33,26 @@ import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js"; | ||
| }); | ||
| const OpenAIResponsesHostedToolItem = Schema.Union([ | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("computer_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| call_id: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| pending_safety_checks: Schema.optional(Schema.Array(JsonObject)), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("web_search_preview_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("image_generation_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| result: optionalNull(Schema.String), | ||
| output_format: Schema.optional(Schema.Literals(["png", "jpeg", "webp"])), | ||
| revised_prompt: optionalNull(Schema.String), | ||
| }), [JsonObject]), | ||
| ]); | ||
| const OpenAIResponsesTools = Schema.Union([OpenResponses.Tool, OpenAIResponsesImageGenerationTool]); | ||
@@ -41,2 +65,3 @@ const OpenAIResponsesToolChoice = Schema.Union([ | ||
| ...OpenResponses.coreFields, | ||
| input: Schema.Array(Schema.Union([OpenResponses.InputItem, OpenAIResponsesHostedToolItem])), | ||
| tools: optionalArray(OpenAIResponsesTools), | ||
@@ -49,23 +74,6 @@ tool_choice: Schema.optional(OpenAIResponsesToolChoice), | ||
| }); | ||
| // Replayed items are paired with stored server state by id, so a foreign or | ||
| // synthetic token can fail request validation even when `call_id` pairing is | ||
| // intact. Only resend ids in each item kind's own grammar; hosted tool | ||
| // references keep generic validation because every hosted tool mints its own | ||
| // prefix. The same allowlist approach codex uses before resending history | ||
| // (codex-rs core/src/client.rs, `prepare_response_items_for_request`). | ||
| const ITEM_ID_PREFIXES = { | ||
| message: ["msg_"], | ||
| reasoning: ["rs_"], | ||
| "function-call": ["fc_"], | ||
| // Every hosted tool mints its own id prefix, so references keep generic | ||
| // validation only. | ||
| reference: [], | ||
| }; | ||
| const extension = { | ||
| id: ADAPTER, | ||
| name: NAME, | ||
| acceptsItemID: (kind, id) => { | ||
| const prefixes = ITEM_ID_PREFIXES[kind]; | ||
| return prefixes.length === 0 || prefixes.some((prefix) => id.startsWith(prefix)); | ||
| }, | ||
| lowerHostedToolItem: (item) => (Schema.is(OpenAIResponsesHostedToolItem)(item) ? item : undefined), | ||
| }; | ||
@@ -97,2 +105,3 @@ const nativeImageToolInput = (tool) => { | ||
| }); | ||
| const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(OpenAIResponsesBody)); | ||
| const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request) { | ||
@@ -102,3 +111,3 @@ const body = yield* OpenResponses.fromRequestWithExtension(LLMRequest.update(request, { tools: [], toolChoice: undefined }), extension); | ||
| const parallelToolCalls = OpenResponses.resolveParallelToolCalls(request); | ||
| return { | ||
| return yield* decodeBody({ | ||
| ...body, | ||
@@ -110,3 +119,3 @@ ...(parallelToolCalls === undefined ? {} : { parallel_tool_calls: parallelToolCalls }), | ||
| tool_choice: body.tool_choice ?? (request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined), | ||
| }; | ||
| }); | ||
| }); | ||
@@ -113,0 +122,0 @@ const hostedToolResult = Effect.fn("OpenAIResponses.hostedToolResult")(function* (item) { |
@@ -122,6 +122,5 @@ import { Tool } from "@opencode-ai/schema/tool"; | ||
| * keep-alive events so the protocol event schema sees one JSON string per | ||
| * element. The SSE channel emits a | ||
| * `Retry` control event on its error channel; we drop it here (we don't | ||
| * implement client-driven retries). Decoder failures become provider output | ||
| * errors so the public error channel stays `AIError`. | ||
| * element. Retry control events are ignored without interrupting the stream. | ||
| * Decoder failures become provider output errors so the public error channel | ||
| * stays `AIError`. | ||
| */ | ||
@@ -128,0 +127,0 @@ export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>, events?: ReadonlySet<string>) => Stream.Stream<string, AIError>; |
@@ -165,8 +165,21 @@ import { Buffer } from "node:buffer"; | ||
| * keep-alive events so the protocol event schema sees one JSON string per | ||
| * element. The SSE channel emits a | ||
| * `Retry` control event on its error channel; we drop it here (we don't | ||
| * implement client-driven retries). Decoder failures become provider output | ||
| * errors so the public error channel stays `AIError`. | ||
| * element. Retry control events are ignored without interrupting the stream. | ||
| * Decoder failures become provider output errors so the public error channel | ||
| * stays `AIError`. | ||
| */ | ||
| export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.pipeThroughChannel(Sse.decode()), Stream.catchTag("Retry", () => Stream.empty), Stream.catchTag("SseError", (error) => Stream.fail(eventError("sse", error.message))), Stream.filter((event) => (events === undefined || events.has(event.event)) && | ||
| export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.mapAccumEffect(() => { | ||
| const output = []; | ||
| return { | ||
| output, | ||
| parser: Sse.makeParser((event) => { | ||
| if (event._tag === "Event") | ||
| output.push(event); | ||
| }), | ||
| }; | ||
| }, (state, chunk) => Effect.gen(function* () { | ||
| const error = state.parser.feed(chunk); | ||
| if (error) | ||
| return yield* eventError("sse", error.message); | ||
| return [state, state.output.splice(0)]; | ||
| })), Stream.filter((event) => (events === undefined || events.has(event.event)) && | ||
| event.data.length > 0 && | ||
@@ -173,0 +186,0 @@ (event.data !== "[DONE]" || (events !== undefined && event.event !== "message"))), Stream.map((event) => event.data)); |
@@ -29,3 +29,2 @@ import { Schema } from "effect"; | ||
| export declare const Options: Schema.Struct<{ | ||
| readonly instructions: Schema.optional<Schema.String>; | ||
| readonly store: Schema.optional<Schema.Boolean>; | ||
@@ -32,0 +31,0 @@ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>; |
@@ -31,3 +31,2 @@ import { Option, Schema } from "effect"; | ||
| export const Options = Schema.Struct({ | ||
| instructions: Schema.optional(Schema.String), | ||
| store: Schema.optional(Schema.Boolean), | ||
@@ -34,0 +33,0 @@ metadata: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
@@ -5,2 +5,39 @@ import { Protocol } from "../route/protocol.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -14,5 +51,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -70,2 +104,17 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "x_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly error?: unknown; | ||
| readonly result?: unknown; | ||
| })[]; | ||
@@ -72,0 +121,0 @@ readonly model: string; |
@@ -0,10 +1,37 @@ | ||
| import { Effect, Schema } from "effect"; | ||
| import { Protocol } from "../route/protocol.js"; | ||
| import { OpenResponses } from "./open-responses.js"; | ||
| import { JsonObject, optionalNull, ProviderShared } from "./shared.js"; | ||
| import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js"; | ||
| const ADAPTER = "xai-responses"; | ||
| const NAME = "xAI Responses"; | ||
| const XAIResponsesHostedToolItem = Schema.Union([ | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("x_search_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("image_generation_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| result: Schema.optional(Schema.Unknown), | ||
| error: Schema.optional(Schema.Unknown), | ||
| }), [JsonObject]), | ||
| ]); | ||
| const XAIResponsesBody = Schema.Struct({ | ||
| ...OpenResponses.coreFields, | ||
| input: Schema.Array(Schema.Union([OpenResponses.InputItem, XAIResponsesHostedToolItem])), | ||
| stream: Schema.Literal(true), | ||
| }); | ||
| const extension = { | ||
| id: ADAPTER, | ||
| name: NAME, | ||
| lowerHostedToolItem: (item) => (Schema.is(XAIResponsesHostedToolItem)(item) ? item : undefined), | ||
| }; | ||
| const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(XAIResponsesBody)); | ||
| const fromRequest = Effect.fn("XAIResponses.fromRequest")(function* (request) { | ||
| return yield* decodeBody(yield* OpenResponses.fromRequestWithExtension(request, extension)); | ||
| }); | ||
| const HOSTED_TOOLS = { | ||
@@ -33,3 +60,6 @@ web_search_call: { name: "web_search", input: (item) => item.action ?? {} }, | ||
| id: ADAPTER, | ||
| body: OpenResponses.protocol.body, | ||
| body: { | ||
| schema: XAIResponsesBody, | ||
| from: fromRequest, | ||
| }, | ||
| stream: { | ||
@@ -36,0 +66,0 @@ event: OpenResponses.protocol.stream.event, |
@@ -29,7 +29,8 @@ import { Option, Schema } from "effect"; | ||
| /token limit exceeded/i, | ||
| /request_too_large/i, | ||
| ]; | ||
| const payloadPatterns = [/request_too_large/i, /request entity too large/i, /payload too large/i, /request too large/i]; | ||
| const payloadPatterns = [/request entity too large/i, /payload too large/i, /request too large/i]; | ||
| const exclusions = [/^(throttling error|service unavailable):/i, /rate limit/i, /too many requests/i]; | ||
| export const isContextOverflow = (message) => !exclusions.some((pattern) => pattern.test(message)) && | ||
| (patterns.some((pattern) => pattern.test(message)) || /^400\s*(status code)?\s*\(no body\)/i.test(message)); | ||
| (patterns.some((pattern) => pattern.test(message)) || /^4(?:00|13)\s*(status code)?\s*\(no body\)/i.test(message)); | ||
| export const isPayloadTooLarge = (message) => payloadPatterns.some((pattern) => pattern.test(message)); | ||
@@ -72,2 +73,3 @@ export const isContextOverflowFailure = (failure) => failure instanceof AIError | ||
| codes.includes("model_context_window_exceeded") || | ||
| codes.includes("request_too_large") || | ||
| isContextOverflow(text))) | ||
@@ -74,0 +76,0 @@ return new InvalidRequestReason({ ...common, classification: "context-overflow" }); |
@@ -122,2 +122,39 @@ import type { Route as RouteDef, RouteDefaultsInput } from "../route/client.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -131,5 +168,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -187,2 +221,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -189,0 +251,0 @@ readonly model: string; |
@@ -125,2 +125,39 @@ import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -134,5 +171,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -190,2 +224,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -192,0 +254,0 @@ readonly model: string; |
@@ -23,2 +23,39 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -32,5 +69,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -37,0 +71,0 @@ readonly content: string; |
@@ -6,4 +6,6 @@ export * as Anthropic from "./anthropic.js"; | ||
| export * as Azure from "./azure.js"; | ||
| export * as Cerebras from "./cerebras.js"; | ||
| export * as Cloudflare from "./cloudflare.js"; | ||
| export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js"; | ||
| export * as DeepInfra from "./deepinfra.js"; | ||
| export * as Google from "./google.js"; | ||
@@ -18,3 +20,4 @@ export * as GoogleVertex from "./google-vertex.js"; | ||
| export * as OpenRouter from "./openrouter.js"; | ||
| export * as TogetherAI from "./togetherai.js"; | ||
| export * as XAI from "./xai.js"; | ||
| export * as ZAI from "./zai.js"; |
@@ -6,4 +6,6 @@ export * as Anthropic from "./anthropic.js"; | ||
| export * as Azure from "./azure.js"; | ||
| export * as Cerebras from "./cerebras.js"; | ||
| export * as Cloudflare from "./cloudflare.js"; | ||
| export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js"; | ||
| export * as DeepInfra from "./deepinfra.js"; | ||
| export * as Google from "./google.js"; | ||
@@ -18,3 +20,4 @@ export * as GoogleVertex from "./google-vertex.js"; | ||
| export * as OpenRouter from "./openrouter.js"; | ||
| export * as TogetherAI from "./togetherai.js"; | ||
| export * as XAI from "./xai.js"; | ||
| export * as ZAI from "./zai.js"; |
@@ -21,2 +21,39 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -30,5 +67,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -35,0 +69,0 @@ readonly content: string; |
@@ -110,2 +110,39 @@ import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -119,5 +156,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -175,2 +209,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -177,0 +239,0 @@ readonly model: string; |
@@ -75,2 +75,4 @@ import { Schema } from "effect"; | ||
| readonly reasoningField: Schema.optional<Schema.String>; | ||
| /** Require every assistant message to include its reasoning field, even when empty. */ | ||
| readonly requireReasoning: Schema.optional<Schema.Boolean>; | ||
| readonly maxTokensField: Schema.optional<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>; | ||
@@ -77,0 +79,0 @@ readonly requireFinishReason: Schema.optional<Schema.Boolean>; |
@@ -102,2 +102,4 @@ import { Schema } from "effect"; | ||
| reasoningField: Schema.optional(Schema.String), | ||
| /** Require every assistant message to include its reasoning field, even when empty. */ | ||
| requireReasoning: Schema.optional(Schema.Boolean), | ||
| maxTokensField: Schema.optional(LanguageModelMaxTokensFieldCompatibility), | ||
@@ -104,0 +106,0 @@ requireFinishReason: Schema.optional(Schema.Boolean), |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-beta-18230", | ||
| "version": "0.0.0-beta-18269", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.111", | ||
| "@opencode-ai/http-recorder": "0.0.0-beta-18230", | ||
| "@opencode-ai/http-recorder": "0.0.0-beta-18269", | ||
| "@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-beta-18230", | ||
| "@opencode-ai/schema": "0.0.0-beta-18269", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111", |
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.
1345259
5.84%210
2.94%30949
6.09%+ Added
- Removed