daishi-sdk 0.2.4 → 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 +76 -9
- 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' | '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';
|
|
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;
|
|
@@ -134,6 +134,10 @@ export interface Experiment {
|
|
|
134
134
|
verdict: string | null;
|
|
135
135
|
callback_url: string | null;
|
|
136
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;
|
|
137
141
|
}
|
|
138
142
|
/** A paired experiment scored now: each arm, every pair, the comparisons against the control, and the decision. */
|
|
139
143
|
export interface ExperimentReport {
|
|
@@ -147,7 +151,7 @@ export interface ExperimentReport {
|
|
|
147
151
|
scenario_id: string;
|
|
148
152
|
trials: number;
|
|
149
153
|
seed_mode: 'vary' | 'pinned';
|
|
150
|
-
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
154
|
+
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
151
155
|
analysis_scale: 'metric' | 'negative_rank' | 'log';
|
|
152
156
|
rule: StoppingRule;
|
|
153
157
|
rule_text: string;
|
|
@@ -159,6 +163,10 @@ export interface ExperimentReport {
|
|
|
159
163
|
decision: ExperimentReportDecision;
|
|
160
164
|
verdict: string;
|
|
161
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;
|
|
162
170
|
}
|
|
163
171
|
export interface ScenarioBody {
|
|
164
172
|
/** Display name, shown in the run builder under "Your scenarios". */
|
|
@@ -225,17 +233,19 @@ export interface ExperimentBody {
|
|
|
225
233
|
name?: string;
|
|
226
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. */
|
|
227
235
|
seed_mode?: 'vary' | 'pinned';
|
|
228
|
-
/** 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,
|
|
229
|
-
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';
|
|
230
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. */
|
|
231
|
-
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'>;
|
|
232
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. */
|
|
233
241
|
stopping?: 'anytime' | 'fixed';
|
|
234
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. */
|
|
235
243
|
target_half_width?: number;
|
|
236
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. */
|
|
237
245
|
callback_url?: string;
|
|
238
|
-
/**
|
|
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. */
|
|
239
249
|
replicates?: string;
|
|
240
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. */
|
|
241
251
|
max_spend_usd?: number;
|
|
@@ -350,6 +360,31 @@ export interface CancelExperimentResponse {
|
|
|
350
360
|
ok: boolean;
|
|
351
361
|
experiment: Experiment;
|
|
352
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
|
+
}
|
|
353
388
|
export interface CancelResponse {
|
|
354
389
|
ok: boolean;
|
|
355
390
|
run: Run;
|
|
@@ -510,6 +545,14 @@ export interface StudyRerun {
|
|
|
510
545
|
exact: boolean;
|
|
511
546
|
differences: string[];
|
|
512
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
|
+
}
|
|
513
556
|
export interface ExperimentReportArm {
|
|
514
557
|
index: number;
|
|
515
558
|
label: string;
|
|
@@ -575,7 +618,7 @@ export interface ExperimentReportComparison {
|
|
|
575
618
|
detail: string;
|
|
576
619
|
}
|
|
577
620
|
export interface ExperimentReportSecondary {
|
|
578
|
-
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
|
|
621
|
+
metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn' | 'said_evaluated';
|
|
579
622
|
analysis_scale: 'metric' | 'negative_rank' | 'log';
|
|
580
623
|
pairs: ExperimentReportSecondaryPair[];
|
|
581
624
|
comparisons: ExperimentReportSecondaryComparison[];
|
|
@@ -884,6 +927,30 @@ export declare abstract class Operations {
|
|
|
884
927
|
* @see https://daishi.ai/docs/developer/rest#ep-cancel-experiment
|
|
885
928
|
*/
|
|
886
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>;
|
|
887
954
|
/**
|
|
888
955
|
* Cancel a run.
|
|
889
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