genkit
genkit copied to clipboard
[JS] [Go] Add option for finer control over output conformance message/schema passing
Describe the bug Today, both JS and Go runtimes append a message to the prompt stating that the output should be in JSON format following this schema: <verbose JSON schema> when setting an output schema in the request.
Ideally, Dotprompt would support a placeholder (e.g. {{outputSchema format="json"}} or similar) so that the user has control over the format of the schema, where to put it in the prompt, put it in a language other than English, etc. JSON schema is also very verbose and uses up a lot of tokens and confuses the LLM for complex schemas so it would be nice to have other formats that may be less precise but work for most situations.