teren de test TypeSafe: docs offline + script de proba
Separat de produsele ROA. docs/ = documentatia oficiala descarcata ca Markdown (111 pagini), reluabila cu update_docs.sh. typesafe_test.py face un apel cu cate o intrebare din fiecare tip (choice/noul/score) pe o linie de factura de furnizor. Cheia API se ia din TYPESAFE_API_KEY, nu se versioneaza. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KHLUSsKP99G6ebv2fFUKQV
This commit is contained in:
42
docs/sdk/javascript.md
Normal file
42
docs/sdk/javascript.md
Normal file
@@ -0,0 +1,42 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# JavaScript SDK
|
||||
|
||||
JavaScript and TypeScript SDK for [TypeSafe AI](https://typesafe.ai).
|
||||
|
||||
## Quickstart
|
||||
|
||||
Install the SDK (Node.js 20 or newer):
|
||||
|
||||
```sh theme={null}
|
||||
npm install @typesafe-ai/sdk
|
||||
```
|
||||
|
||||
Set `TYPESAFE_API_KEY` in your environment, then create and use the client:
|
||||
|
||||
```ts theme={null}
|
||||
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);
|
||||
```
|
||||
|
||||
Answer types are inferred from your questions. The package includes ESM, CommonJS, and TypeScript declarations.
|
||||
|
||||
## Documentation
|
||||
|
||||
Learn what TypeSafe can do in the [TypeSafe docs](https://docs.typesafe.ai/).
|
||||
See the SDK's [client](https://github.com/typesafe-ai/typesafe-sdk-js/blob/v0.6.0/src/client.ts) and [types](https://github.com/typesafe-ai/typesafe-sdk-js/blob/v0.6.0/src/types.ts) for API options and defaults.
|
||||
Reference in New Issue
Block a user