/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Request parameters for text classification. The model will analyze the text and assign it to one of the provided labels. */ export type ClassificationRequest = { /** * ID of the model to use for classification. You can use provider:model format or just the model name with a default provider. */ model: string; /** * The text content to classify. Must not be empty. */ text: string; /** * Array of possible classification labels. Must contain at least 2 labels. The model will choose one of these labels to assign to the text. */ labels: Array; /** * Optional custom system prompt to guide the classification. Use this to provide additional context or instructions to the model about how to perform the classification. */ prompt?: string | undefined; }; /** @internal */ export const ClassificationRequest$inboundSchema: z.ZodType< ClassificationRequest, z.ZodTypeDef, unknown > = z.object({ model: z.string(), text: z.string(), labels: z.array(z.string()), prompt: z.string().optional(), }); /** @internal */ export type ClassificationRequest$Outbound = { model: string; text: string; labels: Array; prompt?: string | undefined; }; /** @internal */ export const ClassificationRequest$outboundSchema: z.ZodType< ClassificationRequest$Outbound, z.ZodTypeDef, ClassificationRequest > = z.object({ model: z.string(), text: z.string(), labels: z.array(z.string()), prompt: z.string().optional(), }); export function classificationRequestToJSON( classificationRequest: ClassificationRequest, ): string { return JSON.stringify( ClassificationRequest$outboundSchema.parse(classificationRequest), ); } export function classificationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ClassificationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ClassificationRequest' from JSON`, ); }