import { ModelArgument } from '@genkit-ai/ai/model'; import { ToolArgument } from '@genkit-ai/ai/tool'; import { z } from '@genkit-ai/core'; import { Registry } from '@genkit-ai/core/registry'; import { JSONSchema } from '@genkit-ai/core/schema'; /** * 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. */ /** * Metadata for a prompt. */ interface PromptMetadata { /** The name of the prompt. */ name?: string; /** Description (intent) of the prompt, used when prompt passed as tool to an LLM. */ description?: string; /** The variant name for the prompt. */ variant?: string; /** The name of the model to use for this prompt, e.g. `vertexai/gemini-1.0-pro` */ model?: ModelArgument; /** Names of tools (registered separately) to allow use of in this prompt. */ tools?: ToolArgument[]; /** Model configuration. Not all models support all options. */ config?: z.infer; input?: { /** Defines the default input variable values to use if none are provided. */ default?: any; /** Zod schema defining the input variables. */ schema?: Input; /** * Defines the input variables that can be passed into the template in JSON schema form. * If not supplied, any object will be accepted. `{type: "object"}` is defaulted if not * supplied. */ jsonSchema?: JSONSchema; }; /** Defines the expected model output format. */ output?: { /** Desired output format for this prompt. */ format?: 'json' | 'text' | 'media'; /** Zod schema defining the output structure (cannot be specified with non-json format). */ schema?: z.ZodTypeAny; /** JSON schema of desired output (cannot be specified with non-json format). */ jsonSchema?: JSONSchema; }; /** Arbitrary metadata to be used by code, tools, and libraries. */ metadata?: Record; } /** * Formal schema for prompt YAML frontmatter. */ declare const PromptFrontmatterSchema: z.ZodObject<{ name: z.ZodOptional; description: z.ZodOptional; variant: z.ZodOptional; model: z.ZodOptional; tools: z.ZodOptional>; config: z.ZodOptional; temperature: z.ZodOptional; maxOutputTokens: z.ZodOptional; topK: z.ZodOptional; topP: z.ZodOptional; stopSequences: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ version: z.ZodOptional; temperature: z.ZodOptional; maxOutputTokens: z.ZodOptional; topK: z.ZodOptional; topP: z.ZodOptional; stopSequences: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ version: z.ZodOptional; temperature: z.ZodOptional; maxOutputTokens: z.ZodOptional; topK: z.ZodOptional; topP: z.ZodOptional; stopSequences: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>>; input: z.ZodOptional>; output: z.ZodOptional>; schema: z.ZodOptional; }, "strip", z.ZodTypeAny, { schema?: unknown; format?: "json" | "text" | "media" | undefined; }, { schema?: unknown; format?: "json" | "text" | "media" | undefined; }>>; metadata: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name?: string | undefined; description?: string | undefined; variant?: string | undefined; model?: string | undefined; tools?: string[] | undefined; config?: z.objectOutputType<{ version: z.ZodOptional; temperature: z.ZodOptional; maxOutputTokens: z.ZodOptional; topK: z.ZodOptional; topP: z.ZodOptional; stopSequences: z.ZodOptional>; }, z.ZodTypeAny, "passthrough"> | undefined; input?: { default?: any; schema?: unknown; } | undefined; output?: { schema?: unknown; format?: "json" | "text" | "media" | undefined; } | undefined; metadata?: Record | undefined; }, { name?: string | undefined; description?: string | undefined; variant?: string | undefined; model?: string | undefined; tools?: string[] | undefined; config?: z.objectInputType<{ version: z.ZodOptional; temperature: z.ZodOptional; maxOutputTokens: z.ZodOptional; topK: z.ZodOptional; topP: z.ZodOptional; stopSequences: z.ZodOptional>; }, z.ZodTypeAny, "passthrough"> | undefined; input?: { default?: any; schema?: unknown; } | undefined; output?: { schema?: unknown; format?: "json" | "text" | "media" | undefined; } | undefined; metadata?: Record | undefined; }>; type PromptFrontmatter = z.infer; declare function toMetadata(registry: Registry, attributes: unknown): Partial; declare function toFrontmatter(md: PromptMetadata): PromptFrontmatter; export { type PromptFrontmatter, PromptFrontmatterSchema, type PromptMetadata, toFrontmatter, toMetadata };