@typesafe-ai/sdk 0.0.0-bootstrap.0 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -7
- package/dist/index.cjs +734 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +415 -0
- package/dist/index.d.mts +415 -0
- package/dist/index.mjs +714 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +70 -8
package/README.md
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
|
-
# TypeSafe JavaScript SDK
|
|
1
|
+
# TypeSafe AI JavaScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JavaScript and TypeScript SDK for [TypeSafe AI](https://typesafe.ai).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
`@typesafe-ai/sdk`. It contains no SDK implementation and is not ready for use.
|
|
5
|
+
## Quickstart
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
will replace this README with installation instructions and API documentation.
|
|
7
|
+
Install the SDK (Node.js 20 or newer):
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```sh
|
|
10
|
+
npm install @typesafe-ai/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Set `TYPESAFE_API_KEY` in your environment, then create and use the client:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { choice, TypeSafeClient } from "@typesafe-ai/sdk";
|
|
17
|
+
|
|
18
|
+
const client = new TypeSafeClient();
|
|
19
|
+
const response = await client.systemOne({
|
|
20
|
+
state: { document: "I was charged twice. Please fix this ASAP." },
|
|
21
|
+
questions: {
|
|
22
|
+
category: choice("What is this ticket about?", {
|
|
23
|
+
billing: null,
|
|
24
|
+
technical: null,
|
|
25
|
+
other: null,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log(response.answers.category.choice);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Answer types are inferred from your questions. The package includes ESM, CommonJS, and TypeScript declarations.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
Learn what TypeSafe can do in the [TypeSafe docs](https://docs.typesafe.ai/).
|
|
38
|
+
See the SDK's [client](src/client.ts) and [types](src/types.ts) for API options and defaults.
|