@senselab-ai/sensei 0.0.0-stage → 0.2.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.
@@ -0,0 +1,233 @@
1
+ /**
2
+ * The end-to-end check (`sensei.evals`): saved tasks, rerun in a sandbox on
3
+ * two versions of the project's model and graded by the project's own test
4
+ * command.
5
+ *
6
+ * const task = await sensei.evals.tasks.add({ repo: "acme/app", baseCommit: "<40 character commit id>",
7
+ * ask: "Fix the empty read", testCommand: "pytest -q" });
8
+ * let check = await sensei.evals.create({ sides: ["live", "version"], attempts: 1, limitUsd: 25 });
9
+ * check = await sensei.evals.wait(check.id);
10
+ * console.log(check.reading?.sentence);
11
+ *
12
+ * Only work with a repository and a test command can be checked this way.
13
+ * Sessions from your own agent through the endpoint record no repository
14
+ * state, so those projects keep the step check and the trial.
15
+ *
16
+ * Any key of the project reads. Adding or removing a task and starting,
17
+ * resuming or stopping a check need a key an account admin has allowed to
18
+ * "Manage model versions" on the Keys page; any other key gets a
19
+ * `SenseiError` with status 403 and code `manage_model_versions_required`.
20
+ *
21
+ * Kept in its own file, with its own types, so it changes apart from the
22
+ * rest of the client.
23
+ */
24
+ import type { Client } from "./client.js";
25
+ /** A check in one of these has stopped starting attempts. A stopped one can be resumed. */
26
+ export declare const EVAL_SETTLED: readonly EvalStatus[];
27
+ /** A task in one of these has been tried at its base commit. */
28
+ export declare const EVAL_TASK_SETTLED: readonly EvalTaskStatus[];
29
+ export type EvalTaskStatus = "checking" | "accepted" | "refused";
30
+ export type EvalStatus = "queued" | "running" | "finished" | "stopped";
31
+ export type EvalAttemptStatus = "pending" | "running" | "passed" | "failed" | "errored";
32
+ /** `base`, `live`, `version` (the version waiting), or a version's id. */
33
+ export type EvalSide = "base" | "live" | "version" | (string & {});
34
+ export interface EvalTask {
35
+ id: string;
36
+ project_id: string;
37
+ name: string;
38
+ repo: string;
39
+ base_commit: string;
40
+ ask: string;
41
+ test_command: string;
42
+ status: EvalTaskStatus;
43
+ /** Why a task was refused, in a sentence. */
44
+ reason: string | null;
45
+ acceptance_run_id: string | null;
46
+ /** The verified run a task was saved from, when it was. */
47
+ source_run_id: string | null;
48
+ created_at: string | null;
49
+ }
50
+ /** A task by its four fields, or a verified run to save as one. */
51
+ export interface EvalTaskParams {
52
+ repo?: string;
53
+ baseCommit?: string;
54
+ ask?: string;
55
+ testCommand?: string;
56
+ name?: string;
57
+ runId?: string;
58
+ }
59
+ export interface EvalSideInfo {
60
+ kind: "base" | "live" | "version";
61
+ version_id?: string | null;
62
+ name: string;
63
+ }
64
+ /** What a check found: tasks solved per side on the same tasks, and one sentence. */
65
+ export interface EvalReading {
66
+ tasks: number;
67
+ left_out: number;
68
+ a: {
69
+ name: string;
70
+ solved: number;
71
+ };
72
+ b: {
73
+ name: string;
74
+ solved: number;
75
+ };
76
+ both: number;
77
+ neither: number;
78
+ only_a: number;
79
+ only_b: number;
80
+ /** Null under `min_tasks` tasks: the counts are shown without a verdict. */
81
+ p: number | null;
82
+ verdict: "ahead" | "behind" | "same" | null;
83
+ min_tasks: number;
84
+ sentence: string;
85
+ }
86
+ export interface EvalProgress {
87
+ total: number;
88
+ pending: number;
89
+ running: number;
90
+ passed: number;
91
+ failed: number;
92
+ errored: number;
93
+ }
94
+ export interface EvalEstimate {
95
+ usd: number;
96
+ runs: number;
97
+ basis: "typical run" | "earlier attempts";
98
+ sides: {
99
+ a: {
100
+ kind: string;
101
+ name: string;
102
+ };
103
+ b: {
104
+ kind: string;
105
+ name: string;
106
+ };
107
+ };
108
+ [field: string]: unknown;
109
+ }
110
+ export interface EvalCheck {
111
+ id: string;
112
+ project_id: string;
113
+ status: EvalStatus;
114
+ /** Why a check stopped before every attempt was made, in a sentence. */
115
+ stopped_reason: string | null;
116
+ sides: {
117
+ a: EvalSideInfo;
118
+ b: EvalSideInfo;
119
+ };
120
+ attempts: number;
121
+ limit_usd: number;
122
+ estimate_usd: number | null;
123
+ spent_usd: number;
124
+ /** `person`, or `required` when the project's setting queued it. */
125
+ requested_by: string;
126
+ version_id: string | null;
127
+ reading: EvalReading | null;
128
+ progress?: EvalProgress;
129
+ created_at: string | null;
130
+ started_at: string | null;
131
+ finished_at: string | null;
132
+ }
133
+ /** A check as `create` answers: with its estimate, and a note when that is above the limit. */
134
+ export interface EvalStarted extends EvalCheck {
135
+ estimate: EvalEstimate;
136
+ note?: string;
137
+ }
138
+ /** A check as `resume` answers: `rerun` attempts were put back to run again. */
139
+ export interface EvalResumed extends EvalCheck {
140
+ rerun: number;
141
+ }
142
+ export interface EvalAttempt {
143
+ attempt: number;
144
+ status: EvalAttemptStatus;
145
+ /** The run that made the attempt, and its page. */
146
+ run_id: string | null;
147
+ url?: string | null;
148
+ error: string | null;
149
+ usd: number;
150
+ }
151
+ export interface EvalTaskSide {
152
+ /** Whether most of the side's attempts passed; null with no result yet. */
153
+ solved: boolean | null;
154
+ attempts: EvalAttempt[];
155
+ }
156
+ export interface EvalResults {
157
+ check: EvalCheck;
158
+ tasks: Array<{
159
+ id: string;
160
+ name: string;
161
+ repo: string | null;
162
+ base_commit: string | null;
163
+ test_command: string | null;
164
+ a: EvalTaskSide;
165
+ b: EvalTaskSide;
166
+ }>;
167
+ }
168
+ export interface EvalCreateParams {
169
+ /** The most the check may spend, in dollars. It stops starting attempts when it gets there. */
170
+ limitUsd: number;
171
+ /** Two sides. Left out: the live version (or the base model) against the version waiting. */
172
+ sides?: readonly [EvalSide, EvalSide];
173
+ /** Attempts of each task on each side: 1 or 3. */
174
+ attempts?: 1 | 3;
175
+ }
176
+ export interface EvalWaitOptions {
177
+ /** Return what there is when this much time is up. */
178
+ timeoutMs?: number;
179
+ pollMs?: number;
180
+ }
181
+ /** The project's check tasks: a repository at a commit, what was asked, and the command that says whether it was done. */
182
+ export declare class EvalTasks {
183
+ #private;
184
+ constructor(client: Client);
185
+ /**
186
+ * Save a task: the four fields, or `runId` to save a verified run (its
187
+ * repository, the commit it started from, what it was asked and the
188
+ * command that verified it). The task is `checking` until it has been
189
+ * tried: the command must fail at the base commit and give the same
190
+ * result twice. A task that cannot be used is `refused`, with the
191
+ * `reason` in a sentence.
192
+ */
193
+ add(params: EvalTaskParams): Promise<EvalTask>;
194
+ list(): Promise<EvalTask[]>;
195
+ remove(taskId: string): Promise<void>;
196
+ /** Try a refused task again, after fixing what its reason named. */
197
+ recheck(taskId: string): Promise<EvalTask>;
198
+ /** The task once it is accepted or refused; `timeoutMs` returns it as it is when the time is up. */
199
+ wait(taskId: string, options?: EvalWaitOptions): Promise<EvalTask>;
200
+ }
201
+ /** End-to-end checks of the project's model on its saved tasks. */
202
+ export declare class Evals {
203
+ #private;
204
+ readonly tasks: EvalTasks;
205
+ constructor(client: Client);
206
+ /** What a check would cost on the accepted tasks, before starting one. */
207
+ estimate(params?: {
208
+ sides?: readonly [EvalSide, EvalSide];
209
+ attempts?: 1 | 3;
210
+ }): Promise<EvalEstimate>;
211
+ /**
212
+ * Start a check: every accepted task on both sides, `attempts` times
213
+ * each. Each attempt is a run, charged as one. `limitUsd` is required;
214
+ * the answer carries the `estimate`.
215
+ */
216
+ create(params: EvalCreateParams): Promise<EvalStarted>;
217
+ list(): Promise<EvalCheck[]>;
218
+ /** A check with its `progress` and its `reading` so far. */
219
+ get(checkId: string): Promise<EvalCheck>;
220
+ /** The check once it is finished or stopped; `timeoutMs` returns it as it is when the time is up. */
221
+ wait(checkId: string, options?: EvalWaitOptions): Promise<EvalCheck>;
222
+ /** Every task, side and attempt of a check, each with the id and the page of the run that made it. */
223
+ results(checkId: string): Promise<EvalResults>;
224
+ /**
225
+ * Run the attempts that errored again, and only those, and go on with
226
+ * the ones that never started. `limitUsd` raises the limit first.
227
+ */
228
+ resume(checkId: string, params?: {
229
+ limitUsd?: number;
230
+ }): Promise<EvalResumed>;
231
+ /** Stop starting attempts. The ones running finish and are charged. */
232
+ stop(checkId: string): Promise<EvalCheck>;
233
+ }
package/dist/evals.js ADDED
@@ -0,0 +1,140 @@
1
+ /**
2
+ * The end-to-end check (`sensei.evals`): saved tasks, rerun in a sandbox on
3
+ * two versions of the project's model and graded by the project's own test
4
+ * command.
5
+ *
6
+ * const task = await sensei.evals.tasks.add({ repo: "acme/app", baseCommit: "<40 character commit id>",
7
+ * ask: "Fix the empty read", testCommand: "pytest -q" });
8
+ * let check = await sensei.evals.create({ sides: ["live", "version"], attempts: 1, limitUsd: 25 });
9
+ * check = await sensei.evals.wait(check.id);
10
+ * console.log(check.reading?.sentence);
11
+ *
12
+ * Only work with a repository and a test command can be checked this way.
13
+ * Sessions from your own agent through the endpoint record no repository
14
+ * state, so those projects keep the step check and the trial.
15
+ *
16
+ * Any key of the project reads. Adding or removing a task and starting,
17
+ * resuming or stopping a check need a key an account admin has allowed to
18
+ * "Manage model versions" on the Keys page; any other key gets a
19
+ * `SenseiError` with status 403 and code `manage_model_versions_required`.
20
+ *
21
+ * Kept in its own file, with its own types, so it changes apart from the
22
+ * rest of the client.
23
+ */
24
+ /** A check in one of these has stopped starting attempts. A stopped one can be resumed. */
25
+ export const EVAL_SETTLED = ["finished", "stopped"];
26
+ /** A task in one of these has been tried at its base commit. */
27
+ export const EVAL_TASK_SETTLED = ["accepted", "refused"];
28
+ const seg = encodeURIComponent;
29
+ const sleep = (ms) => new Promise((done) => setTimeout(done, ms));
30
+ /** What was passed, under the API's names, without what was left out. */
31
+ function body(fields) {
32
+ return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined && value !== null));
33
+ }
34
+ async function until(read, settled, options, pollMs) {
35
+ const every = options.pollMs ?? pollMs;
36
+ const deadline = options.timeoutMs != null ? performance.now() + options.timeoutMs : null;
37
+ for (;;) {
38
+ const value = await read();
39
+ if (settled(value))
40
+ return value;
41
+ const left = deadline !== null ? deadline - performance.now() : every;
42
+ if (left <= 0)
43
+ return value;
44
+ await sleep(Math.min(every, left));
45
+ }
46
+ }
47
+ /** The project's check tasks: a repository at a commit, what was asked, and the command that says whether it was done. */
48
+ export class EvalTasks {
49
+ #c;
50
+ constructor(client) {
51
+ this.#c = client;
52
+ }
53
+ /**
54
+ * Save a task: the four fields, or `runId` to save a verified run (its
55
+ * repository, the commit it started from, what it was asked and the
56
+ * command that verified it). The task is `checking` until it has been
57
+ * tried: the command must fail at the base commit and give the same
58
+ * result twice. A task that cannot be used is `refused`, with the
59
+ * `reason` in a sentence.
60
+ */
61
+ add(params) {
62
+ const { repo, baseCommit, ask, testCommand, name, runId } = params;
63
+ return this.#c.request("POST", "/v1/evals/tasks", {
64
+ body: body({ repo, base_commit: baseCommit, ask, test_command: testCommand, name, run_id: runId }),
65
+ });
66
+ }
67
+ async list() {
68
+ return (await this.#c.request("GET", "/v1/evals/tasks")).data;
69
+ }
70
+ async remove(taskId) {
71
+ await this.#c.request("DELETE", `/v1/evals/tasks/${seg(taskId)}`);
72
+ }
73
+ /** Try a refused task again, after fixing what its reason named. */
74
+ recheck(taskId) {
75
+ return this.#c.request("POST", `/v1/evals/tasks/${seg(taskId)}/recheck`, { body: {} });
76
+ }
77
+ /** The task once it is accepted or refused; `timeoutMs` returns it as it is when the time is up. */
78
+ wait(taskId, options = {}) {
79
+ const read = async () => {
80
+ const task = (await this.list()).find((t) => t.id === taskId);
81
+ if (!task)
82
+ throw new Error(`No such task: ${taskId}`);
83
+ return task;
84
+ };
85
+ return until(read, (task) => EVAL_TASK_SETTLED.includes(task.status), options, 3000);
86
+ }
87
+ }
88
+ /** End-to-end checks of the project's model on its saved tasks. */
89
+ export class Evals {
90
+ tasks;
91
+ #c;
92
+ constructor(client) {
93
+ this.#c = client;
94
+ this.tasks = new EvalTasks(client);
95
+ }
96
+ /** What a check would cost on the accepted tasks, before starting one. */
97
+ estimate(params = {}) {
98
+ return this.#c.request("POST", "/v1/evals/estimate", {
99
+ body: body({ sides: params.sides, attempts: params.attempts ?? 1 }),
100
+ });
101
+ }
102
+ /**
103
+ * Start a check: every accepted task on both sides, `attempts` times
104
+ * each. Each attempt is a run, charged as one. `limitUsd` is required;
105
+ * the answer carries the `estimate`.
106
+ */
107
+ create(params) {
108
+ return this.#c.request("POST", "/v1/evals", {
109
+ body: body({ sides: params.sides, attempts: params.attempts ?? 1, limit_usd: params.limitUsd }),
110
+ });
111
+ }
112
+ async list() {
113
+ return (await this.#c.request("GET", "/v1/evals")).data;
114
+ }
115
+ /** A check with its `progress` and its `reading` so far. */
116
+ get(checkId) {
117
+ return this.#c.request("GET", `/v1/evals/${seg(checkId)}`);
118
+ }
119
+ /** The check once it is finished or stopped; `timeoutMs` returns it as it is when the time is up. */
120
+ wait(checkId, options = {}) {
121
+ return until(() => this.get(checkId), (check) => EVAL_SETTLED.includes(check.status), options, 5000);
122
+ }
123
+ /** Every task, side and attempt of a check, each with the id and the page of the run that made it. */
124
+ results(checkId) {
125
+ return this.#c.request("GET", `/v1/evals/${seg(checkId)}/results`);
126
+ }
127
+ /**
128
+ * Run the attempts that errored again, and only those, and go on with
129
+ * the ones that never started. `limitUsd` raises the limit first.
130
+ */
131
+ resume(checkId, params = {}) {
132
+ return this.#c.request("POST", `/v1/evals/${seg(checkId)}/resume`, {
133
+ body: body({ limit_usd: params.limitUsd }),
134
+ });
135
+ }
136
+ /** Stop starting attempts. The ones running finish and are charged. */
137
+ stop(checkId) {
138
+ return this.#c.request("POST", `/v1/evals/${seg(checkId)}/stop`, { body: {} });
139
+ }
140
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Definition files: an agent, written down once.
3
+ *
4
+ * # refunds.yaml
5
+ * agent: refund-requests
6
+ * instructions: |
7
+ * Decide the refund request ...
8
+ * input: {ticket: number}
9
+ * output: {decision: refund | deny | escalate, amount: number?, reason: text}
10
+ * tools: [zendesk, stripe]
11
+ * ask_first: [stripe.refund]
12
+ *
13
+ * A file holds no secrets, so it can live in the repository and be shared. A
14
+ * step may name another file (`agent: ./triage.yaml`); it is read in here, so
15
+ * what is sent is one definition that carries everything it runs.
16
+ */
17
+ import type { Definition } from "./types.js";
18
+ export declare const MAX_DEPTH = 3;
19
+ export declare const SUFFIXES: readonly [".yaml", ".yml", ".json"];
20
+ /** What is wrong with a definition file, said for the person who wrote it. */
21
+ export declare class FileError extends Error {
22
+ constructor(message: string, options?: {
23
+ cause?: unknown;
24
+ });
25
+ }
26
+ export declare function isFileRef(value: unknown): value is string;
27
+ export declare function looksLikeFile(target: string): boolean;
28
+ /** The definition in `path`, with the files its steps name read in. */
29
+ export declare function load(path: string): Definition;
package/dist/files.js ADDED
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Definition files: an agent, written down once.
3
+ *
4
+ * # refunds.yaml
5
+ * agent: refund-requests
6
+ * instructions: |
7
+ * Decide the refund request ...
8
+ * input: {ticket: number}
9
+ * output: {decision: refund | deny | escalate, amount: number?, reason: text}
10
+ * tools: [zendesk, stripe]
11
+ * ask_first: [stripe.refund]
12
+ *
13
+ * A file holds no secrets, so it can live in the repository and be shared. A
14
+ * step may name another file (`agent: ./triage.yaml`); it is read in here, so
15
+ * what is sent is one definition that carries everything it runs.
16
+ */
17
+ import { readFileSync, statSync } from "node:fs";
18
+ import { homedir } from "node:os";
19
+ import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
20
+ import { parse } from "yaml";
21
+ export const MAX_DEPTH = 3;
22
+ export const SUFFIXES = [".yaml", ".yml", ".json"];
23
+ /** What is wrong with a definition file, said for the person who wrote it. */
24
+ export class FileError extends Error {
25
+ constructor(message, options) {
26
+ super(message, options);
27
+ this.name = "FileError";
28
+ }
29
+ }
30
+ const BOOL = "tag:yaml.org,2002:bool";
31
+ const TIMESTAMP = "tag:yaml.org,2002:timestamp";
32
+ /**
33
+ * The same file reads the same from the `sensei` command (Python, PyYAML)
34
+ * and from here: YAML 1.1, where `yes`, `no`, `on` and `off` are booleans.
35
+ * Two things are put right. A bare `y` or `n` stays text, as PyYAML has it,
36
+ * so a field can be called `y`. A date stays as it was written.
37
+ */
38
+ const TRUE = /^(?:yes|Yes|YES|true|True|TRUE|on|On|ON)$/;
39
+ const FALSE = /^(?:no|No|NO|false|False|FALSE|off|Off|OFF)$/;
40
+ function asPyYaml(tags) {
41
+ const out = [];
42
+ for (const tag of tags) {
43
+ if (typeof tag === "string") {
44
+ out.push(tag);
45
+ }
46
+ else if (tag.tag === BOOL && "test" in tag && tag.test) {
47
+ out.push({ ...tag, test: tag.test.test("true") ? TRUE : FALSE });
48
+ }
49
+ else if (tag.tag !== TIMESTAMP) {
50
+ out.push(tag);
51
+ }
52
+ }
53
+ return out;
54
+ }
55
+ const YAML = {
56
+ version: "1.1",
57
+ uniqueKeys: false,
58
+ customTags: asPyYaml,
59
+ };
60
+ function endsWithSuffix(name) {
61
+ const lower = name.toLowerCase();
62
+ return SUFFIXES.some((s) => lower.endsWith(s));
63
+ }
64
+ function expandUser(path) {
65
+ return path === "~" || path.startsWith("~/") || path.startsWith(`~${sep}`) ? join(homedir(), path.slice(1)) : path;
66
+ }
67
+ function isMapping(value) {
68
+ return typeof value === "object" && value !== null && !Array.isArray(value);
69
+ }
70
+ function firstLine(e) {
71
+ return (e instanceof Error ? e.message : String(e)).split(/\r?\n/)[0] ?? "";
72
+ }
73
+ /** "ENOENT: no such file or directory, open '/x'" as "No such file or directory". */
74
+ function whyNot(e) {
75
+ const why = firstLine(e).replace(/^[A-Z0-9_]+: /, "").replace(/, [a-z]+ '.*'$/, "");
76
+ return why.charAt(0).toUpperCase() + why.slice(1);
77
+ }
78
+ export function isFileRef(value) {
79
+ return typeof value === "string" && (["./", "../", "/", "~"].some((p) => value.startsWith(p)) || endsWithSuffix(value));
80
+ }
81
+ export function looksLikeFile(target) {
82
+ if (endsWithSuffix(target))
83
+ return true;
84
+ try {
85
+ return statSync(target).isFile();
86
+ }
87
+ catch {
88
+ return false;
89
+ }
90
+ }
91
+ function read(path, seen) {
92
+ const full = resolve(expandUser(path));
93
+ if (seen.includes(full)) {
94
+ const chain = [...seen, full].map((p) => basename(p)).join(" -> ");
95
+ throw new FileError(`the steps name each other in a circle: ${chain}`);
96
+ }
97
+ if (seen.length > MAX_DEPTH) {
98
+ throw new FileError(`steps are nested deeper than ${MAX_DEPTH} files`);
99
+ }
100
+ let text;
101
+ try {
102
+ text = readFileSync(full, "utf8");
103
+ }
104
+ catch (e) {
105
+ throw new FileError(`cannot read ${path}: ${whyNot(e)}`, { cause: e });
106
+ }
107
+ const json = full.toLowerCase().endsWith(".json");
108
+ let doc;
109
+ try {
110
+ doc = json ? JSON.parse(text) : parse(text, YAML);
111
+ }
112
+ catch (e) {
113
+ throw new FileError(`${path} is not valid ${json ? "JSON" : "YAML"}: ${firstLine(e).slice(0, 200)}`, { cause: e });
114
+ }
115
+ if (!isMapping(doc)) {
116
+ throw new FileError(`${path} is not a definition (a mapping with agent, instructions, ...)`);
117
+ }
118
+ if (Array.isArray(doc.steps)) {
119
+ const base = dirname(full);
120
+ for (const step of doc.steps) {
121
+ if (isMapping(step) && isFileRef(step.agent)) {
122
+ const ref = expandUser(step.agent);
123
+ step.agent = read(isAbsolute(ref) ? ref : join(base, ref), [...seen, full]);
124
+ }
125
+ }
126
+ }
127
+ return doc;
128
+ }
129
+ /** The definition in `path`, with the files its steps name read in. */
130
+ export function load(path) {
131
+ return read(path, []);
132
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Sensei runs, from JavaScript and TypeScript:
3
+ *
4
+ * import { Sensei } from "@senselab-ai/sensei";
5
+ *
6
+ * const sensei = new Sensei(); // SENSEI_API_KEY, SENSEI_RUNS_URL
7
+ * const r = await sensei.run("agents/refunds.yaml", { input: { ticket: 48213 } }); // a definition file, or a saved agent's name
8
+ * console.log(r.status, r.output, r.evidence, r.notSure);
9
+ * if (r.waiting) await r.answer("approve");
10
+ *
11
+ * `Client` is the API one call at a time (`client.runs.create(...)`,
12
+ * `client.runs.events(id)`), and `client.model` is the project's own trained
13
+ * model: where it is, its versions, and the decisions about them.
14
+ */
15
+ export { Agents, Client, DEFAULT_URL, Model, MODEL_SETTLED, Repos, Runs, Schedules, SenseiError, SETTLED, Settings, Tools, type ClientOptions, type FetchBodyReader, type FetchInit, type FetchLike, type FetchResponse, } from "./client.js";
16
+ export { RunResult, Sensei, type MapOptions, type RunOptions, type SenseiOptions, type StartOptions } from "./run.js";
17
+ export * from "./evals.js";
18
+ export { VERSION } from "./version.js";
19
+ export { FileError } from "./files.js";
20
+ export * as files from "./files.js";
21
+ export type * from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Sensei runs, from JavaScript and TypeScript:
3
+ *
4
+ * import { Sensei } from "@senselab-ai/sensei";
5
+ *
6
+ * const sensei = new Sensei(); // SENSEI_API_KEY, SENSEI_RUNS_URL
7
+ * const r = await sensei.run("agents/refunds.yaml", { input: { ticket: 48213 } }); // a definition file, or a saved agent's name
8
+ * console.log(r.status, r.output, r.evidence, r.notSure);
9
+ * if (r.waiting) await r.answer("approve");
10
+ *
11
+ * `Client` is the API one call at a time (`client.runs.create(...)`,
12
+ * `client.runs.events(id)`), and `client.model` is the project's own trained
13
+ * model: where it is, its versions, and the decisions about them.
14
+ */
15
+ export { Agents, Client, DEFAULT_URL, Model, MODEL_SETTLED, Repos, Runs, Schedules, SenseiError, SETTLED, Settings, Tools, } from "./client.js";
16
+ export { RunResult, Sensei } from "./run.js";
17
+ export * from "./evals.js";
18
+ export { VERSION } from "./version.js";
19
+ export { FileError } from "./files.js";
20
+ export * as files from "./files.js";