/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: acdd588275c9
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { smartUnion } from "../../types/smartUnion.js";
import { AssistantMessage$outboundSchema, } from "./assistantmessage.js";
import { CodeInterpreterTool$outboundSchema, } from "./codeinterpretertool.js";
import { CustomConnector$outboundSchema, } from "./customconnector.js";
import { DocumentLibraryTool$outboundSchema, } from "./documentlibrarytool.js";
import { GuardrailConfig$outboundSchema, } from "./guardrailconfig.js";
import { ImageGenerationTool$outboundSchema, } from "./imagegenerationtool.js";
import { MistralPromptMode$outboundSchema, } from "./mistralpromptmode.js";
import { Prediction$outboundSchema, } from "./prediction.js";
import { ReasoningEffort$outboundSchema, } from "./reasoningeffort.js";
import { ResponseFormat$outboundSchema, } from "./responseformat.js";
import { SystemMessage$outboundSchema, } from "./systemmessage.js";
import { Tool$outboundSchema } from "./tool.js";
import { ToolChoice$outboundSchema, } from "./toolchoice.js";
import { ToolChoiceEnum$outboundSchema, } from "./toolchoiceenum.js";
import { ToolMessage$outboundSchema, } from "./toolmessage.js";
import { UserMessage$outboundSchema, } from "./usermessage.js";
import { WebSearchPremiumTool$outboundSchema, } from "./websearchpremiumtool.js";
import { WebSearchTool$outboundSchema, } from "./websearchtool.js";
/** @internal */
export const ChatCompletionStreamRequestStop$outboundSchema = smartUnion([z.string(), z.array(z.string())]);
export function chatCompletionStreamRequestStopToJSON(chatCompletionStreamRequestStop) {
    return JSON.stringify(ChatCompletionStreamRequestStop$outboundSchema.parse(chatCompletionStreamRequestStop));
}
/** @internal */
export const ChatCompletionStreamRequestMessage$outboundSchema = z.union([
    AssistantMessage$outboundSchema.and(z.object({ role: z.literal("assistant") })),
    SystemMessage$outboundSchema,
    ToolMessage$outboundSchema,
    UserMessage$outboundSchema,
]);
export function chatCompletionStreamRequestMessageToJSON(chatCompletionStreamRequestMessage) {
    return JSON.stringify(ChatCompletionStreamRequestMessage$outboundSchema.parse(chatCompletionStreamRequestMessage));
}
/** @internal */
export const ChatCompletionStreamRequestTool$outboundSchema = z.union([
    Tool$outboundSchema,
    WebSearchTool$outboundSchema,
    WebSearchPremiumTool$outboundSchema,
    CodeInterpreterTool$outboundSchema,
    ImageGenerationTool$outboundSchema,
    DocumentLibraryTool$outboundSchema,
    CustomConnector$outboundSchema,
]);
export function chatCompletionStreamRequestToolToJSON(chatCompletionStreamRequestTool) {
    return JSON.stringify(ChatCompletionStreamRequestTool$outboundSchema.parse(chatCompletionStreamRequestTool));
}
/** @internal */
export const ChatCompletionStreamRequestToolChoice$outboundSchema = smartUnion([ToolChoice$outboundSchema, ToolChoiceEnum$outboundSchema]);
export function chatCompletionStreamRequestToolChoiceToJSON(chatCompletionStreamRequestToolChoice) {
    return JSON.stringify(ChatCompletionStreamRequestToolChoice$outboundSchema.parse(chatCompletionStreamRequestToolChoice));
}
/** @internal */
export const ChatCompletionStreamRequest$outboundSchema = z.object({
    model: z.string(),
    temperature: z.nullable(z.number()).optional(),
    topP: z.nullable(z.number()).optional(),
    maxTokens: z.nullable(z.int()).optional(),
    stream: z.boolean().default(true),
    stop: z.nullable(smartUnion([z.string(), z.array(z.string())])).optional(),
    randomSeed: z.nullable(z.int()).optional(),
    metadata: z.nullable(z.record(z.string(), z.any())).optional(),
    messages: z.array(z.union([
        AssistantMessage$outboundSchema.and(z.object({ role: z.literal("assistant") })),
        SystemMessage$outboundSchema,
        ToolMessage$outboundSchema,
        UserMessage$outboundSchema,
    ])),
    responseFormat: ResponseFormat$outboundSchema.optional(),
    tools: z.nullable(z.array(z.union([
        Tool$outboundSchema,
        WebSearchTool$outboundSchema,
        WebSearchPremiumTool$outboundSchema,
        CodeInterpreterTool$outboundSchema,
        ImageGenerationTool$outboundSchema,
        DocumentLibraryTool$outboundSchema,
        CustomConnector$outboundSchema,
    ]))).optional(),
    toolChoice: smartUnion([
        ToolChoice$outboundSchema,
        ToolChoiceEnum$outboundSchema,
    ]).optional(),
    presencePenalty: z.nullable(z.number()).optional(),
    frequencyPenalty: z.nullable(z.number()).optional(),
    n: z.nullable(z.int()).optional(),
    prediction: Prediction$outboundSchema.optional(),
    parallelToolCalls: z.boolean().optional(),
    reasoningEffort: z.nullable(ReasoningEffort$outboundSchema).optional(),
    promptMode: z.nullable(MistralPromptMode$outboundSchema).optional(),
    guardrails: z.nullable(z.array(GuardrailConfig$outboundSchema)).optional(),
    promptCacheKey: z.nullable(z.string()).optional(),
    safePrompt: z.boolean().optional(),
}).transform((v) => {
    return remap$(v, {
        topP: "top_p",
        maxTokens: "max_tokens",
        randomSeed: "random_seed",
        responseFormat: "response_format",
        toolChoice: "tool_choice",
        presencePenalty: "presence_penalty",
        frequencyPenalty: "frequency_penalty",
        parallelToolCalls: "parallel_tool_calls",
        reasoningEffort: "reasoning_effort",
        promptMode: "prompt_mode",
        promptCacheKey: "prompt_cache_key",
        safePrompt: "safe_prompt",
    });
});
export function chatCompletionStreamRequestToJSON(chatCompletionStreamRequest) {
    return JSON.stringify(ChatCompletionStreamRequest$outboundSchema.parse(chatCompletionStreamRequest));
}
//# sourceMappingURL=chatcompletionstreamrequest.js.map