Node CLI tool to generate JSON schemas from JSON samples and documentation using GPT.
- Infer base JSON schema from JSON samples as any other JSON schema generator.
- Retrieve documentation about the JSON samples using embeddings.
- Give GPT the inferred base JSON schema plus documentation.
- Add instruction / prompt for guiding GPT. Maybe have intermediary calls from GPT itself (chain) to retrieve the additional data instead of writing that into the code.
Can you give me a JSON schema for Cart Create event from Shopify?
Function calls to retrieve Cart Create samples and Cart Create docs
Combines the output from function call with altered prompt / instruction
Sure, here it is a JSON schema for Cart Create:
{
"type": "object",
"properties": {
"etc": {}
}
}
Parses output and stores in database
This is mostly inspired from the need of generating JSON schemas for data validation, but also GPT uses schemas for function calling so this can expand on that and generate schemas not only from JSON samples, but also from different contexts, like file directories or config files.
- Node JS with TypeScript
- Zod for validation / schema generation.
- Either Postgres or Redis for storage and vector search.
- OpenAI SDK.