/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Status, Status$inboundSchema, Status$outboundSchema, } from "./status.js"; /** * Function call item: A call to a function tool, including function name and JSON-string arguments. */ export type FunctionToolCall = { type: "function_call"; arguments: string; callId: string; name: string; id?: string | undefined; /** * The processing status of an individual item. 'in_progress' means currently processing, 'completed' means finished successfully, 'incomplete' means processing stopped before completion. */ status?: Status | undefined; }; /** @internal */ export const FunctionToolCall$inboundSchema: z.ZodType< FunctionToolCall, z.ZodTypeDef, unknown > = z.object({ type: z.literal("function_call"), arguments: z.string(), call_id: z.string(), name: z.string(), id: z.string().optional(), status: Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "call_id": "callId", }); }); /** @internal */ export type FunctionToolCall$Outbound = { type: "function_call"; arguments: string; call_id: string; name: string; id?: string | undefined; status?: string | undefined; }; /** @internal */ export const FunctionToolCall$outboundSchema: z.ZodType< FunctionToolCall$Outbound, z.ZodTypeDef, FunctionToolCall > = z.object({ type: z.literal("function_call"), arguments: z.string(), callId: z.string(), name: z.string(), id: z.string().optional(), status: Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { callId: "call_id", }); }); export function functionToolCallToJSON( functionToolCall: FunctionToolCall, ): string { return JSON.stringify( FunctionToolCall$outboundSchema.parse(functionToolCall), ); } export function functionToolCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FunctionToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FunctionToolCall' from JSON`, ); }