@gqlpt/adapter-anthropic
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-alpha.33 • Public • Published

@gqlpt/adapter-anthropic

GQLPT

Installation

npm install gqlpt @gqlpt/adapter-anthropic

Usage

import { AdapterAnthropic } from "@gqlpt/adapter-anthropic";

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 AdapterAnthropic({
    apiKey: process.env.ANTHROPIC_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();

Docs

gqlpt.dev/docs/adapters/anthropic

License

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

Package Sidebar

Install

npm i @gqlpt/adapter-anthropic

Weekly Downloads

56

Version

0.0.0-alpha.33

License

MIT

Unpacked Size

11.7 kB

Total Files

7

Last publish

Collaborators

  • danstarns