문서

JavaScript SDK

TypeSafe AI를 위한 JavaScript 및 TypeScript SDK입니다.

빠른 시작

SDK를 설치합니다(Node.js 20 이상):

npm install @typesafe-ai/sdk

환경에 TYPESAFE_API_KEY를 설정한 다음 클라이언트를 생성하고 사용합니다:

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);

답변 타입은 질문에서 추론됩니다. 이 패키지에는 ESM, CommonJS, TypeScript 선언이 포함되어 있습니다.

문서

TypeSafe로 무엇을 할 수 있는지는 TypeSafe 문서에서 확인하십시오. API 옵션과 기본값은 SDK의 클라이언트와 타입을 참조하십시오.