-
Notifications
You must be signed in to change notification settings - Fork 623
Closed
Labels
featureNew feature or requestNew feature or request
Description
This feature would actually be usable throughout Genkit but would be most useful for Dotprompt. If Genkit supported a schema registry, it would be much easier to share schema definitions between text prompt files and code.
export const MySchema = defineSchema("MySchema", z.object({
field1: z.string(),
field2: z.string().optional(),
}));Once a schema has been registered, it can be used inside a Dotprompt file:
---
model: vertexai/gemini-1.5-flash-preview
input:
schema:
name: string
output:
schema: MySchema
---
Hello, {{name}}! This prompt outputs MySchema.Then when using the prompt, we can pass the schema to a generic argument:
import { MySchema } from "./schemas";
const myPrompt = prompt<{name: string}, typeof MySchema>("myPrompt");This would be a big win for prompts that end up with complex output schemas that then have to essentially be defined twice.
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request