/** * ArkType schemas for the OpenAI chat-completions request shape we accept on the * gateway. Mirrors https://platform.openai.com/docs/api-reference/chat — only * the shapes the gateway translation layer understands. Unknown fields on * permissive objects are accepted-and-stripped (via `"+": "delete"`) so the * official OpenAI SDK — which sends a growing pile of non-strict defaults (e.g. * `stream_options.include_obfuscation`) — does not trip 400s on shapes we simply ignore. */ import type { ChatCompletionContentPart, ChatCompletionCreateParams, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionTool, ChatCompletionToolChoiceOption } from "./openai-chat-wire.js"; export declare const textPartSchema: import("@oh-my-pi/omptype").FluentType<{ text: string; type: "text"; }, { text: string; type: "text"; }>; /** * OpenAI documents `image_url` as either `{ url: string, detail?: ... }` or — * older clients — a bare string. Accept both shapes; downstream we extract a * URL. `detail` is accepted for forward-compat but currently dropped (pi-ai's * `ImageContent` has no detail field — TODO: plumb through if/when added). */ export declare const imagePartSchema: import("@oh-my-pi/omptype").FluentType<{ image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; }, { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; }>; /** OpenAI audio input block (gpt-4o-audio). Accepted; currently dropped downstream. */ export declare const inputAudioPartSchema: import("@oh-my-pi/omptype").FluentType<{ input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; }, { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; }>; /** OpenAI file input block (file_search / vision-document). Accepted; currently dropped downstream. */ export declare const filePartSchema: import("@oh-my-pi/omptype").FluentType<{ file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; }, { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; }>; /** Replayed assistant refusal block. Accepted; currently dropped downstream. */ export declare const refusalPartSchema: import("@oh-my-pi/omptype").FluentType<{ refusal: string; type: "refusal"; }, { refusal: string; type: "refusal"; }>; /** * Forward-compat catch-all for unknown content-part types. Matches every other * `{ type: string, ... }` object so a new OpenAI block kind does not 400 the * whole request; the walker ignores parts whose `type` it does not know. */ export declare const unknownPartSchema: import("@oh-my-pi/omptype").FluentType<{ type: string; }, { type: string; }>; export declare const userContentPartSchema: import("@oh-my-pi/omptype").FluentType<{ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; }, { text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; }>; export declare const toolCallSchema: import("@oh-my-pi/omptype").FluentType<{ function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }, { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }>; export declare const toolSchema: import("@oh-my-pi/omptype").FluentType<{ function: { description?: string | undefined; name: string; parameters?: Record | undefined; strict?: boolean | undefined; }; type: "function"; }, { function: { description?: string | undefined; name: string; parameters?: Record | undefined; strict?: boolean | undefined; }; type: "function"; }>; export declare const toolChoiceSchema: import("@oh-my-pi/omptype").FluentType<"auto" | "none" | "required" | { function: { name: string; }; type: "function"; } | { name: string; type: "tool"; }, "auto" | "none" | "required" | { function: { name: string; }; type: "function"; } | { name: string; type: "tool"; }>; export declare const systemMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; }, { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; }>; export declare const developerMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; }, { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; }>; export declare const userMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; }, { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; }>; export declare const assistantMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; }, { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; }>; export declare const toolMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; }, { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; }>; /** * Legacy `function` role (pre-tools API). Translated to a `tool` role * canonical message in the walker so downstream providers see one shape. */ export declare const functionMessageSchema: import("@oh-my-pi/omptype").FluentType<{ content: string | null; name: string; role: "function"; }, { content: string | null; name: string; role: "function"; }>; export declare const messageSchema: import("@oh-my-pi/omptype").FluentType<{ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; } | { content: string | null; name: string; role: "function"; }, { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; } | { content: string | null; name: string; role: "function"; }>; /** * Permissive: the official OpenAI SDK sets `include_obfuscation: false` by * default. We only consume `include_usage`, so unknown keys are silently * stripped rather than 400'd. */ export declare const streamOptionsSchema: import("@oh-my-pi/omptype").FluentType<{ include_usage?: boolean | undefined; }, { include_usage?: boolean | undefined; }>; export declare const stopSchema: import("@oh-my-pi/omptype").FluentType; export declare const openaiChatRequestSchema: import("@oh-my-pi/omptype").FluentType<{ audio?: unknown; frequency_penalty?: number | undefined; logit_bias?: Record | undefined; logprobs?: unknown; max_completion_tokens?: number | undefined; max_tokens?: number | undefined; messages: ({ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; } | { content: string | null; name: string; role: "function"; })[]; metadata?: Record | undefined; modalities?: unknown; model: string; n?: unknown; parallel_tool_calls?: boolean | undefined; prediction?: unknown; presence_penalty?: number | undefined; prompt_cache_key?: unknown; reasoning_effort?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined; response_format?: unknown; safety_identifier?: unknown; seed?: number | undefined; service_tier?: "auto" | "default" | "flex" | "priority" | "scale" | undefined; stop?: string | undefined; store?: unknown; stream?: boolean | undefined; stream_options?: { include_usage?: boolean | undefined; } | undefined; temperature?: number | undefined; tool_choice?: "auto" | "none" | "required" | { function: { name: string; }; type: "function"; } | { name: string; type: "tool"; } | undefined; tools?: { function: { description?: string | undefined; name: string; parameters?: Record | undefined; strict?: boolean | undefined; }; type: "function"; }[] | undefined; top_logprobs?: unknown; top_p?: number | undefined; user?: string | undefined; web_search_options?: unknown; }, { audio?: unknown; frequency_penalty?: number | undefined; logit_bias?: Record | undefined; logprobs?: unknown; max_completion_tokens?: number | undefined; max_tokens?: number | undefined; messages: ({ content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "developer"; } | { content: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[]; role: "user"; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | null | undefined; reasoning_content?: string | null | undefined; role: "assistant"; tool_calls?: { function: { arguments: string; name: string; }; id: string; type?: "function" | undefined; }[] | undefined; } | { content?: string | ({ text: string; type: "text"; } | { image_url: string | { detail?: "auto" | "high" | "low" | undefined; url: string; }; type: "image_url"; } | { input_audio: { data: string; format: "mp3" | "wav"; }; type: "input_audio"; } | { file: { file_data?: string | undefined; file_id?: string | undefined; filename?: string | undefined; }; type: "file"; } | { refusal: string; type: "refusal"; } | { type: string; })[] | undefined; name?: string | undefined; role: "tool"; tool_call_id?: string | undefined; } | { content: string | null; name: string; role: "function"; })[]; metadata?: Record | undefined; modalities?: unknown; model: string; n?: unknown; parallel_tool_calls?: boolean | undefined; prediction?: unknown; presence_penalty?: number | undefined; prompt_cache_key?: unknown; reasoning_effort?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined; response_format?: unknown; safety_identifier?: unknown; seed?: number | undefined; service_tier?: "auto" | "default" | "flex" | "priority" | "scale" | undefined; stop?: string | undefined; store?: unknown; stream?: boolean | undefined; stream_options?: { include_usage?: boolean | undefined; } | undefined; temperature?: number | undefined; tool_choice?: "auto" | "none" | "required" | { function: { name: string; }; type: "function"; } | { name: string; type: "tool"; } | undefined; tools?: { function: { description?: string | undefined; name: string; parameters?: Record | undefined; strict?: boolean | undefined; }; type: "function"; }[] | undefined; top_logprobs?: unknown; top_p?: number | undefined; user?: string | undefined; web_search_options?: unknown; }>; /** * Public types are sourced from the OpenAI SDK so the gateway stays in * lock-step with the canonical API surface; the schemas above are runtime * validators for the subset we actually accept. */ export type OpenAIChatRequest = ChatCompletionCreateParams; export type OpenAIChatMessage = ChatCompletionMessageParam; export type OpenAIChatToolCall = ChatCompletionMessageToolCall; export type OpenAIChatTool = ChatCompletionTool; export type OpenAIChatToolChoice = ChatCompletionToolChoiceOption; export type OpenAIChatContentPart = ChatCompletionContentPart;