Skip to content

rocket-connect/gqlpt

Repository files navigation

GQLPT

GQLPT

Leverage AI to generate GraphQL queries from plain text.

npm version License: MIT

Installation

https://www.npmjs.com/package/gqlpt

npm install gqlpt

Usage

import { GQLPTClient } from "gqlpt";

const typeDefs = `
    type User {
        id: ID!
        name: String!
        email: String!
    }

    type Query {
        users(name: String): [User!]!
    }
`;

const gqlpt = new GQLPTClient({
  apiKey: "chatgpt-api-key",
  typeDefs,
});

await gqlpt.connect();

const response = await gqlpt.generate("Get all users where name is dan");

/*
    query {
        users(name: "dan") {
            id
            name
            email
        }
    }
*/

FAQs

  1. I'm seeing the error "429 - Rate limit reached for requests" on making requests.

This error is related to sending too many requests to OpenAI, and them trying to rate-limit you. Try limiting the requests to gqlpt, or upgrading to a paid OpenAI API plan. In case of persistent errors, create an issue with us, or reach out to OpenAI support for OpenAI related errors.

License

MIT - Rocket Connect - https://github.com/rocket-connect