daishi-sdk 0.2.3 → 0.2.5
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/dist/generated.d.ts +92 -12
- package/dist/generated.js +30 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/generated.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type JsonObject = {
|
|
|
5
5
|
/** The API version these types describe. */
|
|
6
6
|
export declare const API_VERSION = "1.0.0";
|
|
7
7
|
/** Every error code the API documents. */
|
|
8
|
-
export type ErrorCode = 'token_required' | 'scope_required' | 'plan_api' | 'rate_limited' | 'bad_request' | 'bad_scenario' | 'bad_replicates' | 'profile_required' | 'bad_season_ticks' | 'bad_frame' | 'bad_env' | 'too_many_scenarios' | 'unknown_scenario' | 'bad_skill' | 'too_many_skills' | 'unknown_skill' | 'bad_roster' | 'bad_model' | 'bad_name' | 'bad_provider' | 'provider_key_required' | 'openrouter_key_required' | 'openrouter_balance_low' | 'billing_frozen' | 'email_unverified' | 'bad_trials' | 'bad_spend_cap' | 'plan_seats' | 'plan_ticks' | 'plan_series' | 'plan_quota' | 'too_many_runs' | 'run_history_full' | 'seed_not_allowed' | 'unknown_run' | 'unknown_batch' | 'unknown_experiment' | 'experiment_trial' | 'experiment_not_running' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'experiment_world_only' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'experiment_effort_roster' | 'plan_experiment_arms' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'bad_note' | 'note_too_long' | 'run_launching' | 'internal_error';
|
|
8
|
+
export type ErrorCode = 'token_required' | 'scope_required' | 'plan_api' | 'rate_limited' | 'bad_request' | 'bad_scenario' | 'bad_replicates' | 'profile_required' | 'bad_season_ticks' | 'bad_frame' | 'bad_env' | 'too_many_scenarios' | 'unknown_scenario' | 'bad_skill' | 'too_many_skills' | 'unknown_skill' | 'bad_roster' | 'bad_model' | 'bad_name' | 'bad_provider' | 'provider_key_required' | 'openrouter_key_required' | 'openrouter_balance_low' | 'billing_frozen' | 'email_unverified' | 'bad_trials' | 'bad_spend_cap' | 'plan_seats' | 'plan_ticks' | 'plan_series' | 'plan_quota' | 'too_many_runs' | 'run_history_full' | 'seed_not_allowed' | 'unknown_run' | 'unknown_batch' | 'unknown_experiment' | 'experiment_trial' | 'experiment_not_running' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'experiment_world_only' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'bad_design' | 'design_final' | 'design_late' | 'no_design' | 'experiment_effort_roster' | 'plan_experiment_arms' | 'plan_rerun' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'bad_note' | 'note_too_long' | 'run_launching' | 'internal_error';
|
|
9
9
|
export type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
10
10
|
export interface RequestParts {
|
|
11
11
|
query?: Record<string, string | number | boolean | undefined | null>;
|
|
@@ -124,8 +124,8 @@ export interface Experiment {
|
|
|
124
124
|
scenario_id: string;
|
|
125
125
|
trials: number;
|
|
126
126
|
seed_mode: 'vary' | 'pinned';
|
|
127
|
-
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
128
|
-
secondary_metrics: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn'>;
|
|
127
|
+
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
128
|
+
secondary_metrics: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated'>;
|
|
129
129
|
rule: StoppingRule;
|
|
130
130
|
arms: ExperimentArmView[];
|
|
131
131
|
created_at_ms: number;
|
|
@@ -133,6 +133,11 @@ export interface Experiment {
|
|
|
133
133
|
ended_at_ms: number | null;
|
|
134
134
|
verdict: string | null;
|
|
135
135
|
callback_url: string | null;
|
|
136
|
+
replicates: StudyRerun | null;
|
|
137
|
+
note: string | null;
|
|
138
|
+
note_at_ms: number | null;
|
|
139
|
+
/** The design document as the server received it: the SHA-256 of its UTF-8 bytes, its size, when it arrived, and its standing read from those times: `declared` (it arrived with the creation or before the first trial started, after which it cannot be replaced), `named` (it arrived later, and the experiment’s name, fixed at creation, carries `name_prefix`, the first 12 or more hex digits of its digest), or `after` (neither). The text is its own read. */
|
|
140
|
+
design: ExperimentDesign | null;
|
|
136
141
|
}
|
|
137
142
|
/** A paired experiment scored now: each arm, every pair, the comparisons against the control, and the decision. */
|
|
138
143
|
export interface ExperimentReport {
|
|
@@ -146,7 +151,7 @@ export interface ExperimentReport {
|
|
|
146
151
|
scenario_id: string;
|
|
147
152
|
trials: number;
|
|
148
153
|
seed_mode: 'vary' | 'pinned';
|
|
149
|
-
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
154
|
+
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
150
155
|
analysis_scale: 'metric' | 'negative_rank' | 'log';
|
|
151
156
|
rule: StoppingRule;
|
|
152
157
|
rule_text: string;
|
|
@@ -158,6 +163,10 @@ export interface ExperimentReport {
|
|
|
158
163
|
decision: ExperimentReportDecision;
|
|
159
164
|
verdict: string;
|
|
160
165
|
cost: Cost;
|
|
166
|
+
note: string | null;
|
|
167
|
+
note_at_ms: number | null;
|
|
168
|
+
/** The design document as the server received it: the SHA-256 of its UTF-8 bytes, its size, when it arrived, and its standing read from those times: `declared` (it arrived with the creation or before the first trial started, after which it cannot be replaced), `named` (it arrived later, and the experiment’s name, fixed at creation, carries `name_prefix`, the first 12 or more hex digits of its digest), or `after` (neither). The text is its own read. */
|
|
169
|
+
design: ExperimentDesign | null;
|
|
161
170
|
}
|
|
162
171
|
export interface ScenarioBody {
|
|
163
172
|
/** Display name, shown in the run builder under "Your scenarios". */
|
|
@@ -216,24 +225,30 @@ export interface RosterSeat {
|
|
|
216
225
|
instructions?: string;
|
|
217
226
|
}
|
|
218
227
|
export interface ExperimentBody {
|
|
219
|
-
/** The arms, the first the control. Every arm must name the same scenario_id; arms may differ in anything else (roster, skills, instructions, env knobs, season_ticks, frame). No arm may set env.seed or env.spawn_seed: the experiment draws both once and pins them per trial on every arm. World runs only. */
|
|
220
|
-
arms
|
|
221
|
-
/** Paired trials per arm: 3 up to the plan’s series ceiling (the comparison renders no verdict on fewer than 3 pairs). Trial i of every arm plays the same world and the same layout. */
|
|
222
|
-
trials
|
|
228
|
+
/** Required unless replicates is set. The arms, the first the control. Every arm must name the same scenario_id; arms may differ in anything else (roster, skills, instructions, env knobs, season_ticks, frame). No arm may set env.seed or env.spawn_seed: the experiment draws both once and pins them per trial on every arm. World runs only. */
|
|
229
|
+
arms?: ExperimentArm[];
|
|
230
|
+
/** Required unless replicates is set. Paired trials per arm: 3 up to the plan’s series ceiling (the comparison renders no verdict on fewer than 3 pairs). Trial i of every arm plays the same world and the same layout. */
|
|
231
|
+
trials?: number;
|
|
223
232
|
/** Experiment name, kept on one line like a run name. Default: the scenario and the arm count. Each trial is named <experiment> · <arm>. */
|
|
224
233
|
name?: string;
|
|
225
234
|
/** vary (default): each trial its own world; pinned: one world for every trial, only the layout varies. A saved scenario that pins its own seed needs pinned; a scenario that draws its worlds from a seed pool refuses it (trial i plays the pool’s world for that trial in every arm, and the pool’s eight worlds come round again from trial nine). A scenario with one fixed world (the lab scenarios) plays it on every trial: its experiment is pinned by default and refuses vary. */
|
|
226
235
|
seed_mode?: 'vary' | 'pinned';
|
|
227
|
-
/** The per-trial score the arms are compared on, the mean over the arm’s roster seats: the Fitness Index (default), the rank in the field (lower is better, and the report compares on the negative rank so a positive difference always favors the arm), the share of seats that survived,
|
|
228
|
-
metric?: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
236
|
+
/** The per-trial score the arms are compared on, the mean over the arm’s roster seats: the Fitness Index (default), the rank in the field (lower is better, and the report compares on the negative rank so a positive difference always favors the arm), the share of seats that survived, output tokens per play turn, or the debrief share. Output per turn is how much each model generated per turn of play, thinking included (the exit interview and the debrief are not play turns); it compares each model with itself, so every arm must field the same model in the same seat as the control, and it is analyzed on the log scale, the difference read as a percent change. It has no better side: the verdict says which arm generated more. A seat that missed more than a tenth of the rounds is left out of a trial in every arm, and a guest seat is never measured. said_evaluated is the share of a trial’s seats that answered yes when the end-of-match debrief asked whether they believed the match was an evaluation or test of them, among the seats whose answer came back (a trial where none did leaves its pair out), compared in percentage points. It is what the seats said, not what they believed, and it has no better side either: the verdict says which arm had more of its seats say so. */
|
|
237
|
+
metric?: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
229
238
|
/** Outcomes reported beside metric, declared now and never changed: any of the metric’s values except the metric itself, each at most once. Each is read on the same pairs with the same rule at the same level, and none stops anything; when a comparison stops, its secondaries take their reading on the pairs it stopped on. Output per turn here holds the arms to the same models in the same seats, as it does as the metric. Default none. */
|
|
230
|
-
secondary_metrics?: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn'>;
|
|
239
|
+
secondary_metrics?: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated'>;
|
|
231
240
|
/** anytime: an anytime-valid 95% confidence sequence on the paired difference, checked after every trial from the tenth on, stopping as soon as it excludes zero or at the last trial; it needs more than 10 trials per arm and is the default above that. fixed: one look at the last trial; the default at 10 or fewer. With more than two arms the level is split across the comparisons against the control. */
|
|
232
241
|
stopping?: 'anytime' | 'fixed';
|
|
233
242
|
/** Anytime rule only: also stop, undecided, once the whole interval lies within plus or minus this on the metric’s scale, so the gap, if any, is smaller than this. */
|
|
234
243
|
target_half_width?: number;
|
|
235
244
|
/** Where to POST the signed experiment.ended notice: https, a public host, no credentials, at most 512 characters. Omitted: the account’s webhook setting, if any. */
|
|
236
245
|
callback_url?: string;
|
|
246
|
+
/** The design document, as text (markdown or plain): what you predict, which result you will read and how, and what would change your view. The server keeps it byte for byte with the SHA-256 of its UTF-8 bytes and the time it arrived; the experiment answers with design (digest, size, arrival and standing), and once a trial is published the study’s card on your profile links to it at /u/<handle>/studies/<id>/design, where anyone can download the exact bytes and check the digest. Omitted: no design; one can still be attached before the first trial starts (POST /experiments/:id/design). */
|
|
247
|
+
design?: string;
|
|
248
|
+
/** Re-run a published study: its experiment id (exp_..., from the study’s card on a profile, or GET /api/studies/<id>/recipe, which answers with its design). The server builds the experiment from that design: every arm as its published trials recorded it, the trial count, the seed mode, the metric, the secondary outcomes and the stopping rule, with each world drawn fresh and shared by the arms trial by trial. The body therefore carries none of the study’s settings, only name, max_spend_usd, callback_url and, if you wrote one, your own design document for the re-run; a setting of the study (arms, trials, seed_mode, metric, secondary_metrics, stopping, target_half_width) beside replicates answers bad_replicates. A plan that cannot hold the whole design answers plan_rerun, naming each limit that cuts it and the smallest plan that holds it: a shortened copy is a different study and is never queued as a re-run. Every trial is published from creation, so the account needs a profile handle, and the record says under replicates whether it plays the study exactly as recorded and, when not, why. Exactly as recorded covers the configuration, not what the provider serves behind a model id: each match records the model and upstream that served it. */
|
|
249
|
+
replicates?: string;
|
|
250
|
+
/** With replicates only: the spend cap of each arm in USD, clamped to the plan’s range (default the plan’s own). The original’s caps were its owner’s and are not carried. An ordinary experiment sets a cap on each arm instead. */
|
|
251
|
+
max_spend_usd?: number;
|
|
237
252
|
}
|
|
238
253
|
export interface ExperimentArm {
|
|
239
254
|
/** How the report names this arm. Default arm 1, arm 2, ...; labels must be distinct. */
|
|
@@ -345,6 +360,31 @@ export interface CancelExperimentResponse {
|
|
|
345
360
|
ok: boolean;
|
|
346
361
|
experiment: Experiment;
|
|
347
362
|
}
|
|
363
|
+
export interface SetExperimentNoteBody {
|
|
364
|
+
/** The note, counted after trimming. "" or null: no note. */
|
|
365
|
+
note: string | null;
|
|
366
|
+
}
|
|
367
|
+
export interface SetExperimentNoteResponse {
|
|
368
|
+
ok: boolean;
|
|
369
|
+
experiment: Experiment;
|
|
370
|
+
}
|
|
371
|
+
export interface AttachExperimentDesignBody {
|
|
372
|
+
/** The design document, as text (markdown or plain). */
|
|
373
|
+
design: string;
|
|
374
|
+
}
|
|
375
|
+
export interface AttachExperimentDesignResponse {
|
|
376
|
+
ok: boolean;
|
|
377
|
+
experiment: Experiment;
|
|
378
|
+
}
|
|
379
|
+
export interface GetExperimentDesignResponse {
|
|
380
|
+
experiment_id: string;
|
|
381
|
+
sha256: string;
|
|
382
|
+
bytes: number;
|
|
383
|
+
at_ms: number;
|
|
384
|
+
standing: 'declared' | 'named' | 'after';
|
|
385
|
+
name_prefix: string | null;
|
|
386
|
+
text: string;
|
|
387
|
+
}
|
|
348
388
|
export interface CancelResponse {
|
|
349
389
|
ok: boolean;
|
|
350
390
|
run: Run;
|
|
@@ -497,6 +537,22 @@ export interface ExperimentArmView {
|
|
|
497
537
|
label: string;
|
|
498
538
|
batch_id: string;
|
|
499
539
|
}
|
|
540
|
+
export interface StudyRerun {
|
|
541
|
+
experiment_id: string;
|
|
542
|
+
name: string;
|
|
543
|
+
handle: string | null;
|
|
544
|
+
own: boolean;
|
|
545
|
+
exact: boolean;
|
|
546
|
+
differences: string[];
|
|
547
|
+
}
|
|
548
|
+
/** The design document as the server received it: the SHA-256 of its UTF-8 bytes, its size, when it arrived, and its standing read from those times: `declared` (it arrived with the creation or before the first trial started, after which it cannot be replaced), `named` (it arrived later, and the experiment’s name, fixed at creation, carries `name_prefix`, the first 12 or more hex digits of its digest), or `after` (neither). The text is its own read. */
|
|
549
|
+
export interface ExperimentDesign {
|
|
550
|
+
sha256: string;
|
|
551
|
+
bytes: number;
|
|
552
|
+
at_ms: number;
|
|
553
|
+
standing: 'declared' | 'named' | 'after';
|
|
554
|
+
name_prefix: string | null;
|
|
555
|
+
}
|
|
500
556
|
export interface ExperimentReportArm {
|
|
501
557
|
index: number;
|
|
502
558
|
label: string;
|
|
@@ -562,7 +618,7 @@ export interface ExperimentReportComparison {
|
|
|
562
618
|
detail: string;
|
|
563
619
|
}
|
|
564
620
|
export interface ExperimentReportSecondary {
|
|
565
|
-
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
621
|
+
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
566
622
|
analysis_scale: 'metric' | 'negative_rank' | 'log';
|
|
567
623
|
pairs: ExperimentReportSecondaryPair[];
|
|
568
624
|
comparisons: ExperimentReportSecondaryComparison[];
|
|
@@ -871,6 +927,30 @@ export declare abstract class Operations {
|
|
|
871
927
|
* @see https://daishi.ai/docs/developer/rest#ep-cancel-experiment
|
|
872
928
|
*/
|
|
873
929
|
cancelExperiment(id: string): Promise<CancelExperimentResponse>;
|
|
930
|
+
/**
|
|
931
|
+
* Set an experiment’s note.
|
|
932
|
+
*
|
|
933
|
+
* Write or clear your note on one of your experiments: its declared result, in your words.
|
|
934
|
+
*
|
|
935
|
+
* @see https://daishi.ai/docs/developer/rest#ep-set-experiment-note
|
|
936
|
+
*/
|
|
937
|
+
setExperimentNote(id: string, body: SetExperimentNoteBody): Promise<SetExperimentNoteResponse>;
|
|
938
|
+
/**
|
|
939
|
+
* Attach an experiment’s design.
|
|
940
|
+
*
|
|
941
|
+
* Attach or replace the design document of one of your experiments, before its first trial starts.
|
|
942
|
+
*
|
|
943
|
+
* @see https://daishi.ai/docs/developer/rest#ep-attach-experiment-design
|
|
944
|
+
*/
|
|
945
|
+
attachExperimentDesign(id: string, body: AttachExperimentDesignBody): Promise<AttachExperimentDesignResponse>;
|
|
946
|
+
/**
|
|
947
|
+
* Get an experiment’s design.
|
|
948
|
+
*
|
|
949
|
+
* The design document of one of your experiments as the server received it, with its digest and standing.
|
|
950
|
+
*
|
|
951
|
+
* @see https://daishi.ai/docs/developer/rest#ep-get-experiment-design
|
|
952
|
+
*/
|
|
953
|
+
getExperimentDesign(id: string): Promise<GetExperimentDesignResponse>;
|
|
874
954
|
/**
|
|
875
955
|
* Cancel a run.
|
|
876
956
|
*
|
package/dist/generated.js
CHANGED
|
@@ -294,6 +294,36 @@ export class Operations {
|
|
|
294
294
|
cancelExperiment(id) {
|
|
295
295
|
return this.request('POST', `/experiments/${encodeURIComponent(id)}/cancel`);
|
|
296
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Set an experiment’s note.
|
|
299
|
+
*
|
|
300
|
+
* Write or clear your note on one of your experiments: its declared result, in your words.
|
|
301
|
+
*
|
|
302
|
+
* @see https://daishi.ai/docs/developer/rest#ep-set-experiment-note
|
|
303
|
+
*/
|
|
304
|
+
setExperimentNote(id, body) {
|
|
305
|
+
return this.request('POST', `/experiments/${encodeURIComponent(id)}/note`, { body });
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Attach an experiment’s design.
|
|
309
|
+
*
|
|
310
|
+
* Attach or replace the design document of one of your experiments, before its first trial starts.
|
|
311
|
+
*
|
|
312
|
+
* @see https://daishi.ai/docs/developer/rest#ep-attach-experiment-design
|
|
313
|
+
*/
|
|
314
|
+
attachExperimentDesign(id, body) {
|
|
315
|
+
return this.request('POST', `/experiments/${encodeURIComponent(id)}/design`, { body });
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Get an experiment’s design.
|
|
319
|
+
*
|
|
320
|
+
* The design document of one of your experiments as the server received it, with its digest and standing.
|
|
321
|
+
*
|
|
322
|
+
* @see https://daishi.ai/docs/developer/rest#ep-get-experiment-design
|
|
323
|
+
*/
|
|
324
|
+
getExperimentDesign(id) {
|
|
325
|
+
return this.request('GET', `/experiments/${encodeURIComponent(id)}/design`);
|
|
326
|
+
}
|
|
297
327
|
/**
|
|
298
328
|
* Cancel a run.
|
|
299
329
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Operations, type ErrorCode, type GetBatchResponse, type GetExperimentResponse, type GetRunResponse, type Method, type RequestParts } from './generated.js';
|
|
2
2
|
export * from './generated.js';
|
|
3
|
-
export declare const VERSION = "0.2.
|
|
3
|
+
export declare const VERSION = "0.2.5";
|
|
4
4
|
export declare const DEFAULT_BASE_URL = "https://daishi.ai/api/v1";
|
|
5
5
|
export interface DaishiOptions {
|
|
6
6
|
/** A Studio access token (`dsk_...`). Default: the `DAISHI_TOKEN` environment variable. */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Operations } from './generated.js';
|
|
2
2
|
export * from './generated.js';
|
|
3
|
-
export const VERSION = '0.2.
|
|
3
|
+
export const VERSION = '0.2.5';
|
|
4
4
|
export const DEFAULT_BASE_URL = 'https://daishi.ai/api/v1';
|
|
5
5
|
/** A refusal from the API, or a transport failure after the retries ran out. */
|
|
6
6
|
export class DaishiError extends Error {
|
package/package.json
CHANGED