/* * 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 HostedToolDefinitionType = { FileSearch: "file_search", WebSearchPreview: "web_search_preview", ComputerUsePreview: "computer_use_preview", CodeInterpreter: "code_interpreter", ImageGeneration: "image_generation", } as const; export type HostedToolDefinitionType = ClosedEnum< typeof HostedToolDefinitionType >; /** * Hosted tool definition: Shorthand hosted-tool selector for built-in tool types. This is a compatibility form that overlaps with the detailed per-tool schemas. */ export type HostedToolDefinition = { type: HostedToolDefinitionType; }; /** @internal */ export const HostedToolDefinitionType$inboundSchema: z.ZodNativeEnum< typeof HostedToolDefinitionType > = z.nativeEnum(HostedToolDefinitionType); /** @internal */ export const HostedToolDefinitionType$outboundSchema: z.ZodNativeEnum< typeof HostedToolDefinitionType > = HostedToolDefinitionType$inboundSchema; /** @internal */ export const HostedToolDefinition$inboundSchema: z.ZodType< HostedToolDefinition, z.ZodTypeDef, unknown > = z.object({ type: HostedToolDefinitionType$inboundSchema, }); /** @internal */ export type HostedToolDefinition$Outbound = { type: string; }; /** @internal */ export const HostedToolDefinition$outboundSchema: z.ZodType< HostedToolDefinition$Outbound, z.ZodTypeDef, HostedToolDefinition > = z.object({ type: HostedToolDefinitionType$outboundSchema, }); export function hostedToolDefinitionToJSON( hostedToolDefinition: HostedToolDefinition, ): string { return JSON.stringify( HostedToolDefinition$outboundSchema.parse(hostedToolDefinition), ); } export function hostedToolDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HostedToolDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HostedToolDefinition' from JSON`, ); }