/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 847546c98ce5
 */
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 ChatCompletionRequestStop$outboundSchema = smartUnion([z.string(), z.array(z.string())]);
export function chatCompletionRequestStopToJSON(chatCompletionRequestStop) {
    return JSON.stringify(ChatCompletionRequestStop$outboundSchema.parse(chatCompletionRequestStop));
}
/** @internal */
export const ChatCompletionRequestMessage$outboundSchema = z.union([
    AssistantMessage$outboundSchema.and(z.object({ role: z.literal("assistant") })),
    SystemMessage$outboundSchema,
    ToolMessage$outboundSchema,
    UserMessage$outboundSchema,
]);
export function chatCompletionRequestMessageToJSON(chatCompletionRequestMessage) {
    return JSON.stringify(ChatCompletionRequestMessage$outboundSchema.parse(chatCompletionRequestMessage));
}
/** @internal */
export const ChatCompletionRequestTool$outboundSchema = z.union([
    Tool$outboundSchema,
    WebSearchTool$outboundSchema,
    WebSearchPremiumTool$outboundSchema,
    CodeInterpreterTool$outboundSchema,
    ImageGenerationTool$outboundSchema,
    DocumentLibraryTool$outboundSchema,
    CustomConnector$outboundSchema,
]);
export function chatCompletionRequestToolToJSON(chatCompletionRequestTool) {
    return JSON.stringify(ChatCompletionRequestTool$outboundSchema.parse(chatCompletionRequestTool));
}
/** @internal */
export const ChatCompletionRequestToolChoice$outboundSchema = smartUnion([ToolChoice$outboundSchema, ToolChoiceEnum$outboundSchema]);
export function chatCompletionRequestToolChoiceToJSON(chatCompletionRequestToolChoice) {
    return JSON.stringify(ChatCompletionRequestToolChoice$outboundSchema.parse(chatCompletionRequestToolChoice));
}
/** @internal */
export const ChatCompletionRequest$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(false),
    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 chatCompletionRequestToJSON(chatCompletionRequest) {
    return JSON.stringify(ChatCompletionRequest$outboundSchema.parse(chatCompletionRequest));
}
//# sourceMappingURL=chatcompletionrequest.js.map