SDK для JavaScript
SDK для JavaScript и TypeScript для TypeSafe AI.
Быстрый старт
Установите 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. Смотрите клиент и типы SDK, чтобы узнать параметры API и значения по умолчанию.