"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateResponseContent2$outboundSchema = exports.CreateResponse21$outboundSchema = exports.CreateResponse22$outboundSchema = exports.Detail$outboundSchema = exports.Two3$outboundSchema = exports.TwoRole$outboundSchema = exports.CreateResponse2RouterResponses2$outboundSchema = exports.CreateResponse2RouterResponsesRequestRequestBodyType$outboundSchema = exports.CreateResponse23$outboundSchema = exports.CreateResponse2RouterResponsesRequestRequestBodyInputType$outboundSchema = exports.CreateResponseText$outboundSchema = exports.CreateResponseFormat$outboundSchema = exports.Format1$outboundSchema = exports.Format2$outboundSchema = exports.Format3$outboundSchema = exports.CreateResponseThinking$outboundSchema = exports.Reasoning$outboundSchema = exports.Effort$outboundSchema = exports.CreateResponseServiceTier = exports.Truncation = exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type = exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType = exports.ToolsSearchContextSize = exports.ToolsRanker = exports.CreateResponseToolChoiceRouterResponses1 = exports.CreateResponseToolChoiceRouterResponsesResponseType = exports.ContentType = exports.OutputStatus = exports.OutputRole = exports.CreateResponseOutputStatus = exports.CreateResponseOutputRouterResponsesStatus = exports.CreateResponseOutputRouterResponsesResponseStatus = exports.Reason = exports.CreateResponseStatus = exports.CreateResponseObject = exports.CreateResponseToolChoice1 = exports.CreateResponseToolChoiceType = exports.CreateResponseToolChoiceRouterResponsesType = exports.CreateResponseToolChoiceRouterResponsesRequestType = exports.CreateResponseToolsType = exports.CreateResponseToolsRouterResponsesRequestType = exports.SearchContextSize = exports.Ranker = exports.ServiceTier = exports.Include = exports.Detail = exports.TwoRole = exports.CreateResponse2RouterResponsesRequestRequestBodyType = exports.CreateResponse2RouterResponsesRequestRequestBodyInputType = exports.Effort = void 0;
exports.Output$inboundSchema = exports.Output1$inboundSchema = exports.OutputContent$inboundSchema = exports.Content1$inboundSchema = exports.ContentAnnotations$inboundSchema = exports.Annotations1$inboundSchema = exports.Annotations2$inboundSchema = exports.ContentType$inboundSchema = exports.OutputStatus$inboundSchema = exports.OutputRole$inboundSchema = exports.Output2$inboundSchema = exports.CreateResponseOutputStatus$inboundSchema = exports.Output3$inboundSchema = exports.CreateResponseOutputRouterResponsesStatus$inboundSchema = exports.Output4$inboundSchema = exports.CreateResponseOutputRouterResponsesResponseStatus$inboundSchema = exports.IncompleteDetails$inboundSchema = exports.Reason$inboundSchema = exports.ErrorT$inboundSchema = exports.CreateResponseStatus$inboundSchema = exports.CreateResponseObject$inboundSchema = exports.CreateResponseRouterResponsesResponseBody$inboundSchema = exports.CreateResponseData$inboundSchema = exports.CreateResponseRequestBody$outboundSchema = exports.CreateResponseToolChoice$outboundSchema = exports.CreateResponseToolChoice1$outboundSchema = exports.CreateResponseToolChoice2$outboundSchema = exports.CreateResponseToolChoiceType$outboundSchema = exports.ToolChoice3$outboundSchema = exports.CreateResponseToolChoiceRouterResponsesType$outboundSchema = exports.ToolChoice4$outboundSchema = exports.CreateResponseToolChoiceRouterResponsesRequestType$outboundSchema = exports.CreateResponseTools$outboundSchema = exports.Tools1$outboundSchema = exports.ToolsParameters$outboundSchema = exports.Properties$outboundSchema = exports.CreateResponseToolsType$outboundSchema = exports.Tools2$outboundSchema = exports.UserLocation$outboundSchema = exports.CreateResponseToolsRouterResponsesRequestType$outboundSchema = exports.SearchContextSize$outboundSchema = exports.Tools3$outboundSchema = exports.RankingOptions$outboundSchema = exports.Ranker$outboundSchema = exports.ServiceTier$outboundSchema = exports.Include$outboundSchema = exports.CreateResponseInput$outboundSchema = exports.Input2$outboundSchema = exports.Two1$outboundSchema = exports.TwoContent$outboundSchema = void 0;
exports.CreateResponseResponse$inboundSchema = exports.CreateResponseResponseBody$inboundSchema = exports.CreateResponseServiceTier$inboundSchema = exports.Truncation$inboundSchema = exports.CreateResponseRouterResponsesText$inboundSchema = exports.CreateResponseRouterResponsesFormat$inboundSchema = exports.CreateResponseFormat1$inboundSchema = exports.CreateResponseFormat2$inboundSchema = exports.CreateResponseFormat3$inboundSchema = exports.CreateResponseReasoning$inboundSchema = exports.CreateResponseRouterResponsesTools$inboundSchema = exports.CreateResponseTools1$inboundSchema = exports.CreateResponseToolsParameters$inboundSchema = exports.ToolsProperties$inboundSchema = exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type$inboundSchema = exports.CreateResponseTools2$inboundSchema = exports.ToolsUserLocation$inboundSchema = exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType$inboundSchema = exports.ToolsSearchContextSize$inboundSchema = exports.CreateResponseTools3$inboundSchema = exports.ToolsRankingOptions$inboundSchema = exports.ToolsRanker$inboundSchema = exports.CreateResponseRouterResponsesToolChoice$inboundSchema = exports.CreateResponseToolChoiceRouterResponses1$inboundSchema = exports.CreateResponseToolChoiceRouterResponses2$inboundSchema = exports.CreateResponseToolChoiceFunction$inboundSchema = exports.CreateResponseToolChoiceRouterResponsesResponseType$inboundSchema = exports.CreateResponseUsage$inboundSchema = exports.OutputTokensDetails$inboundSchema = exports.CreateResponseInputTokensDetails$inboundSchema = void 0;
exports.reasoningToJSON = reasoningToJSON;
exports.createResponseThinkingToJSON = createResponseThinkingToJSON;
exports.format3ToJSON = format3ToJSON;
exports.format2ToJSON = format2ToJSON;
exports.format1ToJSON = format1ToJSON;
exports.createResponseFormatToJSON = createResponseFormatToJSON;
exports.createResponseTextToJSON = createResponseTextToJSON;
exports.createResponse23ToJSON = createResponse23ToJSON;
exports.createResponse2RouterResponses2ToJSON = createResponse2RouterResponses2ToJSON;
exports.two3ToJSON = two3ToJSON;
exports.createResponse22ToJSON = createResponse22ToJSON;
exports.createResponse21ToJSON = createResponse21ToJSON;
exports.createResponseContent2ToJSON = createResponseContent2ToJSON;
exports.twoContentToJSON = twoContentToJSON;
exports.two1ToJSON = two1ToJSON;
exports.input2ToJSON = input2ToJSON;
exports.createResponseInputToJSON = createResponseInputToJSON;
exports.rankingOptionsToJSON = rankingOptionsToJSON;
exports.tools3ToJSON = tools3ToJSON;
exports.userLocationToJSON = userLocationToJSON;
exports.tools2ToJSON = tools2ToJSON;
exports.propertiesToJSON = propertiesToJSON;
exports.toolsParametersToJSON = toolsParametersToJSON;
exports.tools1ToJSON = tools1ToJSON;
exports.createResponseToolsToJSON = createResponseToolsToJSON;
exports.toolChoice4ToJSON = toolChoice4ToJSON;
exports.toolChoice3ToJSON = toolChoice3ToJSON;
exports.createResponseToolChoice2ToJSON = createResponseToolChoice2ToJSON;
exports.createResponseToolChoiceToJSON = createResponseToolChoiceToJSON;
exports.createResponseRequestBodyToJSON = createResponseRequestBodyToJSON;
exports.createResponseDataFromJSON = createResponseDataFromJSON;
exports.createResponseRouterResponsesResponseBodyFromJSON = createResponseRouterResponsesResponseBodyFromJSON;
exports.errorFromJSON = errorFromJSON;
exports.incompleteDetailsFromJSON = incompleteDetailsFromJSON;
exports.output4FromJSON = output4FromJSON;
exports.output3FromJSON = output3FromJSON;
exports.output2FromJSON = output2FromJSON;
exports.annotations2FromJSON = annotations2FromJSON;
exports.annotations1FromJSON = annotations1FromJSON;
exports.contentAnnotationsFromJSON = contentAnnotationsFromJSON;
exports.content1FromJSON = content1FromJSON;
exports.outputContentFromJSON = outputContentFromJSON;
exports.output1FromJSON = output1FromJSON;
exports.outputFromJSON = outputFromJSON;
exports.createResponseInputTokensDetailsFromJSON = createResponseInputTokensDetailsFromJSON;
exports.outputTokensDetailsFromJSON = outputTokensDetailsFromJSON;
exports.createResponseUsageFromJSON = createResponseUsageFromJSON;
exports.createResponseToolChoiceFunctionFromJSON = createResponseToolChoiceFunctionFromJSON;
exports.createResponseToolChoiceRouterResponses2FromJSON = createResponseToolChoiceRouterResponses2FromJSON;
exports.createResponseRouterResponsesToolChoiceFromJSON = createResponseRouterResponsesToolChoiceFromJSON;
exports.toolsRankingOptionsFromJSON = toolsRankingOptionsFromJSON;
exports.createResponseTools3FromJSON = createResponseTools3FromJSON;
exports.toolsUserLocationFromJSON = toolsUserLocationFromJSON;
exports.createResponseTools2FromJSON = createResponseTools2FromJSON;
exports.toolsPropertiesFromJSON = toolsPropertiesFromJSON;
exports.createResponseToolsParametersFromJSON = createResponseToolsParametersFromJSON;
exports.createResponseTools1FromJSON = createResponseTools1FromJSON;
exports.createResponseRouterResponsesToolsFromJSON = createResponseRouterResponsesToolsFromJSON;
exports.createResponseReasoningFromJSON = createResponseReasoningFromJSON;
exports.createResponseFormat3FromJSON = createResponseFormat3FromJSON;
exports.createResponseFormat2FromJSON = createResponseFormat2FromJSON;
exports.createResponseFormat1FromJSON = createResponseFormat1FromJSON;
exports.createResponseRouterResponsesFormatFromJSON = createResponseRouterResponsesFormatFromJSON;
exports.createResponseRouterResponsesTextFromJSON = createResponseRouterResponsesTextFromJSON;
exports.createResponseResponseBodyFromJSON = createResponseResponseBodyFromJSON;
exports.createResponseResponseFromJSON = createResponseResponseFromJSON;
const z = __importStar(require("zod/v3"));
const event_streams_js_1 = require("../../lib/event-streams.js");
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const components = __importStar(require("../components/index.js"));
/**
 * The effort level for reasoning (o3-mini model only)
 */
exports.Effort = {
    Low: "low",
    Medium: "medium",
    High: "high",
};
/**
 * The type of input item
 */
exports.CreateResponse2RouterResponsesRequestRequestBodyInputType = {
    FunctionCall: "function_call",
};
/**
 * The type of input item
 */
exports.CreateResponse2RouterResponsesRequestRequestBodyType = {
    FunctionCallOutput: "function_call_output",
};
/**
 * The role of the message author
 */
exports.TwoRole = {
    User: "user",
    Assistant: "assistant",
    System: "system",
    Developer: "developer",
};
/**
 * Level of detail for image analysis
 */
exports.Detail = {
    High: "high",
    Low: "low",
    Auto: "auto",
};
exports.Include = {
    CodeInterpreterCallOutputs: "code_interpreter_call.outputs",
    ComputerCallOutputOutputImageUrl: "computer_call_output.output.image_url",
    FileSearchCallResults: "file_search_call.results",
    MessageInputImageImageUrl: "message.input_image.image_url",
    MessageOutputTextLogprobs: "message.output_text.logprobs",
    ReasoningEncryptedContent: "reasoning.encrypted_content",
};
/**
 * Specifies the latency tier to use for processing the request. Defaults to "auto".
 */
exports.ServiceTier = {
    Auto: "auto",
    Default: "default",
    Flex: "flex",
    Priority: "priority",
};
/**
 * The ranking algorithm
 */
exports.Ranker = {
    Auto: "auto",
    Default20240821: "default_2024_08_21",
};
/**
 * Amount of context to retrieve for each search result
 */
exports.SearchContextSize = {
    Small: "small",
    Medium: "medium",
    Large: "large",
};
/**
 * The type of location
 */
exports.CreateResponseToolsRouterResponsesRequestType = {
    Approximate: "approximate",
    Exact: "exact",
};
/**
 * The type of the parameters object
 */
exports.CreateResponseToolsType = {
    Object: "object",
};
exports.CreateResponseToolChoiceRouterResponsesRequestType = {
    Mcp: "mcp",
};
exports.CreateResponseToolChoiceRouterResponsesType = {
    Function: "function",
};
exports.CreateResponseToolChoiceType = {
    FileSearch: "file_search",
    WebSearchPreview: "web_search_preview",
    ComputerUsePreview: "computer_use_preview",
    CodeInterpreter: "code_interpreter",
    ImageGeneration: "image_generation",
};
/**
 * Controls which (if any) tool is called by the model. `none` means the model will not call any tool. `auto` means the model can pick between generating a message or calling a tool. `required` means the model must call a tool.
 */
exports.CreateResponseToolChoice1 = {
    None: "none",
    Auto: "auto",
    Required: "required",
};
/**
 * The object type, which is always "response"
 */
exports.CreateResponseObject = {
    Response: "response",
};
/**
 * The status of the response
 */
exports.CreateResponseStatus = {
    Completed: "completed",
    Failed: "failed",
    InProgress: "in_progress",
    Incomplete: "incomplete",
};
/**
 * The reason the response is incomplete
 */
exports.Reason = {
    MaxOutputTokens: "max_output_tokens",
    ContentFilter: "content_filter",
};
/**
 * The status of the function call
 */
exports.CreateResponseOutputRouterResponsesResponseStatus = {
    InProgress: "in_progress",
    Completed: "completed",
    Incomplete: "incomplete",
    Failed: "failed",
};
/**
 * The status of the file search
 */
exports.CreateResponseOutputRouterResponsesStatus = {
    InProgress: "in_progress",
    Completed: "completed",
    Incomplete: "incomplete",
    Failed: "failed",
};
/**
 * The status of the web search
 */
exports.CreateResponseOutputStatus = {
    InProgress: "in_progress",
    Completed: "completed",
    Incomplete: "incomplete",
    Failed: "failed",
};
/**
 * The role of the message author
 */
exports.OutputRole = {
    Assistant: "assistant",
};
/**
 * The status of the message
 */
exports.OutputStatus = {
    InProgress: "in_progress",
    Completed: "completed",
    Incomplete: "incomplete",
    Failed: "failed",
};
/**
 * The type of content part
 */
exports.ContentType = {
    OutputText: "output_text",
};
exports.CreateResponseToolChoiceRouterResponsesResponseType = {
    Function: "function",
};
exports.CreateResponseToolChoiceRouterResponses1 = {
    None: "none",
    Auto: "auto",
    Required: "required",
};
/**
 * The ranking algorithm
 */
exports.ToolsRanker = {
    Auto: "auto",
    Default20240821: "default_2024_08_21",
};
/**
 * Amount of context to retrieve for each search result
 */
exports.ToolsSearchContextSize = {
    Small: "small",
    Medium: "medium",
    Large: "large",
};
/**
 * The type of location
 */
exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType = {
    Approximate: "approximate",
    Exact: "exact",
};
/**
 * The type of the parameters object
 */
exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type = {
    Object: "object",
};
/**
 * Controls how the model handles inputs longer than the maximum token length
 */
exports.Truncation = {
    Auto: "auto",
    Disabled: "disabled",
};
/**
 * The service tier used for processing the request
 */
exports.CreateResponseServiceTier = {
    Auto: "auto",
    Default: "default",
    Flex: "flex",
    Priority: "priority",
};
/** @internal */
exports.Effort$outboundSchema = z
    .nativeEnum(exports.Effort);
/** @internal */
exports.Reasoning$outboundSchema = z.object({
    effort: exports.Effort$outboundSchema.optional(),
});
function reasoningToJSON(reasoning) {
    return JSON.stringify(exports.Reasoning$outboundSchema.parse(reasoning));
}
/** @internal */
exports.CreateResponseThinking$outboundSchema = z.union([
    components.ThinkingConfigDisabledSchema$outboundSchema,
    components.ThinkingConfigEnabledSchema$outboundSchema,
    components.ThinkingConfigAdaptiveSchema$outboundSchema,
]);
function createResponseThinkingToJSON(createResponseThinking) {
    return JSON.stringify(exports.CreateResponseThinking$outboundSchema.parse(createResponseThinking));
}
/** @internal */
exports.Format3$outboundSchema = z.object({
    type: z.literal("json_schema"),
    name: z.string(),
    description: z.string().optional(),
    schema: z.record(z.any()),
    strict: z.boolean().default(true),
});
function format3ToJSON(format3) {
    return JSON.stringify(exports.Format3$outboundSchema.parse(format3));
}
/** @internal */
exports.Format2$outboundSchema = z.object({
    type: z.literal("json_object"),
});
function format2ToJSON(format2) {
    return JSON.stringify(exports.Format2$outboundSchema.parse(format2));
}
/** @internal */
exports.Format1$outboundSchema = z.object({
    type: z.literal("text"),
});
function format1ToJSON(format1) {
    return JSON.stringify(exports.Format1$outboundSchema.parse(format1));
}
/** @internal */
exports.CreateResponseFormat$outboundSchema = z.union([
    z.lazy(() => exports.Format1$outboundSchema),
    z.lazy(() => exports.Format2$outboundSchema),
    z.lazy(() => exports.Format3$outboundSchema),
]);
function createResponseFormatToJSON(createResponseFormat) {
    return JSON.stringify(exports.CreateResponseFormat$outboundSchema.parse(createResponseFormat));
}
/** @internal */
exports.CreateResponseText$outboundSchema = z.object({
    format: z.union([
        z.lazy(() => exports.Format1$outboundSchema),
        z.lazy(() => exports.Format2$outboundSchema),
        z.lazy(() => exports.Format3$outboundSchema),
    ]),
});
function createResponseTextToJSON(createResponseText) {
    return JSON.stringify(exports.CreateResponseText$outboundSchema.parse(createResponseText));
}
/** @internal */
exports.CreateResponse2RouterResponsesRequestRequestBodyInputType$outboundSchema = z.nativeEnum(exports.CreateResponse2RouterResponsesRequestRequestBodyInputType);
/** @internal */
exports.CreateResponse23$outboundSchema = z.object({
    type: exports.CreateResponse2RouterResponsesRequestRequestBodyInputType$outboundSchema,
    callId: z.string(),
    id: z.string(),
    name: z.string(),
    arguments: z.string(),
    status: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        callId: "call_id",
    });
});
function createResponse23ToJSON(createResponse23) {
    return JSON.stringify(exports.CreateResponse23$outboundSchema.parse(createResponse23));
}
/** @internal */
exports.CreateResponse2RouterResponsesRequestRequestBodyType$outboundSchema = z.nativeEnum(exports.CreateResponse2RouterResponsesRequestRequestBodyType);
/** @internal */
exports.CreateResponse2RouterResponses2$outboundSchema = z.object({
    type: exports.CreateResponse2RouterResponsesRequestRequestBodyType$outboundSchema,
    callId: z.string(),
    output: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        callId: "call_id",
    });
});
function createResponse2RouterResponses2ToJSON(createResponse2RouterResponses2) {
    return JSON.stringify(exports.CreateResponse2RouterResponses2$outboundSchema.parse(createResponse2RouterResponses2));
}
/** @internal */
exports.TwoRole$outboundSchema = z
    .nativeEnum(exports.TwoRole);
/** @internal */
exports.Two3$outboundSchema = z.object({
    type: z.literal("input_file"),
    fileData: z.string().optional(),
    fileId: z.string().optional(),
    filename: z.string().optional(),
    fileUrl: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        fileData: "file_data",
        fileId: "file_id",
        fileUrl: "file_url",
    });
});
function two3ToJSON(two3) {
    return JSON.stringify(exports.Two3$outboundSchema.parse(two3));
}
/** @internal */
exports.Detail$outboundSchema = z
    .nativeEnum(exports.Detail);
/** @internal */
exports.CreateResponse22$outboundSchema = z.object({
    type: z.literal("input_image"),
    detail: exports.Detail$outboundSchema.default("auto"),
    fileId: z.nullable(z.string()).optional(),
    imageUrl: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        fileId: "file_id",
        imageUrl: "image_url",
    });
});
function createResponse22ToJSON(createResponse22) {
    return JSON.stringify(exports.CreateResponse22$outboundSchema.parse(createResponse22));
}
/** @internal */
exports.CreateResponse21$outboundSchema = z.object({
    type: z.literal("input_text"),
    text: z.string(),
});
function createResponse21ToJSON(createResponse21) {
    return JSON.stringify(exports.CreateResponse21$outboundSchema.parse(createResponse21));
}
/** @internal */
exports.CreateResponseContent2$outboundSchema = z.union([
    z.lazy(() => exports.CreateResponse21$outboundSchema),
    z.lazy(() => exports.CreateResponse22$outboundSchema),
    z.lazy(() => exports.Two3$outboundSchema),
]);
function createResponseContent2ToJSON(createResponseContent2) {
    return JSON.stringify(exports.CreateResponseContent2$outboundSchema.parse(createResponseContent2));
}
/** @internal */
exports.TwoContent$outboundSchema = z.union([
    z.string(),
    z.array(z.union([
        z.lazy(() => exports.CreateResponse21$outboundSchema),
        z.lazy(() => exports.CreateResponse22$outboundSchema),
        z.lazy(() => exports.Two3$outboundSchema),
    ])),
]);
function twoContentToJSON(twoContent) {
    return JSON.stringify(exports.TwoContent$outboundSchema.parse(twoContent));
}
/** @internal */
exports.Two1$outboundSchema = z.object({
    role: exports.TwoRole$outboundSchema,
    content: z.union([
        z.string(),
        z.array(z.union([
            z.lazy(() => exports.CreateResponse21$outboundSchema),
            z.lazy(() => exports.CreateResponse22$outboundSchema),
            z.lazy(() => exports.Two3$outboundSchema),
        ])),
    ]),
});
function two1ToJSON(two1) {
    return JSON.stringify(exports.Two1$outboundSchema.parse(two1));
}
/** @internal */
exports.Input2$outboundSchema = z.union([
    z.lazy(() => exports.CreateResponse23$outboundSchema),
    z.lazy(() => exports.CreateResponse2RouterResponses2$outboundSchema),
    z.lazy(() => exports.Two1$outboundSchema),
]);
function input2ToJSON(input2) {
    return JSON.stringify(exports.Input2$outboundSchema.parse(input2));
}
/** @internal */
exports.CreateResponseInput$outboundSchema = z.union([
    z.string(),
    z.array(z.union([
        z.lazy(() => exports.CreateResponse23$outboundSchema),
        z.lazy(() => exports.CreateResponse2RouterResponses2$outboundSchema),
        z.lazy(() => exports.Two1$outboundSchema),
    ])),
]);
function createResponseInputToJSON(createResponseInput) {
    return JSON.stringify(exports.CreateResponseInput$outboundSchema.parse(createResponseInput));
}
/** @internal */
exports.Include$outboundSchema = z
    .nativeEnum(exports.Include);
/** @internal */
exports.ServiceTier$outboundSchema = z
    .nativeEnum(exports.ServiceTier);
/** @internal */
exports.Ranker$outboundSchema = z
    .nativeEnum(exports.Ranker);
/** @internal */
exports.RankingOptions$outboundSchema = z.object({
    ranker: exports.Ranker$outboundSchema.default("auto"),
    scoreThreshold: z.number().default(0),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        scoreThreshold: "score_threshold",
    });
});
function rankingOptionsToJSON(rankingOptions) {
    return JSON.stringify(exports.RankingOptions$outboundSchema.parse(rankingOptions));
}
/** @internal */
exports.Tools3$outboundSchema = z.object({
    type: z.literal("file_search"),
    vectorStoreIds: z.array(z.string()).optional(),
    maxNumResults: z.number().int().default(20),
    filters: z.any().optional(),
    rankingOptions: z.lazy(() => exports.RankingOptions$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        vectorStoreIds: "vector_store_ids",
        maxNumResults: "max_num_results",
        rankingOptions: "ranking_options",
    });
});
function tools3ToJSON(tools3) {
    return JSON.stringify(exports.Tools3$outboundSchema.parse(tools3));
}
/** @internal */
exports.SearchContextSize$outboundSchema = z.nativeEnum(exports.SearchContextSize);
/** @internal */
exports.CreateResponseToolsRouterResponsesRequestType$outboundSchema = z
    .nativeEnum(exports.CreateResponseToolsRouterResponsesRequestType);
/** @internal */
exports.UserLocation$outboundSchema = z.object({
    type: exports.CreateResponseToolsRouterResponsesRequestType$outboundSchema.optional(),
    city: z.nullable(z.string()).optional(),
    country: z.string().optional(),
    region: z.nullable(z.string()).optional(),
    timezone: z.nullable(z.string()).optional(),
});
function userLocationToJSON(userLocation) {
    return JSON.stringify(exports.UserLocation$outboundSchema.parse(userLocation));
}
/** @internal */
exports.Tools2$outboundSchema = z.object({
    type: z.literal("web_search_preview"),
    domains: z.array(z.string()).optional(),
    searchContextSize: exports.SearchContextSize$outboundSchema.default("medium"),
    userLocation: z.lazy(() => exports.UserLocation$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        searchContextSize: "search_context_size",
        userLocation: "user_location",
    });
});
function tools2ToJSON(tools2) {
    return JSON.stringify(exports.Tools2$outboundSchema.parse(tools2));
}
/** @internal */
exports.CreateResponseToolsType$outboundSchema = z.nativeEnum(exports.CreateResponseToolsType);
/** @internal */
exports.Properties$outboundSchema = z.object({
    type: z.string(),
    description: z.string().optional(),
    enum: z.array(z.string()).optional(),
    additionalProperties: z.record(z.any()).optional(),
}).transform((v) => {
    return {
        ...v.additionalProperties,
        ...(0, primitives_js_1.remap)(v, {
            additionalProperties: null,
        }),
    };
});
function propertiesToJSON(properties) {
    return JSON.stringify(exports.Properties$outboundSchema.parse(properties));
}
/** @internal */
exports.ToolsParameters$outboundSchema = z.object({
    type: exports.CreateResponseToolsType$outboundSchema,
    properties: z.record(z.lazy(() => exports.Properties$outboundSchema)),
    required: z.array(z.string()).optional(),
    additionalProperties: z.boolean().optional(),
});
function toolsParametersToJSON(toolsParameters) {
    return JSON.stringify(exports.ToolsParameters$outboundSchema.parse(toolsParameters));
}
/** @internal */
exports.Tools1$outboundSchema = z.object({
    type: z.literal("function"),
    name: z.string(),
    description: z.nullable(z.string()).optional(),
    parameters: z.lazy(() => exports.ToolsParameters$outboundSchema),
    strict: z.boolean().default(true),
});
function tools1ToJSON(tools1) {
    return JSON.stringify(exports.Tools1$outboundSchema.parse(tools1));
}
/** @internal */
exports.CreateResponseTools$outboundSchema = z.union([
    z.lazy(() => exports.Tools1$outboundSchema),
    z.lazy(() => exports.Tools2$outboundSchema),
    z.lazy(() => exports.Tools3$outboundSchema),
]);
function createResponseToolsToJSON(createResponseTools) {
    return JSON.stringify(exports.CreateResponseTools$outboundSchema.parse(createResponseTools));
}
/** @internal */
exports.CreateResponseToolChoiceRouterResponsesRequestType$outboundSchema = z
    .nativeEnum(exports.CreateResponseToolChoiceRouterResponsesRequestType);
/** @internal */
exports.ToolChoice4$outboundSchema = z.object({
    type: exports.CreateResponseToolChoiceRouterResponsesRequestType$outboundSchema,
    serverLabel: z.string(),
    name: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        serverLabel: "server_label",
    });
});
function toolChoice4ToJSON(toolChoice4) {
    return JSON.stringify(exports.ToolChoice4$outboundSchema.parse(toolChoice4));
}
/** @internal */
exports.CreateResponseToolChoiceRouterResponsesType$outboundSchema = z
    .nativeEnum(exports.CreateResponseToolChoiceRouterResponsesType);
/** @internal */
exports.ToolChoice3$outboundSchema = z.object({
    type: exports.CreateResponseToolChoiceRouterResponsesType$outboundSchema,
    name: z.string(),
});
function toolChoice3ToJSON(toolChoice3) {
    return JSON.stringify(exports.ToolChoice3$outboundSchema.parse(toolChoice3));
}
/** @internal */
exports.CreateResponseToolChoiceType$outboundSchema = z.nativeEnum(exports.CreateResponseToolChoiceType);
/** @internal */
exports.CreateResponseToolChoice2$outboundSchema = z.object({
    type: exports.CreateResponseToolChoiceType$outboundSchema,
});
function createResponseToolChoice2ToJSON(createResponseToolChoice2) {
    return JSON.stringify(exports.CreateResponseToolChoice2$outboundSchema.parse(createResponseToolChoice2));
}
/** @internal */
exports.CreateResponseToolChoice1$outboundSchema = z.nativeEnum(exports.CreateResponseToolChoice1);
/** @internal */
exports.CreateResponseToolChoice$outboundSchema = z.union([
    z.lazy(() => exports.ToolChoice3$outboundSchema),
    z.lazy(() => exports.ToolChoice4$outboundSchema),
    z.lazy(() => exports.CreateResponseToolChoice2$outboundSchema),
    exports.CreateResponseToolChoice1$outboundSchema,
]);
function createResponseToolChoiceToJSON(createResponseToolChoice) {
    return JSON.stringify(exports.CreateResponseToolChoice$outboundSchema.parse(createResponseToolChoice));
}
/** @internal */
exports.CreateResponseRequestBody$outboundSchema = z.object({
    model: z.string(),
    metadata: z.record(z.string()).optional(),
    temperature: z.nullable(z.number()).optional(),
    topP: z.nullable(z.number()).optional(),
    previousResponseId: z.nullable(z.string()).optional(),
    instructions: z.nullable(z.string()).optional(),
    reasoning: z.nullable(z.lazy(() => exports.Reasoning$outboundSchema)).optional(),
    thinking: z.nullable(z.union([
        components.ThinkingConfigDisabledSchema$outboundSchema,
        components.ThinkingConfigEnabledSchema$outboundSchema,
        components.ThinkingConfigAdaptiveSchema$outboundSchema,
    ])).optional(),
    maxOutputTokens: z.nullable(z.number().int()).optional(),
    text: z.nullable(z.lazy(() => exports.CreateResponseText$outboundSchema)).optional(),
    input: z.union([
        z.string(),
        z.array(z.union([
            z.lazy(() => exports.CreateResponse23$outboundSchema),
            z.lazy(() => exports.CreateResponse2RouterResponses2$outboundSchema),
            z.lazy(() => exports.Two1$outboundSchema),
        ])),
    ]),
    include: z.nullable(z.array(exports.Include$outboundSchema)).optional(),
    parallelToolCalls: z.nullable(z.boolean()).optional(),
    store: z.nullable(z.boolean().default(true)),
    serviceTier: z.nullable(exports.ServiceTier$outboundSchema).optional(),
    tools: z.array(z.union([
        z.lazy(() => exports.Tools1$outboundSchema),
        z.lazy(() => exports.Tools2$outboundSchema),
        z.lazy(() => exports.Tools3$outboundSchema),
    ])).optional(),
    toolChoice: z.union([
        z.lazy(() => exports.ToolChoice3$outboundSchema),
        z.lazy(() => exports.ToolChoice4$outboundSchema),
        z.lazy(() => exports.CreateResponseToolChoice2$outboundSchema),
        exports.CreateResponseToolChoice1$outboundSchema,
    ]).optional(),
    stream: z.boolean().default(false),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        topP: "top_p",
        previousResponseId: "previous_response_id",
        maxOutputTokens: "max_output_tokens",
        parallelToolCalls: "parallel_tool_calls",
        serviceTier: "service_tier",
        toolChoice: "tool_choice",
    });
});
function createResponseRequestBodyToJSON(createResponseRequestBody) {
    return JSON.stringify(exports.CreateResponseRequestBody$outboundSchema.parse(createResponseRequestBody));
}
/** @internal */
exports.CreateResponseData$inboundSchema = (0, schemas_js_1.collectExtraKeys)(z.object({
    type: z.string(),
}).catchall(z.any()), "additionalProperties", true);
function createResponseDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseData' from JSON`);
}
/** @internal */
exports.CreateResponseRouterResponsesResponseBody$inboundSchema = z.object({
    data: z.string().optional().transform((v, ctx) => {
        if (v === undefined)
            return undefined;
        try {
            return JSON.parse(v);
        }
        catch (err) {
            ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
            return z.NEVER;
        }
    }).pipe(z.lazy(() => exports.CreateResponseData$inboundSchema).optional()),
});
function createResponseRouterResponsesResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseRouterResponsesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseRouterResponsesResponseBody' from JSON`);
}
/** @internal */
exports.CreateResponseObject$inboundSchema = z.nativeEnum(exports.CreateResponseObject);
/** @internal */
exports.CreateResponseStatus$inboundSchema = z.nativeEnum(exports.CreateResponseStatus);
/** @internal */
exports.ErrorT$inboundSchema = z
    .object({
    code: z.string(),
    message: z.string(),
});
function errorFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ErrorT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ErrorT' from JSON`);
}
/** @internal */
exports.Reason$inboundSchema = z
    .nativeEnum(exports.Reason);
/** @internal */
exports.IncompleteDetails$inboundSchema = z.object({
    reason: exports.Reason$inboundSchema,
});
function incompleteDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IncompleteDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IncompleteDetails' from JSON`);
}
/** @internal */
exports.CreateResponseOutputRouterResponsesResponseStatus$inboundSchema = z
    .nativeEnum(exports.CreateResponseOutputRouterResponsesResponseStatus);
/** @internal */
exports.Output4$inboundSchema = z.object({
    id: z.string(),
    type: z.literal("function_call"),
    call_id: z.string(),
    name: z.string(),
    arguments: z.string(),
    status: exports.CreateResponseOutputRouterResponsesResponseStatus$inboundSchema,
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "call_id": "callId",
    });
});
function output4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output4' from JSON`);
}
/** @internal */
exports.CreateResponseOutputRouterResponsesStatus$inboundSchema = z
    .nativeEnum(exports.CreateResponseOutputRouterResponsesStatus);
/** @internal */
exports.Output3$inboundSchema = z.object({
    id: z.string(),
    type: z.literal("file_search_call"),
    status: exports.CreateResponseOutputRouterResponsesStatus$inboundSchema,
    queries: z.array(z.string()).optional(),
    results: z.any().optional(),
});
function output3FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output3' from JSON`);
}
/** @internal */
exports.CreateResponseOutputStatus$inboundSchema = z.nativeEnum(exports.CreateResponseOutputStatus);
/** @internal */
exports.Output2$inboundSchema = z.object({
    id: z.string(),
    type: z.literal("web_search_call"),
    status: exports.CreateResponseOutputStatus$inboundSchema,
});
function output2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output2' from JSON`);
}
/** @internal */
exports.OutputRole$inboundSchema = z
    .nativeEnum(exports.OutputRole);
/** @internal */
exports.OutputStatus$inboundSchema = z.nativeEnum(exports.OutputStatus);
/** @internal */
exports.ContentType$inboundSchema = z
    .nativeEnum(exports.ContentType);
/** @internal */
exports.Annotations2$inboundSchema = z.object({
    type: z.literal("file_citation"),
    index: z.number(),
    file_id: z.string(),
    filename: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "file_id": "fileId",
    });
});
function annotations2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Annotations2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Annotations2' from JSON`);
}
/** @internal */
exports.Annotations1$inboundSchema = z.object({
    type: z.literal("url_citation"),
    start_index: z.number(),
    end_index: z.number(),
    url: z.string(),
    title: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "start_index": "startIndex",
        "end_index": "endIndex",
    });
});
function annotations1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Annotations1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Annotations1' from JSON`);
}
/** @internal */
exports.ContentAnnotations$inboundSchema = z.union([
    z.lazy(() => exports.Annotations1$inboundSchema),
    z.lazy(() => exports.Annotations2$inboundSchema),
]);
function contentAnnotationsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ContentAnnotations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentAnnotations' from JSON`);
}
/** @internal */
exports.Content1$inboundSchema = z.object({
    type: exports.ContentType$inboundSchema,
    text: z.string(),
    annotations: z.array(z.union([
        z.lazy(() => exports.Annotations1$inboundSchema),
        z.lazy(() => exports.Annotations2$inboundSchema),
    ])).optional(),
    logprobs: z.array(z.any()).optional(),
});
function content1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Content1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Content1' from JSON`);
}
/** @internal */
exports.OutputContent$inboundSchema = z.lazy(() => exports.Content1$inboundSchema);
function outputContentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OutputContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputContent' from JSON`);
}
/** @internal */
exports.Output1$inboundSchema = z.object({
    id: z.string(),
    type: z.literal("message"),
    role: exports.OutputRole$inboundSchema,
    status: exports.OutputStatus$inboundSchema,
    content: z.array(z.lazy(() => exports.Content1$inboundSchema)).optional(),
});
function output1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output1' from JSON`);
}
/** @internal */
exports.Output$inboundSchema = z
    .union([
    z.lazy(() => exports.Output1$inboundSchema),
    z.lazy(() => exports.Output2$inboundSchema),
    z.lazy(() => exports.Output3$inboundSchema),
    z.lazy(() => exports.Output4$inboundSchema),
]);
function outputFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output' from JSON`);
}
/** @internal */
exports.CreateResponseInputTokensDetails$inboundSchema = z.object({
    cached_tokens: z.number().int().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "cached_tokens": "cachedTokens",
    });
});
function createResponseInputTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseInputTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseInputTokensDetails' from JSON`);
}
/** @internal */
exports.OutputTokensDetails$inboundSchema = z.object({
    reasoning_tokens: z.number().int().optional(),
    accepted_prediction_tokens: z.number().int().optional(),
    rejected_prediction_tokens: z.number().int().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "reasoning_tokens": "reasoningTokens",
        "accepted_prediction_tokens": "acceptedPredictionTokens",
        "rejected_prediction_tokens": "rejectedPredictionTokens",
    });
});
function outputTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OutputTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputTokensDetails' from JSON`);
}
/** @internal */
exports.CreateResponseUsage$inboundSchema = z.object({
    input_tokens: z.number().optional(),
    output_tokens: z.number().optional(),
    total_tokens: z.number().optional(),
    input_tokens_details: z.lazy(() => exports.CreateResponseInputTokensDetails$inboundSchema).optional(),
    output_tokens_details: z.lazy(() => exports.OutputTokensDetails$inboundSchema)
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "input_tokens": "inputTokens",
        "output_tokens": "outputTokens",
        "total_tokens": "totalTokens",
        "input_tokens_details": "inputTokensDetails",
        "output_tokens_details": "outputTokensDetails",
    });
});
function createResponseUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseUsage' from JSON`);
}
/** @internal */
exports.CreateResponseToolChoiceRouterResponsesResponseType$inboundSchema = z.nativeEnum(exports.CreateResponseToolChoiceRouterResponsesResponseType);
/** @internal */
exports.CreateResponseToolChoiceFunction$inboundSchema = z.object({
    name: z.string(),
});
function createResponseToolChoiceFunctionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseToolChoiceFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseToolChoiceFunction' from JSON`);
}
/** @internal */
exports.CreateResponseToolChoiceRouterResponses2$inboundSchema = z.object({
    type: exports.CreateResponseToolChoiceRouterResponsesResponseType$inboundSchema,
    function: z.lazy(() => exports.CreateResponseToolChoiceFunction$inboundSchema),
});
function createResponseToolChoiceRouterResponses2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseToolChoiceRouterResponses2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseToolChoiceRouterResponses2' from JSON`);
}
/** @internal */
exports.CreateResponseToolChoiceRouterResponses1$inboundSchema = z
    .nativeEnum(exports.CreateResponseToolChoiceRouterResponses1);
/** @internal */
exports.CreateResponseRouterResponsesToolChoice$inboundSchema = z.union([
    z.lazy(() => exports.CreateResponseToolChoiceRouterResponses2$inboundSchema),
    exports.CreateResponseToolChoiceRouterResponses1$inboundSchema,
]);
function createResponseRouterResponsesToolChoiceFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseRouterResponsesToolChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseRouterResponsesToolChoice' from JSON`);
}
/** @internal */
exports.ToolsRanker$inboundSchema = z
    .nativeEnum(exports.ToolsRanker);
/** @internal */
exports.ToolsRankingOptions$inboundSchema = z.object({
    ranker: exports.ToolsRanker$inboundSchema.default("auto"),
    score_threshold: z.number().default(0),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "score_threshold": "scoreThreshold",
    });
});
function toolsRankingOptionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ToolsRankingOptions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolsRankingOptions' from JSON`);
}
/** @internal */
exports.CreateResponseTools3$inboundSchema = z.object({
    type: z.literal("file_search"),
    vector_store_ids: z.array(z.string()).optional(),
    max_num_results: z.number().int().default(20),
    filters: z.any().optional(),
    ranking_options: z.lazy(() => exports.ToolsRankingOptions$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "vector_store_ids": "vectorStoreIds",
        "max_num_results": "maxNumResults",
        "ranking_options": "rankingOptions",
    });
});
function createResponseTools3FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseTools3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseTools3' from JSON`);
}
/** @internal */
exports.ToolsSearchContextSize$inboundSchema = z.nativeEnum(exports.ToolsSearchContextSize);
/** @internal */
exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType$inboundSchema = z.nativeEnum(exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType);
/** @internal */
exports.ToolsUserLocation$inboundSchema = z.object({
    type: exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBodyType$inboundSchema
        .optional(),
    city: z.nullable(z.string()).optional(),
    country: z.string().optional(),
    region: z.nullable(z.string()).optional(),
    timezone: z.nullable(z.string()).optional(),
});
function toolsUserLocationFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ToolsUserLocation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolsUserLocation' from JSON`);
}
/** @internal */
exports.CreateResponseTools2$inboundSchema = z.object({
    type: z.literal("web_search_preview"),
    domains: z.array(z.string()).optional(),
    search_context_size: exports.ToolsSearchContextSize$inboundSchema.default("medium"),
    user_location: z.lazy(() => exports.ToolsUserLocation$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "search_context_size": "searchContextSize",
        "user_location": "userLocation",
    });
});
function createResponseTools2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseTools2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseTools2' from JSON`);
}
/** @internal */
exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type$inboundSchema = z.nativeEnum(exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type);
/** @internal */
exports.ToolsProperties$inboundSchema = (0, schemas_js_1.collectExtraKeys)(z.object({
    type: z.string(),
    description: z.string().optional(),
    enum: z.array(z.string()).optional(),
}).catchall(z.any()), "additionalProperties", true);
function toolsPropertiesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ToolsProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolsProperties' from JSON`);
}
/** @internal */
exports.CreateResponseToolsParameters$inboundSchema = z.object({
    type: exports.CreateResponseToolsRouterResponsesResponse200ApplicationJSONResponseBody1Type$inboundSchema,
    properties: z.record(z.lazy(() => exports.ToolsProperties$inboundSchema)),
    required: z.array(z.string()).optional(),
    additionalProperties: z.boolean().optional(),
});
function createResponseToolsParametersFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseToolsParameters$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseToolsParameters' from JSON`);
}
/** @internal */
exports.CreateResponseTools1$inboundSchema = z.object({
    type: z.literal("function"),
    name: z.string(),
    description: z.nullable(z.string()).optional(),
    parameters: z.lazy(() => exports.CreateResponseToolsParameters$inboundSchema),
    strict: z.boolean().default(true),
});
function createResponseTools1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseTools1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseTools1' from JSON`);
}
/** @internal */
exports.CreateResponseRouterResponsesTools$inboundSchema = z.union([
    z.lazy(() => exports.CreateResponseTools1$inboundSchema),
    z.lazy(() => exports.CreateResponseTools2$inboundSchema),
    z.lazy(() => exports.CreateResponseTools3$inboundSchema),
]);
function createResponseRouterResponsesToolsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseRouterResponsesTools$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseRouterResponsesTools' from JSON`);
}
/** @internal */
exports.CreateResponseReasoning$inboundSchema = z.object({
    effort: z.nullable(z.string()).optional(),
    summary: z.nullable(z.string()).optional(),
});
function createResponseReasoningFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseReasoning$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseReasoning' from JSON`);
}
/** @internal */
exports.CreateResponseFormat3$inboundSchema = z.object({
    type: z.literal("json_schema"),
    name: z.string(),
    description: z.string().optional(),
    schema: z.record(z.any()),
    strict: z.boolean().default(true),
});
function createResponseFormat3FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseFormat3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseFormat3' from JSON`);
}
/** @internal */
exports.CreateResponseFormat2$inboundSchema = z.object({
    type: z.literal("json_object"),
});
function createResponseFormat2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseFormat2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseFormat2' from JSON`);
}
/** @internal */
exports.CreateResponseFormat1$inboundSchema = z.object({
    type: z.literal("text"),
});
function createResponseFormat1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseFormat1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseFormat1' from JSON`);
}
/** @internal */
exports.CreateResponseRouterResponsesFormat$inboundSchema = z.union([
    z.lazy(() => exports.CreateResponseFormat1$inboundSchema),
    z.lazy(() => exports.CreateResponseFormat2$inboundSchema),
    z.lazy(() => exports.CreateResponseFormat3$inboundSchema),
]);
function createResponseRouterResponsesFormatFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseRouterResponsesFormat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseRouterResponsesFormat' from JSON`);
}
/** @internal */
exports.CreateResponseRouterResponsesText$inboundSchema = z.object({
    format: z.union([
        z.lazy(() => exports.CreateResponseFormat1$inboundSchema),
        z.lazy(() => exports.CreateResponseFormat2$inboundSchema),
        z.lazy(() => exports.CreateResponseFormat3$inboundSchema),
    ]),
});
function createResponseRouterResponsesTextFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseRouterResponsesText$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseRouterResponsesText' from JSON`);
}
/** @internal */
exports.Truncation$inboundSchema = z
    .nativeEnum(exports.Truncation);
/** @internal */
exports.CreateResponseServiceTier$inboundSchema = z.nativeEnum(exports.CreateResponseServiceTier);
/** @internal */
exports.CreateResponseResponseBody$inboundSchema = z.object({
    id: z.string(),
    object: exports.CreateResponseObject$inboundSchema,
    created_at: z.number(),
    status: exports.CreateResponseStatus$inboundSchema,
    error: z.nullable(z.lazy(() => exports.ErrorT$inboundSchema)),
    incomplete_details: z.nullable(z.lazy(() => exports.IncompleteDetails$inboundSchema)),
    model: z.string(),
    instructions: z.nullable(z.string()).optional(),
    output: z.array(z.union([
        z.lazy(() => exports.Output1$inboundSchema),
        z.lazy(() => exports.Output2$inboundSchema),
        z.lazy(() => exports.Output3$inboundSchema),
        z.lazy(() => exports.Output4$inboundSchema),
    ])),
    output_text: z.nullable(z.string()).optional(),
    usage: z.lazy(() => exports.CreateResponseUsage$inboundSchema).optional(),
    temperature: z.nullable(z.number()).optional(),
    top_p: z.nullable(z.number()).optional(),
    max_output_tokens: z.nullable(z.number().int()).optional(),
    parallel_tool_calls: z.boolean(),
    previous_response_id: z.nullable(z.string()).optional(),
    metadata: z.record(z.string()).optional(),
    tool_choice: z.union([
        z.lazy(() => exports.CreateResponseToolChoiceRouterResponses2$inboundSchema),
        exports.CreateResponseToolChoiceRouterResponses1$inboundSchema,
    ]).optional(),
    tools: z.array(z.union([
        z.lazy(() => exports.CreateResponseTools1$inboundSchema),
        z.lazy(() => exports.CreateResponseTools2$inboundSchema),
        z.lazy(() => exports.CreateResponseTools3$inboundSchema),
    ])).optional(),
    reasoning: z.nullable(z.lazy(() => exports.CreateResponseReasoning$inboundSchema))
        .optional(),
    store: z.boolean().optional(),
    text: z.lazy(() => exports.CreateResponseRouterResponsesText$inboundSchema)
        .optional(),
    truncation: z.nullable(exports.Truncation$inboundSchema.default("disabled")),
    user: z.nullable(z.string()).optional(),
    service_tier: z.nullable(exports.CreateResponseServiceTier$inboundSchema).optional(),
    background: z.nullable(z.boolean()).optional(),
    top_logprobs: z.nullable(z.number().int()).optional(),
    logprobs: z.nullable(z.boolean()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "created_at": "createdAt",
        "incomplete_details": "incompleteDetails",
        "output_text": "outputText",
        "top_p": "topP",
        "max_output_tokens": "maxOutputTokens",
        "parallel_tool_calls": "parallelToolCalls",
        "previous_response_id": "previousResponseId",
        "tool_choice": "toolChoice",
        "service_tier": "serviceTier",
        "top_logprobs": "topLogprobs",
    });
});
function createResponseResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseResponseBody' from JSON`);
}
/** @internal */
exports.CreateResponseResponse$inboundSchema = z.union([
    z.lazy(() => exports.CreateResponseResponseBody$inboundSchema),
    z.instanceof((ReadableStream))
        .transform(stream => {
        return new event_streams_js_1.EventStream(stream, rawEvent => {
            if (rawEvent.data === "[DONE]")
                return { done: true, value: undefined };
            return {
                done: false,
                value: z.lazy(() => exports.CreateResponseRouterResponsesResponseBody$inboundSchema).parse(rawEvent),
            };
        }, { dataRequired: false });
    }),
]);
function createResponseResponseFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateResponseResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponseResponse' from JSON`);
}
//# sourceMappingURL=createresponse.js.map