/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * Optional feedback rating. Can be 'thumbs_up' for positive feedback or 'thumbs_down' for negative feedback. */ export const Rating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * Optional feedback rating. Can be 'thumbs_up' for positive feedback or 'thumbs_down' for negative feedback. */ export type Rating = ClosedEnum; /** * Request parameters for creating feedback. Allows users to rate and comment on model outputs. */ export type CreateFeedbackRequest = { /** * Request ID to associate this feedback with. Use chat completion request ID or response ID. */ id: string; /** * Optional feedback rating. Can be 'thumbs_up' for positive feedback or 'thumbs_down' for negative feedback. */ rating?: Rating | undefined; /** * Optional detailed feedback description. Use this to provide specific comments, suggestions, or explain the rating (max 2000 characters). */ description?: string | undefined; }; /** @internal */ export const Rating$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Rating); /** @internal */ export const Rating$outboundSchema: z.ZodNativeEnum = Rating$inboundSchema; /** @internal */ export const CreateFeedbackRequest$inboundSchema: z.ZodType< CreateFeedbackRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), rating: Rating$inboundSchema.optional(), description: z.string().optional(), }); /** @internal */ export type CreateFeedbackRequest$Outbound = { id: string; rating?: string | undefined; description?: string | undefined; }; /** @internal */ export const CreateFeedbackRequest$outboundSchema: z.ZodType< CreateFeedbackRequest$Outbound, z.ZodTypeDef, CreateFeedbackRequest > = z.object({ id: z.string(), rating: Rating$outboundSchema.optional(), description: z.string().optional(), }); export function createFeedbackRequestToJSON( createFeedbackRequest: CreateFeedbackRequest, ): string { return JSON.stringify( CreateFeedbackRequest$outboundSchema.parse(createFeedbackRequest), ); } export function createFeedbackRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateFeedbackRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFeedbackRequest' from JSON`, ); }