@@ -618,6 +618,42 @@ func LookupPrompt(g *Genkit, name string) ai.Prompt {
618618 return ai .LookupPrompt (g .reg , name )
619619}
620620
621+ // DefineDataPrompt creates a new [ai.DataPrompt] with strongly-typed input and output.
622+ // It automatically infers input schema from the In type parameter and configures
623+ // output schema and JSON format from the Out type parameter (unless Out is string).
624+ //
625+ // Example:
626+ //
627+ // type GeoInput struct {
628+ // Country string `json:"country"`
629+ // }
630+ //
631+ // type GeoOutput struct {
632+ // Capital string `json:"capital"`
633+ // }
634+ //
635+ // capitalPrompt := genkit.DefineDataPrompt[GeoInput, GeoOutput, *ai.ModelResponseChunk](g, "findCapital",
636+ // ai.WithModelName("googleai/gemini-2.5-flash"),
637+ // ai.WithSystem("You are a helpful geography assistant."),
638+ // ai.WithPrompt("What is the capital of {{country}}?"),
639+ // )
640+ //
641+ // output, resp, err := capitalPrompt.Execute(ctx, GeoInput{Country: "France"})
642+ // if err != nil {
643+ // log.Fatalf("Execute failed: %v", err)
644+ // }
645+ // fmt.Printf("Capital: %s\n", output.Capital)
646+ func DefineDataPrompt [In , Out , Stream any ](g * Genkit , name string , opts ... ai.PromptOption ) * ai.DataPrompt [In , Out , Stream ] {
647+ return ai .DefineDataPrompt [In , Out , Stream ](g .reg , name , opts ... )
648+ }
649+
650+ // LookupDataPrompt looks up a prompt by name and wraps it with type information.
651+ // This is useful for wrapping prompts loaded from .prompt files with strong types.
652+ // It returns nil if the prompt was not found.
653+ func LookupDataPrompt [In , Out , Stream any ](g * Genkit , name string ) * ai.DataPrompt [In , Out , Stream ] {
654+ return ai .LookupDataPrompt [In , Out , Stream ](g .reg , name )
655+ }
656+
621657// DefineSchema defines a named JSON schema and registers it in the registry.
622658//
623659// Registered schemas can be referenced by name in prompts (both `.prompt` files
0 commit comments