Jev API

Szybki start Jev API

Użyj oficjalnego SDK JavaScript na serwerze, ustaw klucz API TypeSafe i wyślij pierwsze typowane żądanie.

1. Zanim zaczniesz

Potrzebujesz Node.js 20+ i klucza API TypeSafe. Klucz powinien pozostać na serwerze.

2. Zainstaluj oficjalne SDK

npm install @typesafe-ai/sdk

Potrzebujesz Node.js 20+ i klucza API TypeSafe. Klucz powinien pozostać na serwerze.

3. Wyślij pierwszą decyzję

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

Ten przykład klasyfikuje wiadomość do zamkniętego zbioru kategorii.

4. Czym jest State?

State zawiera informacje, które model ma ocenić. Znane fakty przekazuj w jawnych polach.

5. Projektowanie pytań

Choice wybiera, Noul zwraca prawdopodobieństwo tak, a Score używa zdefiniowanej skali.

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

const client = new TypeSafeClient();
const response = await client.systemOne({
  state: { message: "Our checkout failed twice and launch is tomorrow." },
  questions: {
    route: choice("Which queue should own this?", {
      billing: "Payment and charge issues",
      technical: "Product or integration failures",
      other: "Everything else",
    }),
    urgent: noul("Is this time-sensitive?"),
    severity: score("How severe is the impact?", [
      "Low", "Moderate", "High", "Critical",
    ]),
  },
});

Częste błędy

Nie proś Jev o swobodny tekst, gdy odpowiedzi nie są zdefiniowane. Nigdy nie umieszczaj klucza API w przeglądarce.

Oficjalne źródło

Oficjalne źródło cen TypeSafe ↗

Następnie wypróbuj Playground, przykłady, kalkulator lub porównanie Jev z ChatGPT. Jev PlaygroundWzorceCennik