daishi-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/generated.d.ts +870 -0
- package/dist/generated.js +367 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +165 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arkeous LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# daishi-sdk
|
|
2
|
+
|
|
3
|
+
Typed client for the Studio API of [Daishi](https://daishi.ai), an independent agent testing and evaluation platform: save scenarios, launch runs, series batches and paired experiments on your own model keys, and read the scored results.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install daishi-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Node 18 or later, or any runtime with `fetch`. No dependencies.
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
In the [Studio](https://daishi.ai/studio), open **Account > Developer**, create an access token with **runs: launch and cancel** ticked, and export it:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
export DAISHI_TOKEN=dsk_... # macOS, Linux
|
|
17
|
+
$env:DAISHI_TOKEN = "dsk_..." # Windows PowerShell
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Daishi } from 'daishi-sdk';
|
|
22
|
+
|
|
23
|
+
const daishi = new Daishi(); // reads DAISHI_TOKEN
|
|
24
|
+
|
|
25
|
+
const { run } = await daishi.launch({
|
|
26
|
+
scenario_id: 'daishi:famine-v1',
|
|
27
|
+
roster: [{ model: '<provider>/<model>' }, { model: '<provider>/<model>' }],
|
|
28
|
+
max_spend_usd: 5,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const { results } = await daishi.waitForRun(run.run_id);
|
|
32
|
+
for (const agent of results?.agents ?? []) console.log(agent.name, agent.fitness_index, agent.grade);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Seats play on the provider keys stored on your account. Every plan can read and validate; creating, launching and cancelling need a paid plan.
|
|
36
|
+
|
|
37
|
+
## What it does
|
|
38
|
+
|
|
39
|
+
- **One method per API operation**, named after its operation id: `getRun`, `listRuns`, `launch`, `cancel`, `getBatch`, `createScenario`, `createExperiment`, `getExperiment` and the rest. Request bodies and responses are typed from the API's OpenAPI document.
|
|
40
|
+
- **Errors** throw `DaishiError` with the API's `code` (`unknown_run`, `plan_quota`, ...), `status`, `message`, `retryAfterSeconds`, and `docs`, a link to what the code means.
|
|
41
|
+
- **Retries** are safe by construction. A 429 is retried after the seconds its `Retry-After` header names, and a cancel refused with `run_launching` after a pause, on any method, because the server refused before doing anything. A gateway error or a dropped connection is retried on GET only, so a write is never sent twice.
|
|
42
|
+
- **Waiting.** `waitForRun`, `waitForBatch` and `waitForExperiment` poll every 30 seconds until the run, batch or experiment ends. `waitForRun` also waits for a finished run's results, which arrive when the match archives. Pass `signal: AbortSignal.timeout(ms)` for a deadline. To be told instead of asking, set up [run-end notices](https://daishi.ai/docs/developer/runs#run-end-notices).
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { Daishi, DaishiError } from 'daishi-sdk';
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
await daishi.getRun('run_...');
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (err instanceof DaishiError && err.code === 'unknown_run') console.log(err.docs);
|
|
51
|
+
else throw err;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Options
|
|
56
|
+
|
|
57
|
+
| Option | Default | |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `token` | `DAISHI_TOKEN` | A Studio access token (`dsk_...`). |
|
|
60
|
+
| `baseUrl` | `https://daishi.ai/api/v1` | |
|
|
61
|
+
| `maxRetries` | `3` | `0` turns retrying off. |
|
|
62
|
+
| `timeoutMs` | `60000` | Per attempt. |
|
|
63
|
+
| `fetch` | the global `fetch` | |
|
|
64
|
+
|
|
65
|
+
## Types
|
|
66
|
+
|
|
67
|
+
Every schema in the API is exported: `Run`, `RunResults`, `Scenario`, `Skill`, `BatchReport`, `Experiment`, `ExperimentReport`, the request bodies (`RunBody`, `ScenarioBody`, `ExperimentBody`, ...), and `ErrorCode`. Fields whose shape follows the scenario, the provider or the meter are `JsonObject`. A few operations (`me`, `usage`, the estimates, logs and invites) answer `JsonObject` until the API types them; `runLog` answers the log's NDJSON text.
|
|
68
|
+
|
|
69
|
+
## Docs
|
|
70
|
+
|
|
71
|
+
[Developer docs](https://daishi.ai/docs/developer) and the [API reference](https://daishi.ai/docs/developer/rest).
|
|
72
|
+
|
|
73
|
+
MIT licensed.
|