/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: df1371f4f11e */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FunctionCall, FunctionCall$inboundSchema, FunctionCall$Outbound, FunctionCall$outboundSchema, } from "./functioncall.js"; export type ToolCall = { id?: string | undefined; type?: string | undefined; function: FunctionCall; index?: number | undefined; }; /** @internal */ export const ToolCall$inboundSchema: z.ZodType = z.object({ id: z.string().default("null"), type: z.string().optional(), function: FunctionCall$inboundSchema, index: z.int().default(0), }); /** @internal */ export type ToolCall$Outbound = { id: string; type?: string | undefined; function: FunctionCall$Outbound; index: number; }; /** @internal */ export const ToolCall$outboundSchema: z.ZodType = z .object({ id: z.string().default("null"), type: z.string().optional(), function: FunctionCall$outboundSchema, index: z.int().default(0), }); export function toolCallToJSON(toolCall: ToolCall): string { return JSON.stringify(ToolCall$outboundSchema.parse(toolCall)); } export function toolCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolCall' from JSON`, ); }