/* * 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"; import { Reasoning, Reasoning$inboundSchema, Reasoning$Outbound, Reasoning$outboundSchema, } from "./reasoning.js"; import { Tool, Tool$inboundSchema, Tool$Outbound, Tool$outboundSchema, } from "./tool.js"; export type RequestT = { /** * The text used to generate the response. Generally a question or a query. */ input: string; /** * The instructions inserted in the prompt. For this agent, the instructions are injected during search related steps. */ instructions?: string | null | undefined; /** * The tools available to the agent. Currently the only tool is retrieve. The `default` partition is used by default unless an other partition is specified. */ tools?: Array | undefined; /** * The model to use for the agent. Currently the only model is deep-search. */ model?: "deep-search" | undefined; reasoning?: Reasoning | undefined; /** * Whether to stream the response */ stream?: boolean | undefined; }; /** @internal */ export const RequestT$inboundSchema: z.ZodType< RequestT, z.ZodTypeDef, unknown > = z.object({ input: z.string(), instructions: z.nullable(z.string()).optional(), tools: z.array(Tool$inboundSchema).optional(), model: z.literal("deep-search").default("deep-search"), reasoning: Reasoning$inboundSchema.optional(), stream: z.boolean().default(false), }); /** @internal */ export type RequestT$Outbound = { input: string; instructions?: string | null | undefined; tools?: Array | undefined; model: "deep-search"; reasoning?: Reasoning$Outbound | undefined; stream: boolean; }; /** @internal */ export const RequestT$outboundSchema: z.ZodType< RequestT$Outbound, z.ZodTypeDef, RequestT > = z.object({ input: z.string(), instructions: z.nullable(z.string()).optional(), tools: z.array(Tool$outboundSchema).optional(), model: z.literal("deep-search").default("deep-search" as const), reasoning: Reasoning$outboundSchema.optional(), stream: z.boolean().default(false), }); export function requestToJSON(requestT: RequestT): string { return JSON.stringify(RequestT$outboundSchema.parse(requestT)); } export function requestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RequestT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequestT' from JSON`, ); }