/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: cd070a80f1f6 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ToolSets, ToolSets$inboundSchema, ToolSets$Outbound, ToolSets$outboundSchema, } from "./toolsets.js"; /** * Name of the agent. */ export const AgentEnum = { /** * Integrates with your company's knowledge. This will soon be deprecated in favor of the FAST and ADVANCED `agent` values */ Default: "DEFAULT", /** * Communicates directly with the LLM. This will soon be deprecated in favor of the FAST and ADVANCED `agent` values */ Gpt: "GPT", /** * Uses both company and web knowledge. This will soon be deprecated in favor of the FAST and ADVANCED `agent` values */ Universal: "UNIVERSAL", /** * Uses an agent powered by the agentic engine that responds faster but may have lower quality results. Requires the agentic engine to be enabled in the deployment. */ Fast: "FAST", /** * Uses an agent powered by the agentic engine that thinks for longer and potentially makes more LLM calls to return higher quality results. Requires the agentic engine to be enabled in the deployment. */ Advanced: "ADVANCED", /** * Uses an agent powered by the agentic engine that routes between reasoning efforts based on the question and context. */ Auto: "AUTO", } as const; /** * Name of the agent. */ export type AgentEnum = OpenEnum; /** * Top level modes to run GleanChat in. */ export const Mode = { /** * Used if no mode supplied. */ Default: "DEFAULT", /** * Deprecated. */ Quick: "QUICK", } as const; /** * Top level modes to run GleanChat in. */ export type Mode = OpenEnum; /** * Describes the agent that executes the request. */ export type AgentConfig = { /** * Name of the agent. */ agent?: AgentEnum | undefined; /** * The types of tools that the agent is allowed to use. Only works with FAST and ADVANCED `agent` values */ toolSets?: ToolSets | undefined; /** * Top level modes to run GleanChat in. */ mode?: Mode | undefined; /** * Whether the agent should create an image. */ useImageGeneration?: boolean | undefined; }; /** @internal */ export const AgentEnum$inboundSchema: z.ZodType< AgentEnum, z.ZodTypeDef, unknown > = openEnums.inboundSchema(AgentEnum); /** @internal */ export const AgentEnum$outboundSchema: z.ZodType< string, z.ZodTypeDef, AgentEnum > = openEnums.outboundSchema(AgentEnum); /** @internal */ export const Mode$inboundSchema: z.ZodType = openEnums.inboundSchema(Mode); /** @internal */ export const Mode$outboundSchema: z.ZodType = openEnums.outboundSchema(Mode); /** @internal */ export const AgentConfig$inboundSchema: z.ZodType< AgentConfig, z.ZodTypeDef, unknown > = z.object({ agent: AgentEnum$inboundSchema.optional(), toolSets: ToolSets$inboundSchema.optional(), mode: Mode$inboundSchema.optional(), useImageGeneration: z.boolean().optional(), }); /** @internal */ export type AgentConfig$Outbound = { agent?: string | undefined; toolSets?: ToolSets$Outbound | undefined; mode?: string | undefined; useImageGeneration?: boolean | undefined; }; /** @internal */ export const AgentConfig$outboundSchema: z.ZodType< AgentConfig$Outbound, z.ZodTypeDef, AgentConfig > = z.object({ agent: AgentEnum$outboundSchema.optional(), toolSets: ToolSets$outboundSchema.optional(), mode: Mode$outboundSchema.optional(), useImageGeneration: z.boolean().optional(), }); export function agentConfigToJSON(agentConfig: AgentConfig): string { return JSON.stringify(AgentConfig$outboundSchema.parse(agentConfig)); } export function agentConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentConfig' from JSON`, ); }