import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { OpenAIChatCompletionUsage, OpenAIChatCompletionUsage$Outbound } from "./openaichatcompletionusage.js"; export type OpenAIChatCompletionChunkFile2 = { /** * The unique identifier of a previously uploaded file */ fileId: string; /** * Optional filename override */ filename?: string | undefined; }; export type OpenAIChatCompletionChunkFile1 = { /** * The name of the file */ filename: string; /** * Base64-encoded file data */ fileData: string; }; /** * The file to include in the message, either as raw data or by reference */ export type OpenAIChatCompletionChunk2File = OpenAIChatCompletionChunkFile1 | OpenAIChatCompletionChunkFile2; export type OpenAIChatCompletionChunk24 = { /** * Content type identifier for file content */ type: "file"; /** * The file to include in the message, either as raw data or by reference */ file: OpenAIChatCompletionChunkFile1 | OpenAIChatCompletionChunkFile2; }; /** * The format of the encoded audio data */ export declare const OpenAIChatCompletionChunk2Format: { readonly Wav: "wav"; readonly Mp3: "mp3"; }; /** * The format of the encoded audio data */ export type OpenAIChatCompletionChunk2Format = ClosedEnum; export type OpenAIChatCompletionChunk2InputAudio = { /** * Base64-encoded audio data */ data: string; /** * The format of the encoded audio data */ format: OpenAIChatCompletionChunk2Format; }; export type OpenAIChatCompletionChunk23 = { /** * Content type identifier for audio input content */ type: "input_audio"; inputAudio: OpenAIChatCompletionChunk2InputAudio; }; /** * The detail level of the image analysis. 'low' disables high-res mode, 'high' enables it, 'auto' lets the model decide. */ export declare const OpenAIChatCompletionChunk2Detail: { readonly Auto: "auto"; readonly Low: "low"; readonly High: "high"; }; /** * The detail level of the image analysis. 'low' disables high-res mode, 'high' enables it, 'auto' lets the model decide. */ export type OpenAIChatCompletionChunk2Detail = ClosedEnum; export type OpenAIChatCompletionChunk2ImageUrl = { /** * The URL of the image, or a base64-encoded image data URL */ url: string; /** * The detail level of the image analysis. 'low' disables high-res mode, 'high' enables it, 'auto' lets the model decide. */ detail?: OpenAIChatCompletionChunk2Detail | undefined; }; export type OpenAIChatCompletionChunk22 = { /** * Content type identifier for image URL content */ type: "image_url"; imageUrl: OpenAIChatCompletionChunk2ImageUrl; }; export type OpenAIChatCompletionChunk21 = { /** * Content type identifier for text content */ type: "text"; /** * The text content to include in the message */ text: string; }; /** * A content part that can be included in a message. Supports text, images, audio, and files. */ export type OpenAIChatCompletionChunkContent2 = OpenAIChatCompletionChunk21 | OpenAIChatCompletionChunk22 | OpenAIChatCompletionChunk23 | OpenAIChatCompletionChunk24; /** * The content of the chunk. May be a string, content parts, or null. */ export type OpenAIChatCompletionChunkContent = string | Array; /** * The function that the model called */ export type OpenAIChatCompletionChunkFunction = { /** * The name of the function called */ name?: string | undefined; /** * The arguments passed to the function, as a JSON string */ arguments?: string | undefined; }; /** * A partial tool call delta in a streaming chunk */ export type OpenAIChatCompletionChunkToolCalls = { /** * The ID of the tool call */ id?: string | undefined; /** * The type of the tool. Currently only 'function' is supported. */ type?: "function" | undefined; /** * The function that the model called */ function?: OpenAIChatCompletionChunkFunction | undefined; /** * The index of the tool call in the list of tool calls */ index: number; }; /** * The delta content for this chunk */ export type Delta = { /** * The role of the author of this message */ role?: "assistant" | undefined; /** * The content of the chunk. May be a string, content parts, or null. */ content?: string | Array | null | undefined; /** * The reasoning content delta generated by the model. Present for models that support chain-of-thought reasoning. */ reasoning?: string | null | undefined; /** * The tool call deltas generated by the model */ toolCalls?: Array | undefined; }; /** * The reason why the model stopped generating tokens. */ export declare const FinishReason1: { readonly Stop: "stop"; readonly Length: "length"; readonly ToolCalls: "tool_calls"; readonly ContentFilter: "content_filter"; }; /** * The reason why the model stopped generating tokens. */ export type FinishReason1 = ClosedEnum; /** * The reason the model stopped generating tokens. Only present in the final chunk. 'stop' means natural stop point, 'length' means max_tokens limit reached, 'tool_calls' means the model called a tool, 'content_filter' means content was filtered. */ export type OpenAIChatCompletionChunkFinishReason = FinishReason1 | string; /** * Log probability information for the choice */ export type OpenAIChatCompletionChunkLogprobs = { /** * The list of tokens */ tokens: Array; /** * The log probability of each token */ tokenLogprobs: Array; /** * The top log probabilities for each token position */ topLogprobs: Array<{ [k: string]: number; }>; /** * The character offset from the beginning of the returned text for each token */ textOffset: Array; }; /** * A chat completion choice in a streaming chunk */ export type Choices = { /** * The index of this choice in the list of choices */ index: number; /** * The delta content for this chunk */ delta: Delta; /** * The reason the model stopped generating tokens. Only present in the final chunk. 'stop' means natural stop point, 'length' means max_tokens limit reached, 'tool_calls' means the model called a tool, 'content_filter' means content was filtered. */ finishReason: FinishReason1 | string | null; /** * Log probability information for the choice */ logprobs?: OpenAIChatCompletionChunkLogprobs | null | undefined; }; /** * Represents a streamed chunk of a chat completion response */ export type OpenAIChatCompletionChunk = { /** * A unique identifier for the chat completion */ id: string; /** * The object type, always 'chat.completion.chunk' */ object: "chat.completion.chunk"; /** * The Unix timestamp (in seconds) of when the chat completion was created */ created: number; /** * The model used for the chat completion */ model: string; /** * A list of chat completion choices in this chunk */ choices: Array; /** * Usage statistics for the completion request */ usage?: OpenAIChatCompletionUsage | undefined; /** * This fingerprint represents the backend configuration that the model runs with */ systemFingerprint?: string | undefined; }; /** @internal */ export declare const OpenAIChatCompletionChunkFile2$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkFile2$Outbound = { file_id: string; filename?: string | undefined; }; /** @internal */ export declare const OpenAIChatCompletionChunkFile2$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkFile2ToJSON(openAIChatCompletionChunkFile2: OpenAIChatCompletionChunkFile2): string; export declare function openAIChatCompletionChunkFile2FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkFile1$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkFile1$Outbound = { filename: string; file_data: string; }; /** @internal */ export declare const OpenAIChatCompletionChunkFile1$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkFile1ToJSON(openAIChatCompletionChunkFile1: OpenAIChatCompletionChunkFile1): string; export declare function openAIChatCompletionChunkFile1FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk2File$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk2File$Outbound = OpenAIChatCompletionChunkFile1$Outbound | OpenAIChatCompletionChunkFile2$Outbound; /** @internal */ export declare const OpenAIChatCompletionChunk2File$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk2FileToJSON(openAIChatCompletionChunk2File: OpenAIChatCompletionChunk2File): string; export declare function openAIChatCompletionChunk2FileFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk24$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk24$Outbound = { type: "file"; file: OpenAIChatCompletionChunkFile1$Outbound | OpenAIChatCompletionChunkFile2$Outbound; }; /** @internal */ export declare const OpenAIChatCompletionChunk24$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk24ToJSON(openAIChatCompletionChunk24: OpenAIChatCompletionChunk24): string; export declare function openAIChatCompletionChunk24FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk2Format$inboundSchema: z.ZodNativeEnum; /** @internal */ export declare const OpenAIChatCompletionChunk2Format$outboundSchema: z.ZodNativeEnum; /** @internal */ export declare const OpenAIChatCompletionChunk2InputAudio$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk2InputAudio$Outbound = { data: string; format: string; }; /** @internal */ export declare const OpenAIChatCompletionChunk2InputAudio$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk2InputAudioToJSON(openAIChatCompletionChunk2InputAudio: OpenAIChatCompletionChunk2InputAudio): string; export declare function openAIChatCompletionChunk2InputAudioFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk23$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk23$Outbound = { type: "input_audio"; input_audio: OpenAIChatCompletionChunk2InputAudio$Outbound; }; /** @internal */ export declare const OpenAIChatCompletionChunk23$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk23ToJSON(openAIChatCompletionChunk23: OpenAIChatCompletionChunk23): string; export declare function openAIChatCompletionChunk23FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk2Detail$inboundSchema: z.ZodNativeEnum; /** @internal */ export declare const OpenAIChatCompletionChunk2Detail$outboundSchema: z.ZodNativeEnum; /** @internal */ export declare const OpenAIChatCompletionChunk2ImageUrl$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk2ImageUrl$Outbound = { url: string; detail?: string | undefined; }; /** @internal */ export declare const OpenAIChatCompletionChunk2ImageUrl$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk2ImageUrlToJSON(openAIChatCompletionChunk2ImageUrl: OpenAIChatCompletionChunk2ImageUrl): string; export declare function openAIChatCompletionChunk2ImageUrlFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk22$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk22$Outbound = { type: "image_url"; image_url: OpenAIChatCompletionChunk2ImageUrl$Outbound; }; /** @internal */ export declare const OpenAIChatCompletionChunk22$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk22ToJSON(openAIChatCompletionChunk22: OpenAIChatCompletionChunk22): string; export declare function openAIChatCompletionChunk22FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk21$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk21$Outbound = { type: "text"; text: string; }; /** @internal */ export declare const OpenAIChatCompletionChunk21$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunk21ToJSON(openAIChatCompletionChunk21: OpenAIChatCompletionChunk21): string; export declare function openAIChatCompletionChunk21FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkContent2$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkContent2$Outbound = OpenAIChatCompletionChunk21$Outbound | OpenAIChatCompletionChunk22$Outbound | OpenAIChatCompletionChunk23$Outbound | OpenAIChatCompletionChunk24$Outbound; /** @internal */ export declare const OpenAIChatCompletionChunkContent2$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkContent2ToJSON(openAIChatCompletionChunkContent2: OpenAIChatCompletionChunkContent2): string; export declare function openAIChatCompletionChunkContent2FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkContent$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkContent$Outbound = string | Array; /** @internal */ export declare const OpenAIChatCompletionChunkContent$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkContentToJSON(openAIChatCompletionChunkContent: OpenAIChatCompletionChunkContent): string; export declare function openAIChatCompletionChunkContentFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkFunction$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkFunction$Outbound = { name?: string | undefined; arguments?: string | undefined; }; /** @internal */ export declare const OpenAIChatCompletionChunkFunction$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkFunctionToJSON(openAIChatCompletionChunkFunction: OpenAIChatCompletionChunkFunction): string; export declare function openAIChatCompletionChunkFunctionFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkToolCalls$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkToolCalls$Outbound = { id?: string | undefined; type?: "function" | undefined; function?: OpenAIChatCompletionChunkFunction$Outbound | undefined; index: number; }; /** @internal */ export declare const OpenAIChatCompletionChunkToolCalls$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkToolCallsToJSON(openAIChatCompletionChunkToolCalls: OpenAIChatCompletionChunkToolCalls): string; export declare function openAIChatCompletionChunkToolCallsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Delta$inboundSchema: z.ZodType; /** @internal */ export type Delta$Outbound = { role?: "assistant" | undefined; content?: string | Array | null | undefined; reasoning?: string | null | undefined; tool_calls?: Array | undefined; }; /** @internal */ export declare const Delta$outboundSchema: z.ZodType; export declare function deltaToJSON(delta: Delta): string; export declare function deltaFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const FinishReason1$inboundSchema: z.ZodNativeEnum; /** @internal */ export declare const FinishReason1$outboundSchema: z.ZodNativeEnum; /** @internal */ export declare const OpenAIChatCompletionChunkFinishReason$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkFinishReason$Outbound = string | string; /** @internal */ export declare const OpenAIChatCompletionChunkFinishReason$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkFinishReasonToJSON(openAIChatCompletionChunkFinishReason: OpenAIChatCompletionChunkFinishReason): string; export declare function openAIChatCompletionChunkFinishReasonFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunkLogprobs$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunkLogprobs$Outbound = { tokens: Array; token_logprobs: Array; top_logprobs: Array<{ [k: string]: number; }>; text_offset: Array; }; /** @internal */ export declare const OpenAIChatCompletionChunkLogprobs$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkLogprobsToJSON(openAIChatCompletionChunkLogprobs: OpenAIChatCompletionChunkLogprobs): string; export declare function openAIChatCompletionChunkLogprobsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Choices$inboundSchema: z.ZodType; /** @internal */ export type Choices$Outbound = { index: number; delta: Delta$Outbound; finish_reason: string | string | null; logprobs?: OpenAIChatCompletionChunkLogprobs$Outbound | null | undefined; }; /** @internal */ export declare const Choices$outboundSchema: z.ZodType; export declare function choicesToJSON(choices: Choices): string; export declare function choicesFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const OpenAIChatCompletionChunk$inboundSchema: z.ZodType; /** @internal */ export type OpenAIChatCompletionChunk$Outbound = { id: string; object: "chat.completion.chunk"; created: number; model: string; choices: Array; usage?: OpenAIChatCompletionUsage$Outbound | undefined; system_fingerprint?: string | undefined; }; /** @internal */ export declare const OpenAIChatCompletionChunk$outboundSchema: z.ZodType; export declare function openAIChatCompletionChunkToJSON(openAIChatCompletionChunk: OpenAIChatCompletionChunk): string; export declare function openAIChatCompletionChunkFromJSON(jsonString: string): SafeParseResult; //# sourceMappingURL=openaichatcompletionchunk.d.ts.map