Code Monkey home page Code Monkey logo

node-schema-gen's Introduction

node-schema-gen

Intro

Node CLI tool to generate JSON schemas from JSON samples and documentation using GPT.

  1. Infer base JSON schema from JSON samples as any other JSON schema generator.
  2. Retrieve documentation about the JSON samples using embeddings.
  3. Give GPT the inferred base JSON schema plus documentation.
  4. 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.

Example:

User

Can you give me a JSON schema for Cart Create event from Shopify?

GPT

Function calls to retrieve Cart Create samples and Cart Create docs

Node / System

Combines the output from function call with altered prompt / instruction

GPT

Sure, here it is a JSON schema for Cart Create:

{
    "type": "object",
    "properties": {
        "etc": {}
    }
}

Node / System

Parses output and stores in database

Flow

diagram-01

Notes

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.

Tech Stack

  1. Node JS with TypeScript
  2. Zod for validation / schema generation.
  3. Either Postgres or Redis for storage and vector search.
  4. OpenAI SDK.

node-schema-gen's People

Contributors

albertov5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.