@lmnr-ai/client 0.8.44 → 0.8.46
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/index.cjs +120 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -2
- package/dist/index.d.mts +92 -2
- package/dist/index.mjs +120 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CachedSpan, Datapoint, Dataset, EvaluationDatapoint, GetDatapointsResponse, InitEvaluationResponse, PushDatapointsResponse, SessionBlock, SessionBlockContent, SessionBlockType, Signal, SignalFilter, SignalMode, SignalStructuredOutput, SignalTrigger, SqlSchema, StringUUID } from "@lmnr-ai/types";
|
|
1
|
+
import { CachedSpan, Datapoint, Dataset, EvaluationDatapoint, GetDatapointsResponse, InitEvaluationResponse, LlmProfile, LlmProfileConfig, LlmProfileProvider, PushDatapointsResponse, SessionBlock, SessionBlockContent, SessionBlockType, Signal, SignalFilter, SignalMode, SignalStructuredOutput, SignalTrigger, SignalVersion, SqlSchema, StringUUID } from "@lmnr-ai/types";
|
|
2
2
|
|
|
3
3
|
//#region src/resources/index.d.ts
|
|
4
4
|
/**
|
|
@@ -107,6 +107,14 @@ declare class DatasetsResource extends BaseResource {
|
|
|
107
107
|
* @returns {Promise<Dataset[]>} Array of datasets
|
|
108
108
|
*/
|
|
109
109
|
listDatasets(): Promise<Dataset[]>;
|
|
110
|
+
/** Create an empty dataset. */
|
|
111
|
+
create(name: string): Promise<Dataset>;
|
|
112
|
+
/** Get a dataset by its canonical UUID. */
|
|
113
|
+
getById(datasetId: StringUUID): Promise<Dataset>;
|
|
114
|
+
/** Rename a dataset. */
|
|
115
|
+
update(datasetId: StringUUID, name: string): Promise<Dataset>;
|
|
116
|
+
/** Delete a dataset and its datapoints. */
|
|
117
|
+
delete(datasetId: StringUUID): Promise<Dataset>;
|
|
110
118
|
/**
|
|
111
119
|
* Get a dataset by name.
|
|
112
120
|
*
|
|
@@ -346,6 +354,67 @@ declare class EvaluatorsResource extends BaseResource {
|
|
|
346
354
|
score(options: ScoreOptions): Promise<void>;
|
|
347
355
|
}
|
|
348
356
|
//#endregion
|
|
357
|
+
//#region src/resources/llm-profiles.d.ts
|
|
358
|
+
/**
|
|
359
|
+
* Plaintext secrets for create/update. On update this is an OVERLAY: an
|
|
360
|
+
* omitted key keeps the stored secret, so credentials never need re-sending.
|
|
361
|
+
*/
|
|
362
|
+
interface LlmProfileSecretsInput {
|
|
363
|
+
apiKey?: string;
|
|
364
|
+
secretAccessKey?: string;
|
|
365
|
+
token?: string;
|
|
366
|
+
/** Values for the `custom` provider's `config.headerNames`. */
|
|
367
|
+
headers?: Record<string, string>;
|
|
368
|
+
}
|
|
369
|
+
interface CreateLlmProfileOptions {
|
|
370
|
+
name: string;
|
|
371
|
+
provider: LlmProfileProvider;
|
|
372
|
+
/** Omitted `auth` defaults to `{type: "api_key"}`. */
|
|
373
|
+
config?: Partial<LlmProfileConfig>;
|
|
374
|
+
secrets?: LlmProfileSecretsInput;
|
|
375
|
+
models: string[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A partial patch: omitted fields keep their stored value. `models` replaces
|
|
379
|
+
* the whole list when present; `config` is required when `provider` changes.
|
|
380
|
+
*/
|
|
381
|
+
interface UpdateLlmProfileOptions {
|
|
382
|
+
name?: string;
|
|
383
|
+
provider?: LlmProfileProvider;
|
|
384
|
+
config?: Partial<LlmProfileConfig>;
|
|
385
|
+
secrets?: LlmProfileSecretsInput;
|
|
386
|
+
models?: string[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Workspace LLM profile CRUD over the CLI user-token surface
|
|
390
|
+
* (`/v1/cli/llm-profiles`). Validation is entirely server-side; error messages
|
|
391
|
+
* come back user-ready. Self-hosted only: on Laminar Cloud every route 404s
|
|
392
|
+
* with `{error: "LLM profiles are not available on this deployment"}`.
|
|
393
|
+
*/
|
|
394
|
+
declare class LlmProfilesResource extends BaseResource {
|
|
395
|
+
constructor(baseHttpUrl: string, auth: LaminarAuth);
|
|
396
|
+
/**
|
|
397
|
+
* Errors come back as `{error: string}` (matches the signals surface) with
|
|
398
|
+
* user-facing text, so unwrap the envelope before raising rather than
|
|
399
|
+
* showing the raw JSON body.
|
|
400
|
+
*/
|
|
401
|
+
private raiseLlmProfileError;
|
|
402
|
+
private request;
|
|
403
|
+
/**
|
|
404
|
+
* Every workspace LLM profile visible to the caller, ordered
|
|
405
|
+
* case-insensitively by name. Empty array on a workspace with no profiles.
|
|
406
|
+
*/
|
|
407
|
+
list(): Promise<LlmProfile[]>;
|
|
408
|
+
get(profileId: string): Promise<LlmProfile>;
|
|
409
|
+
create(options: CreateLlmProfileOptions): Promise<LlmProfile>;
|
|
410
|
+
update(profileId: string, options: UpdateLlmProfileOptions): Promise<LlmProfile>;
|
|
411
|
+
/**
|
|
412
|
+
* Deletes the profile and returns it. The server refuses (409) when any
|
|
413
|
+
* signal still routes through the profile.
|
|
414
|
+
*/
|
|
415
|
+
delete(profileId: string): Promise<LlmProfile>;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
349
418
|
//#region src/resources/rollout-sessions.d.ts
|
|
350
419
|
/**
|
|
351
420
|
* Result of a debug-replay cache lookup (debug-replay v2).
|
|
@@ -482,10 +551,20 @@ interface CreateSignalOptions {
|
|
|
482
551
|
filters?: SignalFilter[];
|
|
483
552
|
/** Defaults to `"realtime"`. */
|
|
484
553
|
mode?: SignalMode;
|
|
554
|
+
/**
|
|
555
|
+
* Workspace LLM profile id (discover via `llmProfiles.list()`). Required
|
|
556
|
+
* together with `model` on self-hosted deployments; rejected on Laminar
|
|
557
|
+
* Cloud (the server has env-configured LLMs).
|
|
558
|
+
*/
|
|
559
|
+
llmProfileId?: string;
|
|
560
|
+
/** One of the profile's models. Required together with `llmProfileId`. */
|
|
561
|
+
model?: string;
|
|
485
562
|
}
|
|
486
563
|
/**
|
|
487
564
|
* A partial patch. Every field is optional and an ABSENT field leaves the stored
|
|
488
565
|
* value alone. `sampleRate: null` clears sampling, `filters: []` clears filters.
|
|
566
|
+
* `llmProfileId` + `model` must be sent together to re-route; the wire has no
|
|
567
|
+
* shape for clearing the route back to the server's env LLM.
|
|
489
568
|
*/
|
|
490
569
|
interface UpdateSignalOptions {
|
|
491
570
|
prompt?: string;
|
|
@@ -495,6 +574,8 @@ interface UpdateSignalOptions {
|
|
|
495
574
|
trigger?: SignalTrigger;
|
|
496
575
|
filters?: SignalFilter[];
|
|
497
576
|
mode?: SignalMode;
|
|
577
|
+
llmProfileId?: string;
|
|
578
|
+
model?: string;
|
|
498
579
|
}
|
|
499
580
|
/** Signals CRUD over the CLI user-token surface (`/v1/cli/signals`). */
|
|
500
581
|
declare class SignalsResource extends BaseResource {
|
|
@@ -509,6 +590,13 @@ declare class SignalsResource extends BaseResource {
|
|
|
509
590
|
private raiseSignalError;
|
|
510
591
|
list(name?: string): Promise<Signal[]>;
|
|
511
592
|
get(signalId: string): Promise<Signal>;
|
|
593
|
+
/**
|
|
594
|
+
* Historical judge definitions for `signalId`, oldest first. Distinct from
|
|
595
|
+
* `GET /signals/{id}`'s `version` field, which is only the current pointer.
|
|
596
|
+
* 404 if that id isn't in this project; an empty list only if the signal
|
|
597
|
+
* exists with no version rows.
|
|
598
|
+
*/
|
|
599
|
+
listVersions(signalId: string): Promise<SignalVersion[]>;
|
|
512
600
|
create(options: CreateSignalOptions): Promise<Signal>;
|
|
513
601
|
/**
|
|
514
602
|
* PATCH, not PUT: only the keys present in `options` are sent, so the server
|
|
@@ -640,6 +728,7 @@ declare class LaminarClient {
|
|
|
640
728
|
private _datasets;
|
|
641
729
|
private _evals;
|
|
642
730
|
private _evaluators;
|
|
731
|
+
private _llmProfiles;
|
|
643
732
|
private _rolloutSessions;
|
|
644
733
|
private _signals;
|
|
645
734
|
private _sql;
|
|
@@ -712,6 +801,7 @@ declare class LaminarClient {
|
|
|
712
801
|
get datasets(): DatasetsResource;
|
|
713
802
|
get evals(): EvalsResource;
|
|
714
803
|
get evaluators(): EvaluatorsResource;
|
|
804
|
+
get llmProfiles(): LlmProfilesResource;
|
|
715
805
|
get signals(): SignalsResource;
|
|
716
806
|
get rolloutSessions(): RolloutSessionsResource;
|
|
717
807
|
get sql(): SqlResource;
|
|
@@ -719,5 +809,5 @@ declare class LaminarClient {
|
|
|
719
809
|
get traces(): TracesResource;
|
|
720
810
|
}
|
|
721
811
|
//#endregion
|
|
722
|
-
export { type CacheOutcome, type CliProject, type CreateSignalOptions, type LaminarAuth, LaminarClient, type ProjectKeyProbe, RolloutSessionsResource, type UpdateSignalOptions };
|
|
812
|
+
export { type CacheOutcome, type CliProject, type CreateLlmProfileOptions, type CreateSignalOptions, type LaminarAuth, LaminarClient, type LlmProfileSecretsInput, type ProjectKeyProbe, RolloutSessionsResource, type UpdateLlmProfileOptions, type UpdateSignalOptions };
|
|
723
813
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CachedSpan, Datapoint, Dataset, EvaluationDatapoint, GetDatapointsResponse, InitEvaluationResponse, PushDatapointsResponse, SessionBlock, SessionBlockContent, SessionBlockType, Signal, SignalFilter, SignalMode, SignalStructuredOutput, SignalTrigger, SqlSchema, StringUUID } from "@lmnr-ai/types";
|
|
1
|
+
import { CachedSpan, Datapoint, Dataset, EvaluationDatapoint, GetDatapointsResponse, InitEvaluationResponse, LlmProfile, LlmProfileConfig, LlmProfileProvider, PushDatapointsResponse, SessionBlock, SessionBlockContent, SessionBlockType, Signal, SignalFilter, SignalMode, SignalStructuredOutput, SignalTrigger, SignalVersion, SqlSchema, StringUUID } from "@lmnr-ai/types";
|
|
2
2
|
|
|
3
3
|
//#region src/resources/index.d.ts
|
|
4
4
|
/**
|
|
@@ -107,6 +107,14 @@ declare class DatasetsResource extends BaseResource {
|
|
|
107
107
|
* @returns {Promise<Dataset[]>} Array of datasets
|
|
108
108
|
*/
|
|
109
109
|
listDatasets(): Promise<Dataset[]>;
|
|
110
|
+
/** Create an empty dataset. */
|
|
111
|
+
create(name: string): Promise<Dataset>;
|
|
112
|
+
/** Get a dataset by its canonical UUID. */
|
|
113
|
+
getById(datasetId: StringUUID): Promise<Dataset>;
|
|
114
|
+
/** Rename a dataset. */
|
|
115
|
+
update(datasetId: StringUUID, name: string): Promise<Dataset>;
|
|
116
|
+
/** Delete a dataset and its datapoints. */
|
|
117
|
+
delete(datasetId: StringUUID): Promise<Dataset>;
|
|
110
118
|
/**
|
|
111
119
|
* Get a dataset by name.
|
|
112
120
|
*
|
|
@@ -346,6 +354,67 @@ declare class EvaluatorsResource extends BaseResource {
|
|
|
346
354
|
score(options: ScoreOptions): Promise<void>;
|
|
347
355
|
}
|
|
348
356
|
//#endregion
|
|
357
|
+
//#region src/resources/llm-profiles.d.ts
|
|
358
|
+
/**
|
|
359
|
+
* Plaintext secrets for create/update. On update this is an OVERLAY: an
|
|
360
|
+
* omitted key keeps the stored secret, so credentials never need re-sending.
|
|
361
|
+
*/
|
|
362
|
+
interface LlmProfileSecretsInput {
|
|
363
|
+
apiKey?: string;
|
|
364
|
+
secretAccessKey?: string;
|
|
365
|
+
token?: string;
|
|
366
|
+
/** Values for the `custom` provider's `config.headerNames`. */
|
|
367
|
+
headers?: Record<string, string>;
|
|
368
|
+
}
|
|
369
|
+
interface CreateLlmProfileOptions {
|
|
370
|
+
name: string;
|
|
371
|
+
provider: LlmProfileProvider;
|
|
372
|
+
/** Omitted `auth` defaults to `{type: "api_key"}`. */
|
|
373
|
+
config?: Partial<LlmProfileConfig>;
|
|
374
|
+
secrets?: LlmProfileSecretsInput;
|
|
375
|
+
models: string[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A partial patch: omitted fields keep their stored value. `models` replaces
|
|
379
|
+
* the whole list when present; `config` is required when `provider` changes.
|
|
380
|
+
*/
|
|
381
|
+
interface UpdateLlmProfileOptions {
|
|
382
|
+
name?: string;
|
|
383
|
+
provider?: LlmProfileProvider;
|
|
384
|
+
config?: Partial<LlmProfileConfig>;
|
|
385
|
+
secrets?: LlmProfileSecretsInput;
|
|
386
|
+
models?: string[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Workspace LLM profile CRUD over the CLI user-token surface
|
|
390
|
+
* (`/v1/cli/llm-profiles`). Validation is entirely server-side; error messages
|
|
391
|
+
* come back user-ready. Self-hosted only: on Laminar Cloud every route 404s
|
|
392
|
+
* with `{error: "LLM profiles are not available on this deployment"}`.
|
|
393
|
+
*/
|
|
394
|
+
declare class LlmProfilesResource extends BaseResource {
|
|
395
|
+
constructor(baseHttpUrl: string, auth: LaminarAuth);
|
|
396
|
+
/**
|
|
397
|
+
* Errors come back as `{error: string}` (matches the signals surface) with
|
|
398
|
+
* user-facing text, so unwrap the envelope before raising rather than
|
|
399
|
+
* showing the raw JSON body.
|
|
400
|
+
*/
|
|
401
|
+
private raiseLlmProfileError;
|
|
402
|
+
private request;
|
|
403
|
+
/**
|
|
404
|
+
* Every workspace LLM profile visible to the caller, ordered
|
|
405
|
+
* case-insensitively by name. Empty array on a workspace with no profiles.
|
|
406
|
+
*/
|
|
407
|
+
list(): Promise<LlmProfile[]>;
|
|
408
|
+
get(profileId: string): Promise<LlmProfile>;
|
|
409
|
+
create(options: CreateLlmProfileOptions): Promise<LlmProfile>;
|
|
410
|
+
update(profileId: string, options: UpdateLlmProfileOptions): Promise<LlmProfile>;
|
|
411
|
+
/**
|
|
412
|
+
* Deletes the profile and returns it. The server refuses (409) when any
|
|
413
|
+
* signal still routes through the profile.
|
|
414
|
+
*/
|
|
415
|
+
delete(profileId: string): Promise<LlmProfile>;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
349
418
|
//#region src/resources/rollout-sessions.d.ts
|
|
350
419
|
/**
|
|
351
420
|
* Result of a debug-replay cache lookup (debug-replay v2).
|
|
@@ -482,10 +551,20 @@ interface CreateSignalOptions {
|
|
|
482
551
|
filters?: SignalFilter[];
|
|
483
552
|
/** Defaults to `"realtime"`. */
|
|
484
553
|
mode?: SignalMode;
|
|
554
|
+
/**
|
|
555
|
+
* Workspace LLM profile id (discover via `llmProfiles.list()`). Required
|
|
556
|
+
* together with `model` on self-hosted deployments; rejected on Laminar
|
|
557
|
+
* Cloud (the server has env-configured LLMs).
|
|
558
|
+
*/
|
|
559
|
+
llmProfileId?: string;
|
|
560
|
+
/** One of the profile's models. Required together with `llmProfileId`. */
|
|
561
|
+
model?: string;
|
|
485
562
|
}
|
|
486
563
|
/**
|
|
487
564
|
* A partial patch. Every field is optional and an ABSENT field leaves the stored
|
|
488
565
|
* value alone. `sampleRate: null` clears sampling, `filters: []` clears filters.
|
|
566
|
+
* `llmProfileId` + `model` must be sent together to re-route; the wire has no
|
|
567
|
+
* shape for clearing the route back to the server's env LLM.
|
|
489
568
|
*/
|
|
490
569
|
interface UpdateSignalOptions {
|
|
491
570
|
prompt?: string;
|
|
@@ -495,6 +574,8 @@ interface UpdateSignalOptions {
|
|
|
495
574
|
trigger?: SignalTrigger;
|
|
496
575
|
filters?: SignalFilter[];
|
|
497
576
|
mode?: SignalMode;
|
|
577
|
+
llmProfileId?: string;
|
|
578
|
+
model?: string;
|
|
498
579
|
}
|
|
499
580
|
/** Signals CRUD over the CLI user-token surface (`/v1/cli/signals`). */
|
|
500
581
|
declare class SignalsResource extends BaseResource {
|
|
@@ -509,6 +590,13 @@ declare class SignalsResource extends BaseResource {
|
|
|
509
590
|
private raiseSignalError;
|
|
510
591
|
list(name?: string): Promise<Signal[]>;
|
|
511
592
|
get(signalId: string): Promise<Signal>;
|
|
593
|
+
/**
|
|
594
|
+
* Historical judge definitions for `signalId`, oldest first. Distinct from
|
|
595
|
+
* `GET /signals/{id}`'s `version` field, which is only the current pointer.
|
|
596
|
+
* 404 if that id isn't in this project; an empty list only if the signal
|
|
597
|
+
* exists with no version rows.
|
|
598
|
+
*/
|
|
599
|
+
listVersions(signalId: string): Promise<SignalVersion[]>;
|
|
512
600
|
create(options: CreateSignalOptions): Promise<Signal>;
|
|
513
601
|
/**
|
|
514
602
|
* PATCH, not PUT: only the keys present in `options` are sent, so the server
|
|
@@ -640,6 +728,7 @@ declare class LaminarClient {
|
|
|
640
728
|
private _datasets;
|
|
641
729
|
private _evals;
|
|
642
730
|
private _evaluators;
|
|
731
|
+
private _llmProfiles;
|
|
643
732
|
private _rolloutSessions;
|
|
644
733
|
private _signals;
|
|
645
734
|
private _sql;
|
|
@@ -712,6 +801,7 @@ declare class LaminarClient {
|
|
|
712
801
|
get datasets(): DatasetsResource;
|
|
713
802
|
get evals(): EvalsResource;
|
|
714
803
|
get evaluators(): EvaluatorsResource;
|
|
804
|
+
get llmProfiles(): LlmProfilesResource;
|
|
715
805
|
get signals(): SignalsResource;
|
|
716
806
|
get rolloutSessions(): RolloutSessionsResource;
|
|
717
807
|
get sql(): SqlResource;
|
|
@@ -719,5 +809,5 @@ declare class LaminarClient {
|
|
|
719
809
|
get traces(): TracesResource;
|
|
720
810
|
}
|
|
721
811
|
//#endregion
|
|
722
|
-
export { type CacheOutcome, type CliProject, type CreateSignalOptions, type LaminarAuth, LaminarClient, type ProjectKeyProbe, RolloutSessionsResource, type UpdateSignalOptions };
|
|
812
|
+
export { type CacheOutcome, type CliProject, type CreateLlmProfileOptions, type CreateSignalOptions, type LaminarAuth, LaminarClient, type LlmProfileSecretsInput, type ProjectKeyProbe, RolloutSessionsResource, type UpdateLlmProfileOptions, type UpdateSignalOptions };
|
|
723
813
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { PinoPretty } from "pino-pretty";
|
|
|
5
5
|
import { v4 } from "uuid";
|
|
6
6
|
import { errorMessage } from "@lmnr-ai/types";
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.8.
|
|
8
|
+
var version = "0.8.46";
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/version.ts
|
|
11
11
|
function getLangVersion() {
|
|
@@ -215,6 +215,44 @@ var DatasetsResource = class extends BaseResource {
|
|
|
215
215
|
if (!response.ok) await this.handleError(response);
|
|
216
216
|
return response.json();
|
|
217
217
|
}
|
|
218
|
+
/** Create an empty dataset. */
|
|
219
|
+
async create(name) {
|
|
220
|
+
const response = await fetch(this.baseHttpUrl + this.apiPrefix + "/datasets", {
|
|
221
|
+
method: "POST",
|
|
222
|
+
headers: this.headers(),
|
|
223
|
+
body: JSON.stringify({ name })
|
|
224
|
+
});
|
|
225
|
+
if (!response.ok) await this.handleError(response);
|
|
226
|
+
return response.json();
|
|
227
|
+
}
|
|
228
|
+
/** Get a dataset by its canonical UUID. */
|
|
229
|
+
async getById(datasetId) {
|
|
230
|
+
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/datasets/${datasetId}`, {
|
|
231
|
+
method: "GET",
|
|
232
|
+
headers: this.headers()
|
|
233
|
+
});
|
|
234
|
+
if (!response.ok) await this.handleError(response);
|
|
235
|
+
return response.json();
|
|
236
|
+
}
|
|
237
|
+
/** Rename a dataset. */
|
|
238
|
+
async update(datasetId, name) {
|
|
239
|
+
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/datasets/${datasetId}`, {
|
|
240
|
+
method: "PATCH",
|
|
241
|
+
headers: this.headers(),
|
|
242
|
+
body: JSON.stringify({ name })
|
|
243
|
+
});
|
|
244
|
+
if (!response.ok) await this.handleError(response);
|
|
245
|
+
return response.json();
|
|
246
|
+
}
|
|
247
|
+
/** Delete a dataset and its datapoints. */
|
|
248
|
+
async delete(datasetId) {
|
|
249
|
+
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/datasets/${datasetId}`, {
|
|
250
|
+
method: "DELETE",
|
|
251
|
+
headers: this.headers()
|
|
252
|
+
});
|
|
253
|
+
if (!response.ok) await this.handleError(response);
|
|
254
|
+
return response.json();
|
|
255
|
+
}
|
|
218
256
|
/**
|
|
219
257
|
* Get a dataset by name.
|
|
220
258
|
*
|
|
@@ -560,6 +598,66 @@ var EvaluatorsResource = class extends BaseResource {
|
|
|
560
598
|
}
|
|
561
599
|
};
|
|
562
600
|
//#endregion
|
|
601
|
+
//#region src/resources/llm-profiles.ts
|
|
602
|
+
/**
|
|
603
|
+
* Workspace LLM profile CRUD over the CLI user-token surface
|
|
604
|
+
* (`/v1/cli/llm-profiles`). Validation is entirely server-side; error messages
|
|
605
|
+
* come back user-ready. Self-hosted only: on Laminar Cloud every route 404s
|
|
606
|
+
* with `{error: "LLM profiles are not available on this deployment"}`.
|
|
607
|
+
*/
|
|
608
|
+
var LlmProfilesResource = class extends BaseResource {
|
|
609
|
+
constructor(baseHttpUrl, auth) {
|
|
610
|
+
super(baseHttpUrl, auth);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Errors come back as `{error: string}` (matches the signals surface) with
|
|
614
|
+
* user-facing text, so unwrap the envelope before raising rather than
|
|
615
|
+
* showing the raw JSON body.
|
|
616
|
+
*/
|
|
617
|
+
async raiseLlmProfileError(response) {
|
|
618
|
+
const body = await response.text();
|
|
619
|
+
let message = body;
|
|
620
|
+
try {
|
|
621
|
+
const parsed = JSON.parse(body);
|
|
622
|
+
if (typeof parsed?.error === "string" && parsed.error.length > 0) message = parsed.error;
|
|
623
|
+
} catch {}
|
|
624
|
+
throw new Error(`${response.status} ${message}`);
|
|
625
|
+
}
|
|
626
|
+
async request(method, path, body) {
|
|
627
|
+
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/llm-profiles${path}`, {
|
|
628
|
+
method,
|
|
629
|
+
headers: this.headers(),
|
|
630
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
631
|
+
});
|
|
632
|
+
if (!response.ok) await this.raiseLlmProfileError(response);
|
|
633
|
+
return response;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Every workspace LLM profile visible to the caller, ordered
|
|
637
|
+
* case-insensitively by name. Empty array on a workspace with no profiles.
|
|
638
|
+
*/
|
|
639
|
+
async list() {
|
|
640
|
+
const body = await (await this.request("GET", "")).json();
|
|
641
|
+
return Array.isArray(body?.llmProfiles) ? body.llmProfiles : [];
|
|
642
|
+
}
|
|
643
|
+
async get(profileId) {
|
|
644
|
+
return (await this.request("GET", `/${profileId}`)).json();
|
|
645
|
+
}
|
|
646
|
+
async create(options) {
|
|
647
|
+
return (await this.request("POST", "", options)).json();
|
|
648
|
+
}
|
|
649
|
+
async update(profileId, options) {
|
|
650
|
+
return (await this.request("PATCH", `/${profileId}`, options)).json();
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Deletes the profile and returns it. The server refuses (409) when any
|
|
654
|
+
* signal still routes through the profile.
|
|
655
|
+
*/
|
|
656
|
+
async delete(profileId) {
|
|
657
|
+
return (await this.request("DELETE", `/${profileId}`)).json();
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
//#endregion
|
|
563
661
|
//#region src/resources/rollout-sessions.ts
|
|
564
662
|
const logger$1 = initializeLogger();
|
|
565
663
|
/**
|
|
@@ -790,6 +888,21 @@ var SignalsResource = class extends BaseResource {
|
|
|
790
888
|
if (!response.ok) await this.raiseSignalError(response);
|
|
791
889
|
return response.json();
|
|
792
890
|
}
|
|
891
|
+
/**
|
|
892
|
+
* Historical judge definitions for `signalId`, oldest first. Distinct from
|
|
893
|
+
* `GET /signals/{id}`'s `version` field, which is only the current pointer.
|
|
894
|
+
* 404 if that id isn't in this project; an empty list only if the signal
|
|
895
|
+
* exists with no version rows.
|
|
896
|
+
*/
|
|
897
|
+
async listVersions(signalId) {
|
|
898
|
+
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/signals/${signalId}/versions`, {
|
|
899
|
+
method: "GET",
|
|
900
|
+
headers: this.headers()
|
|
901
|
+
});
|
|
902
|
+
if (!response.ok) await this.raiseSignalError(response);
|
|
903
|
+
const body = await response.json();
|
|
904
|
+
return Array.isArray(body?.versions) ? body.versions : [];
|
|
905
|
+
}
|
|
793
906
|
async create(options) {
|
|
794
907
|
const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/signals`, {
|
|
795
908
|
method: "POST",
|
|
@@ -900,8 +1013,8 @@ var TagsResource = class extends BaseResource {
|
|
|
900
1013
|
const formattedTraceId = isStringUUID(trace_id) ? trace_id : otelTraceIdToUUID(trace_id);
|
|
901
1014
|
const url = this.baseHttpUrl + "/v1/tag";
|
|
902
1015
|
const payload = {
|
|
903
|
-
|
|
904
|
-
|
|
1016
|
+
traceId: formattedTraceId,
|
|
1017
|
+
names: traceTags
|
|
905
1018
|
};
|
|
906
1019
|
const response = await fetch(url, {
|
|
907
1020
|
method: "POST",
|
|
@@ -1008,6 +1121,7 @@ var LaminarClient = class LaminarClient {
|
|
|
1008
1121
|
this._datasets = new DatasetsResource(this.baseUrl, this.auth);
|
|
1009
1122
|
this._evals = new EvalsResource(this.baseUrl, this.auth);
|
|
1010
1123
|
this._evaluators = new EvaluatorsResource(this.baseUrl, this.auth);
|
|
1124
|
+
this._llmProfiles = new LlmProfilesResource(this.baseUrl, this.auth);
|
|
1011
1125
|
this._rolloutSessions = new RolloutSessionsResource(this.baseUrl, this.auth);
|
|
1012
1126
|
this._signals = new SignalsResource(this.baseUrl, this.auth);
|
|
1013
1127
|
this._sql = new SqlResource(this.baseUrl, this.auth);
|
|
@@ -1078,6 +1192,9 @@ var LaminarClient = class LaminarClient {
|
|
|
1078
1192
|
get evaluators() {
|
|
1079
1193
|
return this._evaluators;
|
|
1080
1194
|
}
|
|
1195
|
+
get llmProfiles() {
|
|
1196
|
+
return this._llmProfiles;
|
|
1197
|
+
}
|
|
1081
1198
|
get signals() {
|
|
1082
1199
|
return this._signals;
|
|
1083
1200
|
}
|