Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rocket-connect/gqlpt
Leverage AI to generate GraphQL queries from plain text.
https://github.com/rocket-connect/gqlpt
ai anthropic artificial-intelligence autogenerated chatgpt codegen graphql openai plaintext prompt query text text-to-sql translate translation turn
Last synced: 3 days ago
JSON representation
Leverage AI to generate GraphQL queries from plain text.
- Host: GitHub
- URL: https://github.com/rocket-connect/gqlpt
- Owner: rocket-connect
- Created: 2023-02-02T10:48:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-23T03:57:03.000Z (11 days ago)
- Last Synced: 2024-12-23T11:20:31.144Z (11 days ago)
- Topics: ai, anthropic, artificial-intelligence, autogenerated, chatgpt, codegen, graphql, openai, plaintext, prompt, query, text, text-to-sql, translate, translation, turn
- Language: TypeScript
- Homepage: https://gqlpt.dev/docs
- Size: 12 MB
- Stars: 48
- Watchers: 4
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
Awesome Lists containing this project
README
GQLPT
Leverage AI to generate GraphQL queries from plain text.
[gqlpt.dev/docs](https://www.gqlpt.dev/docs)
[![npm version](https://badge.fury.io/js/gqlpt.svg)](https://badge.fury.io/js/gqlpt) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![](https://github.com/rocket-connect/gqlpt/raw/main/docs/screenshot.png)](https://www.gqlpt.dev/)
Image showing the online playground for [gqlpt.dev](https://www.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
```bash
npm install gqlpt @gqlpt/adapter-openai
```## Usage
```ts
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