/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { VectorSearchResult, VectorSearchResult$inboundSchema, VectorSearchResult$Outbound, VectorSearchResult$outboundSchema, } from "./vectorsearchresult.js"; /** * A page of search results from the vector store. */ export type VectorStoreSearchResults = { /** * The object type, which is always 'vector_store.search_results.page'. */ object: "vector_store.search_results.page"; /** * The query that was used for the search. */ searchQuery: string; /** * Array of search results. */ data: Array; /** * Whether there are more results available. */ hasMore: boolean; /** * Cursor for the next page of results, or null if no more results. */ nextPage: string | null; }; /** @internal */ export const VectorStoreSearchResults$inboundSchema: z.ZodType< VectorStoreSearchResults, z.ZodTypeDef, unknown > = z.object({ object: z.literal("vector_store.search_results.page"), search_query: z.string(), data: z.array(VectorSearchResult$inboundSchema), has_more: z.boolean(), next_page: z.nullable(z.string()), }).transform((v) => { return remap$(v, { "search_query": "searchQuery", "has_more": "hasMore", "next_page": "nextPage", }); }); /** @internal */ export type VectorStoreSearchResults$Outbound = { object: "vector_store.search_results.page"; search_query: string; data: Array; has_more: boolean; next_page: string | null; }; /** @internal */ export const VectorStoreSearchResults$outboundSchema: z.ZodType< VectorStoreSearchResults$Outbound, z.ZodTypeDef, VectorStoreSearchResults > = z.object({ object: z.literal("vector_store.search_results.page"), searchQuery: z.string(), data: z.array(VectorSearchResult$outboundSchema), hasMore: z.boolean(), nextPage: z.nullable(z.string()), }).transform((v) => { return remap$(v, { searchQuery: "search_query", hasMore: "has_more", nextPage: "next_page", }); }); export function vectorStoreSearchResultsToJSON( vectorStoreSearchResults: VectorStoreSearchResults, ): string { return JSON.stringify( VectorStoreSearchResults$outboundSchema.parse(vectorStoreSearchResults), ); } export function vectorStoreSearchResultsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VectorStoreSearchResults$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VectorStoreSearchResults' from JSON`, ); }