0.0.0-alpha.31 • Published 7 months ago

gqlpt v0.0.0-alpha.31

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

gqlpt.dev/docs

npm version License: MIT

npm.io

Image showing the online playground for gqlpt.dev. GQLPT is a npm package that allows you to generate GraphQL queries from plain text using AI.

Installation

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

npm install gqlpt @gqlpt/adapter-openai

Usage

import { AdapterOpenAI } from "@gqlpt/adapter-openai";

import { GQLPTClient } from "gqlpt";

const typeDefs = /* GraphQL */ `
  type User {
    id: ID!
    name: String!
  }

  type Query {
    user(id: ID!): User
  }
`;

const client = new GQLPTClient({
  typeDefs,
  adapter: new AdapterOpenAI({
    apiKey: process.env.OPENAI_API_KEY,
  }),
});

async function main() {
  await client.connect();

  const query = "Find users by id 1";

  const response = await client.generateQueryAndVariables(query);

  console.log(response);
  /*
    {
        query: 'query ($id: ID!) {\n  user(id: $id) {\n    id\n    name\n  }\n}',
        variables: { id: '1' }
    }
  */
}

main();

License

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

0.0.0-alpha.31

7 months ago

0.0.0-alpha.30

8 months ago

0.0.0-alpha.29

8 months ago

0.0.0-alpha.28

8 months ago

0.0.0-alpha.19

11 months ago

0.0.0-alpha.18

11 months ago

0.0.0-alpha.13

11 months ago

0.0.0-alpha.12

11 months ago

0.0.0-alpha.11

11 months ago

0.0.0-alpha.10

11 months ago

0.0.0-alpha.17

11 months ago

0.0.0-alpha.16

11 months ago

0.0.0-alpha.15

11 months ago

0.0.0-alpha.14

11 months ago

0.0.0-alpha.7

11 months ago

0.0.0-alpha.8

11 months ago

0.0.0-alpha.6

11 months ago

0.0.0-alpha.9

11 months ago

0.0.0-alpha.20

11 months ago

0.0.0-alpha.24

9 months ago

0.0.0-alpha.23

9 months ago

0.0.0-alpha.22

10 months ago

0.0.0-alpha.21

11 months ago

0.0.0-alpha.27

9 months ago

0.0.0-alpha.26

9 months ago

0.0.0-alpha.25

9 months ago

0.0.0-alpha.5

2 years ago

0.0.0-alpha.3

2 years ago

0.0.0-alpha.4

2 years ago

0.0.0-alpha.2

2 years ago

0.0.0-alpha.1

2 years ago

0.0.0-alpha.0

2 years ago