Documentação

SDK de JavaScript

SDK de JavaScript e TypeScript para o TypeSafe AI.

Início rápido

Instale o SDK (Node.js 20 ou mais recente):

npm install @typesafe-ai/sdk

Defina TYPESAFE_API_KEY no seu ambiente e depois crie e use o cliente:

import { choice, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();
const response = await client.systemOne({
  state: { document: "I was charged twice. Please fix this ASAP." },
  questions: {
    category: choice("What is this ticket about?", {
      billing: null,
      technical: null,
      other: null,
    }),
  },
});

console.log(response.answers.category.choice);

Os tipos de resposta são inferidos das suas perguntas. O pacote inclui ESM, CommonJS e declarações de TypeScript.

Documentação

Saiba o que o TypeSafe pode fazer na documentação do TypeSafe. Consulte o cliente e os tipos do SDK para ver as opções e os valores padrão da API.