genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Go] Add `DefineSchema` and add support for referencing in Dotprompt

Open apascal07 opened this issue 8 months ago • 2 comments

Describe the bug You should be able to define a schema in code and let it be referenced in Dotprompt files instead of defining an inline schema.

apascal07 avatar Apr 07 '25 17:04 apascal07

Please confirm my understanding before implementation:

  1. In genkit, add a func DefineSchema(r *registry.Registry, name string, structType any) error{...}
  2. In dotprompt, add a method (dp *Dotprompt) ResolveSchemaReferences(meta PromptMetadata) (PromptMetadata, error) {...}

ihan211 avatar Apr 08 '25 22:04 ihan211

Yes that sounds roughly correct.

apascal07 avatar Apr 09 '25 16:04 apascal07