/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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"; import { FileSearchResult, FileSearchResult$inboundSchema, FileSearchResult$Outbound, FileSearchResult$outboundSchema, } from "./filesearchresult.js"; export const FileSearchToolCallWithIdStatus = { InProgress: "in_progress", Searching: "searching", Completed: "completed", Incomplete: "incomplete", Failed: "failed", } as const; export type FileSearchToolCallWithIdStatus = ClosedEnum< typeof FileSearchToolCallWithIdStatus >; /** * File search call item: A tool-call record for semantic file search, including query terms, status, and optional results. */ export type FileSearchToolCallWithId = { type: "file_search_call"; /** * The unique ID of the message. */ id: string; queries: Array; status: FileSearchToolCallWithIdStatus; results?: Array | undefined; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const FileSearchToolCallWithIdStatus$inboundSchema: z.ZodNativeEnum< typeof FileSearchToolCallWithIdStatus > = z.nativeEnum(FileSearchToolCallWithIdStatus); /** @internal */ export const FileSearchToolCallWithIdStatus$outboundSchema: z.ZodNativeEnum< typeof FileSearchToolCallWithIdStatus > = FileSearchToolCallWithIdStatus$inboundSchema; /** @internal */ export const FileSearchToolCallWithId$inboundSchema: z.ZodType< FileSearchToolCallWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("file_search_call"), id: z.string(), queries: z.array(z.string()), status: FileSearchToolCallWithIdStatus$inboundSchema, results: z.array(FileSearchResult$inboundSchema).optional(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "response_id": "responseId", }); }); /** @internal */ export type FileSearchToolCallWithId$Outbound = { type: "file_search_call"; id: string; queries: Array; status: string; results?: Array | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const FileSearchToolCallWithId$outboundSchema: z.ZodType< FileSearchToolCallWithId$Outbound, z.ZodTypeDef, FileSearchToolCallWithId > = z.object({ type: z.literal("file_search_call"), id: z.string(), queries: z.array(z.string()), status: FileSearchToolCallWithIdStatus$outboundSchema, results: z.array(FileSearchResult$outboundSchema).optional(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { responseId: "response_id", }); }); export function fileSearchToolCallWithIdToJSON( fileSearchToolCallWithId: FileSearchToolCallWithId, ): string { return JSON.stringify( FileSearchToolCallWithId$outboundSchema.parse(fileSearchToolCallWithId), ); } export function fileSearchToolCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FileSearchToolCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileSearchToolCallWithId' from JSON`, ); }