/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type ChatCompletionMessageToolCallFunction = { /** * The name of the function to call. */ name: string; /** * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. */ arguments: string; }; /** @internal */ export const ChatCompletionMessageToolCallFunction$inboundSchema: z.ZodType< ChatCompletionMessageToolCallFunction, z.ZodTypeDef, unknown > = z.object({ name: z.string(), arguments: z.string(), }); /** @internal */ export type ChatCompletionMessageToolCallFunction$Outbound = { name: string; arguments: string; }; /** @internal */ export const ChatCompletionMessageToolCallFunction$outboundSchema: z.ZodType< ChatCompletionMessageToolCallFunction$Outbound, z.ZodTypeDef, ChatCompletionMessageToolCallFunction > = z.object({ name: z.string(), arguments: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ChatCompletionMessageToolCallFunction$ { /** @deprecated use `ChatCompletionMessageToolCallFunction$inboundSchema` instead. */ export const inboundSchema = ChatCompletionMessageToolCallFunction$inboundSchema; /** @deprecated use `ChatCompletionMessageToolCallFunction$outboundSchema` instead. */ export const outboundSchema = ChatCompletionMessageToolCallFunction$outboundSchema; /** @deprecated use `ChatCompletionMessageToolCallFunction$Outbound` instead. */ export type Outbound = ChatCompletionMessageToolCallFunction$Outbound; } export function chatCompletionMessageToolCallFunctionToJSON( chatCompletionMessageToolCallFunction: ChatCompletionMessageToolCallFunction, ): string { return JSON.stringify( ChatCompletionMessageToolCallFunction$outboundSchema.parse( chatCompletionMessageToolCallFunction, ), ); } export function chatCompletionMessageToolCallFunctionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChatCompletionMessageToolCallFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatCompletionMessageToolCallFunction' from JSON`, ); }