/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const HostedToolChoiceType = { FileSearch: "file_search", WebSearchPreview: "web_search_preview", ComputerUsePreview: "computer_use_preview", CodeInterpreter: "code_interpreter", ImageGeneration: "image_generation", } as const; export type HostedToolChoiceType = ClosedEnum; /** * Hosted tool choice: Forces a specific built-in hosted tool type. */ export type HostedToolChoice = { type: HostedToolChoiceType; }; /** @internal */ export const HostedToolChoiceType$inboundSchema: z.ZodNativeEnum< typeof HostedToolChoiceType > = z.nativeEnum(HostedToolChoiceType); /** @internal */ export const HostedToolChoiceType$outboundSchema: z.ZodNativeEnum< typeof HostedToolChoiceType > = HostedToolChoiceType$inboundSchema; /** @internal */ export const HostedToolChoice$inboundSchema: z.ZodType< HostedToolChoice, z.ZodTypeDef, unknown > = z.object({ type: HostedToolChoiceType$inboundSchema, }); /** @internal */ export type HostedToolChoice$Outbound = { type: string; }; /** @internal */ export const HostedToolChoice$outboundSchema: z.ZodType< HostedToolChoice$Outbound, z.ZodTypeDef, HostedToolChoice > = z.object({ type: HostedToolChoiceType$outboundSchema, }); export function hostedToolChoiceToJSON( hostedToolChoice: HostedToolChoice, ): string { return JSON.stringify( HostedToolChoice$outboundSchema.parse(hostedToolChoice), ); } export function hostedToolChoiceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HostedToolChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HostedToolChoice' from JSON`, ); }