Closed
Description
It would be helpful if we could constrain the generated output to valid JSON.
A promptJSON
function might make sense as the API. When used, it would constrain the model generation to valid JSON (potentially also parsing that into an object).
session.promptJson("List five cities and their populations, respond in jsdoc type format: {name: string, population: number}[]");
This would primarily be helpful to force the model to avoid extra description text such as:
Sure, your five cities are:
[{ "name": "New York...
Possibly in the future, a schema could be supplied that would further constrain output to match that schema (edit: requested in #35). Regardless of that, a general restriction to valid JSON would be very helpful.
Metadata
Metadata
Assignees
Labels
No labels