UNPKG

@genkit-ai/ai

Version:

Genkit AI framework generative AI APIs.

1,437 lines (1,435 loc) 431 kB
import { z } from '@genkit-ai/core'; /** * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Zod schema of message part. */ declare const PartSchema: z.ZodUnion<[z.ZodObject<{ media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { text: z.ZodString; }, "strip", z.ZodTypeAny, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { media: z.ZodObject<{ contentType: z.ZodOptional<z.ZodString>; url: z.ZodString; }, "strip", z.ZodTypeAny, { url: string; contentType?: string | undefined; }, { url: string; contentType?: string | undefined; }>; }, "strip", z.ZodTypeAny, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolRequest: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; input: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; input?: unknown; ref?: string | undefined; }, { name: string; input?: unknown; ref?: string | undefined; }>; }, "strip", z.ZodTypeAny, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolResponse: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; output: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; ref?: string | undefined; output?: unknown; }, { name: string; ref?: string | undefined; output?: unknown; }>; }, "strip", z.ZodTypeAny, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { data: z.ZodUnknown; }, "strip", z.ZodTypeAny, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { custom: z.ZodRecord<z.ZodString, z.ZodAny>; }, "strip", z.ZodTypeAny, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; resource: z.ZodOptional<z.ZodNever>; } & { reasoning: z.ZodString; }, "strip", z.ZodTypeAny, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; } & { resource: z.ZodObject<{ uri: z.ZodString; }, "strip", z.ZodTypeAny, { uri: string; }, { uri: string; }>; }, "strip", z.ZodTypeAny, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }>]>; /** * Message part. */ type Part = z.infer<typeof PartSchema>; /** * Zod schema of a message role. */ declare const RoleSchema: z.ZodEnum<["system", "user", "model", "tool"]>; /** * Message role. */ type Role = z.infer<typeof RoleSchema>; /** * Zod schema of a message. */ declare const MessageSchema: z.ZodObject<{ role: z.ZodEnum<["system", "user", "model", "tool"]>; content: z.ZodArray<z.ZodUnion<[z.ZodObject<{ media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { text: z.ZodString; }, "strip", z.ZodTypeAny, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { media: z.ZodObject<{ contentType: z.ZodOptional<z.ZodString>; url: z.ZodString; }, "strip", z.ZodTypeAny, { url: string; contentType?: string | undefined; }, { url: string; contentType?: string | undefined; }>; }, "strip", z.ZodTypeAny, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolRequest: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; input: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; input?: unknown; ref?: string | undefined; }, { name: string; input?: unknown; ref?: string | undefined; }>; }, "strip", z.ZodTypeAny, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolResponse: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; output: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; ref?: string | undefined; output?: unknown; }, { name: string; ref?: string | undefined; output?: unknown; }>; }, "strip", z.ZodTypeAny, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { data: z.ZodUnknown; }, "strip", z.ZodTypeAny, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { custom: z.ZodRecord<z.ZodString, z.ZodAny>; }, "strip", z.ZodTypeAny, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; resource: z.ZodOptional<z.ZodNever>; } & { reasoning: z.ZodString; }, "strip", z.ZodTypeAny, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; } & { resource: z.ZodObject<{ uri: z.ZodString; }, "strip", z.ZodTypeAny, { uri: string; }, { uri: string; }>; }, "strip", z.ZodTypeAny, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }>]>, "many">; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { content: ({ text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; } | { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; })[]; role: "model" | "tool" | "system" | "user"; metadata?: Record<string, unknown> | undefined; }, { content: ({ text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; } | { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; })[]; role: "model" | "tool" | "system" | "user"; metadata?: Record<string, unknown> | undefined; }>; /** * Model message data. */ type MessageData = z.infer<typeof MessageSchema>; /** * Zod schema of model info metadata. */ declare const ModelInfoSchema: z.ZodObject<{ /** Acceptable names for this model (e.g. different versions). */ versions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; /** Friendly label for this model (e.g. "Google AI - Gemini Pro") */ label: z.ZodOptional<z.ZodString>; /** Model Specific configuration. */ configSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; /** Supported model capabilities. */ supports: z.ZodOptional<z.ZodObject<{ /** Model can process historical messages passed with a prompt. */ multiturn: z.ZodOptional<z.ZodBoolean>; /** Model can process media as part of the prompt (multimodal input). */ media: z.ZodOptional<z.ZodBoolean>; /** Model can perform tool calls. */ tools: z.ZodOptional<z.ZodBoolean>; /** Model can accept messages with role "system". */ systemRole: z.ZodOptional<z.ZodBoolean>; /** Model can output this type of data. */ output: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; /** Model supports output in these content types. */ contentType: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; /** Model can natively support document-based context grounding. */ context: z.ZodOptional<z.ZodBoolean>; /** Model can natively support constrained generation. */ constrained: z.ZodOptional<z.ZodEnum<["none", "all", "no-tools"]>>; /** Model supports controlling tool choice, e.g. forced tool calling. */ toolChoice: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { media?: boolean | undefined; contentType?: string[] | undefined; output?: string[] | undefined; context?: boolean | undefined; multiturn?: boolean | undefined; tools?: boolean | undefined; systemRole?: boolean | undefined; constrained?: "none" | "all" | "no-tools" | undefined; toolChoice?: boolean | undefined; }, { media?: boolean | undefined; contentType?: string[] | undefined; output?: string[] | undefined; context?: boolean | undefined; multiturn?: boolean | undefined; tools?: boolean | undefined; systemRole?: boolean | undefined; constrained?: "none" | "all" | "no-tools" | undefined; toolChoice?: boolean | undefined; }>>; /** At which stage of development this model is. * - `featured` models are recommended for general use. * - `stable` models are well-tested and reliable. * - `unstable` models are experimental and may change. * - `legacy` models are no longer recommended for new projects. * - `deprecated` models are deprecated by the provider and may be removed in future versions. */ stage: z.ZodOptional<z.ZodEnum<["featured", "stable", "unstable", "legacy", "deprecated"]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; supports?: { media?: boolean | undefined; contentType?: string[] | undefined; output?: string[] | undefined; context?: boolean | undefined; multiturn?: boolean | undefined; tools?: boolean | undefined; systemRole?: boolean | undefined; constrained?: "none" | "all" | "no-tools" | undefined; toolChoice?: boolean | undefined; } | undefined; configSchema?: Record<string, any> | undefined; versions?: string[] | undefined; stage?: "featured" | "stable" | "unstable" | "legacy" | "deprecated" | undefined; }, { label?: string | undefined; supports?: { media?: boolean | undefined; contentType?: string[] | undefined; output?: string[] | undefined; context?: boolean | undefined; multiturn?: boolean | undefined; tools?: boolean | undefined; systemRole?: boolean | undefined; constrained?: "none" | "all" | "no-tools" | undefined; toolChoice?: boolean | undefined; } | undefined; configSchema?: Record<string, any> | undefined; versions?: string[] | undefined; stage?: "featured" | "stable" | "unstable" | "legacy" | "deprecated" | undefined; }>; /** * Model info metadata. */ type ModelInfo = z.infer<typeof ModelInfoSchema>; /** * Zod schema of a tool definition. */ declare const ToolDefinitionSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>; outputSchema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, "strip", z.ZodTypeAny, { name: string; description: string; metadata?: Record<string, any> | undefined; inputSchema?: Record<string, any> | null | undefined; outputSchema?: Record<string, any> | null | undefined; }, { name: string; description: string; metadata?: Record<string, any> | undefined; inputSchema?: Record<string, any> | null | undefined; outputSchema?: Record<string, any> | null | undefined; }>; /** * Tool definition. */ type ToolDefinition = z.infer<typeof ToolDefinitionSchema>; /** * Configuration parameter descriptions. */ declare const GenerationCommonConfigDescriptions: { temperature: string; maxOutputTokens: string; topK: string; topP: string; }; /** * Zod schema of a common config object. */ declare const GenerationCommonConfigSchema: z.ZodObject<{ version: z.ZodOptional<z.ZodString>; temperature: z.ZodOptional<z.ZodNumber>; maxOutputTokens: z.ZodOptional<z.ZodNumber>; topK: z.ZodOptional<z.ZodNumber>; topP: z.ZodOptional<z.ZodNumber>; stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ version: z.ZodOptional<z.ZodString>; temperature: z.ZodOptional<z.ZodNumber>; maxOutputTokens: z.ZodOptional<z.ZodNumber>; topK: z.ZodOptional<z.ZodNumber>; topP: z.ZodOptional<z.ZodNumber>; stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ version: z.ZodOptional<z.ZodString>; temperature: z.ZodOptional<z.ZodNumber>; maxOutputTokens: z.ZodOptional<z.ZodNumber>; topK: z.ZodOptional<z.ZodNumber>; topP: z.ZodOptional<z.ZodNumber>; stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, z.ZodTypeAny, "passthrough">>; /** * Common config object. */ type GenerationCommonConfig = typeof GenerationCommonConfigSchema; /** * Zod schema of output config. */ declare const OutputConfigSchema: z.ZodObject<{ format: z.ZodOptional<z.ZodString>; schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; constrained: z.ZodOptional<z.ZodBoolean>; contentType: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { contentType?: string | undefined; constrained?: boolean | undefined; format?: string | undefined; schema?: Record<string, any> | undefined; }, { contentType?: string | undefined; constrained?: boolean | undefined; format?: string | undefined; schema?: Record<string, any> | undefined; }>; /** * Output config. */ type OutputConfig = z.infer<typeof OutputConfigSchema>; /** ModelRequestSchema represents the parameters that are passed to a model when generating content. */ declare const ModelRequestSchema: z.ZodObject<{ messages: z.ZodArray<z.ZodObject<{ role: z.ZodEnum<["system", "user", "model", "tool"]>; content: z.ZodArray<z.ZodUnion<[z.ZodObject<{ media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { text: z.ZodString; }, "strip", z.ZodTypeAny, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { media: z.ZodObject<{ contentType: z.ZodOptional<z.ZodString>; url: z.ZodString; }, "strip", z.ZodTypeAny, { url: string; contentType?: string | undefined; }, { url: string; contentType?: string | undefined; }>; }, "strip", z.ZodTypeAny, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolRequest: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; input: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; input?: unknown; ref?: string | undefined; }, { name: string; input?: unknown; ref?: string | undefined; }>; }, "strip", z.ZodTypeAny, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { toolResponse: z.ZodObject<{ ref: z.ZodOptional<z.ZodString>; name: z.ZodString; output: z.ZodOptional<z.ZodUnknown>; }, "strip", z.ZodTypeAny, { name: string; ref?: string | undefined; output?: unknown; }, { name: string; ref?: string | undefined; output?: unknown; }>; }, "strip", z.ZodTypeAny, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { data: z.ZodUnknown; }, "strip", z.ZodTypeAny, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; resource: z.ZodOptional<z.ZodNever>; } & { custom: z.ZodRecord<z.ZodString, z.ZodAny>; }, "strip", z.ZodTypeAny, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }, { custom: Record<string, any>; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; resource: z.ZodOptional<z.ZodNever>; } & { reasoning: z.ZodString; }, "strip", z.ZodTypeAny, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }, { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; }>, z.ZodObject<{ text: z.ZodOptional<z.ZodNever>; media: z.ZodOptional<z.ZodNever>; toolRequest: z.ZodOptional<z.ZodNever>; toolResponse: z.ZodOptional<z.ZodNever>; data: z.ZodOptional<z.ZodUnknown>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; reasoning: z.ZodOptional<z.ZodNever>; } & { resource: z.ZodObject<{ uri: z.ZodString; }, "strip", z.ZodTypeAny, { uri: string; }, { uri: string; }>; }, "strip", z.ZodTypeAny, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }, { resource: { uri: string; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; }>]>, "many">; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { content: ({ text: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { media: { url: string; contentType?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { reasoning: string; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse?: undefined; data?: unknown; resource?: undefined; } | { toolRequest: { name: string; input?: unknown; ref?: string | undefined; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolResponse?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { toolResponse: { name: string; ref?: string | undefined; output?: unknown; }; custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; data?: unknown; reasoning?: undefined; resource?: undefined; } | { custom?: Record<string, unknown> | undefined; metadata?: Record<string, unknown> | undefined; text?: undefined; media?: undefined; toolRequest?: undefined; toolResponse