/* * 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 { CodeInterpreterOutputLogs, CodeInterpreterOutputLogs$inboundSchema, CodeInterpreterOutputLogs$Outbound, CodeInterpreterOutputLogs$outboundSchema, } from "./codeinterpreteroutputlogs.js"; export const CodeInterpreterOutputStatus = { InProgress: "in_progress", Interpreting: "interpreting", Completed: "completed", Incomplete: "incomplete", Failed: "failed", } as const; export type CodeInterpreterOutputStatus = ClosedEnum< typeof CodeInterpreterOutputStatus >; export type CodeInterpreterOutput = { /** * The unique ID of the code interpreter tool call. */ id: string; /** * The code executed by the code interpreter. */ code: string; /** * The ID of the container used to run the code. */ containerId: string; /** * The outputs generated by the code interpreter, such as logs or images. */ outputs: Array; type?: "code_interpreter_output" | undefined; status?: CodeInterpreterOutputStatus | undefined; }; /** @internal */ export const CodeInterpreterOutputStatus$inboundSchema: z.ZodNativeEnum< typeof CodeInterpreterOutputStatus > = z.nativeEnum(CodeInterpreterOutputStatus); /** @internal */ export const CodeInterpreterOutputStatus$outboundSchema: z.ZodNativeEnum< typeof CodeInterpreterOutputStatus > = CodeInterpreterOutputStatus$inboundSchema; /** @internal */ export const CodeInterpreterOutput$inboundSchema: z.ZodType< CodeInterpreterOutput, z.ZodTypeDef, unknown > = z.object({ id: z.string(), code: z.string(), container_id: z.string(), outputs: z.array(CodeInterpreterOutputLogs$inboundSchema), type: z.literal("code_interpreter_output").default("code_interpreter_output"), status: CodeInterpreterOutputStatus$inboundSchema.default("completed"), }).transform((v) => { return remap$(v, { "container_id": "containerId", }); }); /** @internal */ export type CodeInterpreterOutput$Outbound = { id: string; code: string; container_id: string; outputs: Array; type: "code_interpreter_output"; status: string; }; /** @internal */ export const CodeInterpreterOutput$outboundSchema: z.ZodType< CodeInterpreterOutput$Outbound, z.ZodTypeDef, CodeInterpreterOutput > = z.object({ id: z.string(), code: z.string(), containerId: z.string(), outputs: z.array(CodeInterpreterOutputLogs$outboundSchema), type: z.literal("code_interpreter_output").default( "code_interpreter_output" as const, ), status: CodeInterpreterOutputStatus$outboundSchema.default("completed"), }).transform((v) => { return remap$(v, { containerId: "container_id", }); }); export function codeInterpreterOutputToJSON( codeInterpreterOutput: CodeInterpreterOutput, ): string { return JSON.stringify( CodeInterpreterOutput$outboundSchema.parse(codeInterpreterOutput), ); } export function codeInterpreterOutputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CodeInterpreterOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CodeInterpreterOutput' from JSON`, ); }