/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: a61605b53401
 */

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";

export type EmbeddingResponseData = {
  object?: string | undefined;
  embedding?: Array<number> | undefined;
  index?: number | undefined;
};

/** @internal */
export const EmbeddingResponseData$inboundSchema: z.ZodType<
  EmbeddingResponseData,
  unknown
> = z.object({
  object: z.string().optional(),
  embedding: z.array(z.number()).optional(),
  index: z.int().optional(),
});

export function embeddingResponseDataFromJSON(
  jsonString: string,
): SafeParseResult<EmbeddingResponseData, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => EmbeddingResponseData$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'EmbeddingResponseData' from JSON`,
  );
}
