opik 1.11.0 → 1.11.2
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/chunk-WMVCENG3.js +10 -0
- package/dist/index.cjs +35 -35
- package/dist/index.d.cts +151 -5
- package/dist/index.d.ts +151 -5
- package/dist/index.js +30 -30
- package/dist/{typeHelpers-EBAVSLFP.js → typeHelpers-MEOKD5HI.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-HYAYEFG6.js +0 -10
package/dist/index.d.cts
CHANGED
|
@@ -1121,6 +1121,32 @@ interface ExperimentBatchUpdate {
|
|
|
1121
1121
|
mergeTags?: boolean;
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
|
+
/**
|
|
1125
|
+
* @example
|
|
1126
|
+
* {
|
|
1127
|
+
* datasetName: "dataset_name",
|
|
1128
|
+
* prompts: [{
|
|
1129
|
+
* model: "model",
|
|
1130
|
+
* messages: [{
|
|
1131
|
+
* role: "role",
|
|
1132
|
+
* content: {
|
|
1133
|
+
* "key": "value"
|
|
1134
|
+
* }
|
|
1135
|
+
* }]
|
|
1136
|
+
* }],
|
|
1137
|
+
* datasetId: "dataset_id"
|
|
1138
|
+
* }
|
|
1139
|
+
*/
|
|
1140
|
+
interface ExperimentExecutionRequest {
|
|
1141
|
+
datasetName: string;
|
|
1142
|
+
datasetVersionId?: string;
|
|
1143
|
+
prompts: PromptVariant[];
|
|
1144
|
+
projectName?: string;
|
|
1145
|
+
datasetId: string;
|
|
1146
|
+
versionHash?: string;
|
|
1147
|
+
promptVersions?: PromptVersionLink[];
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1124
1150
|
/**
|
|
1125
1151
|
* @example
|
|
1126
1152
|
* {
|
|
@@ -1918,6 +1944,7 @@ type PromptWriteTemplateStructure = (typeof PromptWriteTemplateStructure)[keyof
|
|
|
1918
1944
|
declare const PromptWriteType: {
|
|
1919
1945
|
readonly Mustache: "mustache";
|
|
1920
1946
|
readonly Jinja2: "jinja2";
|
|
1947
|
+
readonly Python: "python";
|
|
1921
1948
|
};
|
|
1922
1949
|
type PromptWriteType = (typeof PromptWriteType)[keyof typeof PromptWriteType];
|
|
1923
1950
|
|
|
@@ -2398,6 +2425,8 @@ interface SpanSearchStreamRequestPublic {
|
|
|
2398
2425
|
lastRetrievedId?: string;
|
|
2399
2426
|
/** Truncate image included in either input, output or metadata */
|
|
2400
2427
|
truncate?: boolean;
|
|
2428
|
+
/** Fields to exclude from the response */
|
|
2429
|
+
exclude?: SpanSearchStreamRequestPublicExcludeItem[];
|
|
2401
2430
|
/** Filter spans created from this time (ISO-8601 format). */
|
|
2402
2431
|
fromTime?: Date;
|
|
2403
2432
|
/** Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'. */
|
|
@@ -2452,6 +2481,33 @@ declare const GetSpansByProjectRequestType: {
|
|
|
2452
2481
|
};
|
|
2453
2482
|
type GetSpansByProjectRequestType = (typeof GetSpansByProjectRequestType)[keyof typeof GetSpansByProjectRequestType];
|
|
2454
2483
|
|
|
2484
|
+
/** Fields to exclude from the response */
|
|
2485
|
+
declare const SpanSearchStreamRequestPublicExcludeItem: {
|
|
2486
|
+
readonly Name: "name";
|
|
2487
|
+
readonly Type: "type";
|
|
2488
|
+
readonly StartTime: "start_time";
|
|
2489
|
+
readonly EndTime: "end_time";
|
|
2490
|
+
readonly Input: "input";
|
|
2491
|
+
readonly Output: "output";
|
|
2492
|
+
readonly Metadata: "metadata";
|
|
2493
|
+
readonly Model: "model";
|
|
2494
|
+
readonly Provider: "provider";
|
|
2495
|
+
readonly Tags: "tags";
|
|
2496
|
+
readonly Usage: "usage";
|
|
2497
|
+
readonly ErrorInfo: "error_info";
|
|
2498
|
+
readonly CreatedAt: "created_at";
|
|
2499
|
+
readonly CreatedBy: "created_by";
|
|
2500
|
+
readonly LastUpdatedBy: "last_updated_by";
|
|
2501
|
+
readonly FeedbackScores: "feedback_scores";
|
|
2502
|
+
readonly Comments: "comments";
|
|
2503
|
+
readonly TotalEstimatedCost: "total_estimated_cost";
|
|
2504
|
+
readonly TotalEstimatedCostVersion: "total_estimated_cost_version";
|
|
2505
|
+
readonly Duration: "duration";
|
|
2506
|
+
readonly Ttft: "ttft";
|
|
2507
|
+
readonly Source: "source";
|
|
2508
|
+
};
|
|
2509
|
+
type SpanSearchStreamRequestPublicExcludeItem = (typeof SpanSearchStreamRequestPublicExcludeItem)[keyof typeof SpanSearchStreamRequestPublicExcludeItem];
|
|
2510
|
+
|
|
2455
2511
|
declare const SpanSearchStreamRequestPublicType: {
|
|
2456
2512
|
readonly General: "general";
|
|
2457
2513
|
readonly Tool: "tool";
|
|
@@ -4409,6 +4465,11 @@ interface ExecutionPolicyWrite {
|
|
|
4409
4465
|
passThreshold?: number;
|
|
4410
4466
|
}
|
|
4411
4467
|
|
|
4468
|
+
interface ExperimentExecutionResponse {
|
|
4469
|
+
experiments?: ExperimentInfo[];
|
|
4470
|
+
totalItems?: number;
|
|
4471
|
+
}
|
|
4472
|
+
|
|
4412
4473
|
interface ExperimentGroupAggregationsResponse {
|
|
4413
4474
|
content?: Record<string, GroupContentWithAggregations>;
|
|
4414
4475
|
}
|
|
@@ -4418,6 +4479,11 @@ interface ExperimentGroupResponse {
|
|
|
4418
4479
|
details?: GroupDetails;
|
|
4419
4480
|
}
|
|
4420
4481
|
|
|
4482
|
+
interface ExperimentInfo {
|
|
4483
|
+
experimentId?: string;
|
|
4484
|
+
promptIndex?: number;
|
|
4485
|
+
}
|
|
4486
|
+
|
|
4421
4487
|
interface ExperimentItem {
|
|
4422
4488
|
id?: string;
|
|
4423
4489
|
experimentId: string;
|
|
@@ -5365,7 +5431,10 @@ interface ManualEvaluationResponse {
|
|
|
5365
5431
|
rulesApplied?: number;
|
|
5366
5432
|
}
|
|
5367
5433
|
|
|
5368
|
-
|
|
5434
|
+
interface Message {
|
|
5435
|
+
role: string;
|
|
5436
|
+
content: JsonNode;
|
|
5437
|
+
}
|
|
5369
5438
|
|
|
5370
5439
|
interface MultipartUploadPart {
|
|
5371
5440
|
eTag: string;
|
|
@@ -5764,6 +5833,13 @@ interface PromptTokensDetails {
|
|
|
5764
5833
|
cachedTokens?: number;
|
|
5765
5834
|
}
|
|
5766
5835
|
|
|
5836
|
+
interface PromptVariant {
|
|
5837
|
+
model: string;
|
|
5838
|
+
messages: Message[];
|
|
5839
|
+
configs?: Record<string, JsonNode>;
|
|
5840
|
+
promptVersions?: PromptVersionLink[];
|
|
5841
|
+
}
|
|
5842
|
+
|
|
5767
5843
|
interface PromptVersionDetail {
|
|
5768
5844
|
/** version unique identifier, generated if absent */
|
|
5769
5845
|
id?: string;
|
|
@@ -5790,9 +5866,17 @@ type PromptVersionDetailTemplateStructure = (typeof PromptVersionDetailTemplateS
|
|
|
5790
5866
|
declare const PromptVersionDetailType: {
|
|
5791
5867
|
readonly Mustache: "mustache";
|
|
5792
5868
|
readonly Jinja2: "jinja2";
|
|
5869
|
+
readonly Python: "python";
|
|
5793
5870
|
};
|
|
5794
5871
|
type PromptVersionDetailType = (typeof PromptVersionDetailType)[keyof typeof PromptVersionDetailType];
|
|
5795
5872
|
|
|
5873
|
+
interface PromptVersionLink {
|
|
5874
|
+
id: string;
|
|
5875
|
+
commit?: string;
|
|
5876
|
+
promptId?: string;
|
|
5877
|
+
promptName?: string;
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5796
5880
|
interface PromptVersionLinkPublic {
|
|
5797
5881
|
promptVersionId?: string;
|
|
5798
5882
|
commit?: string;
|
|
@@ -5837,6 +5921,7 @@ type PromptVersionPublicTemplateStructure = (typeof PromptVersionPublicTemplateS
|
|
|
5837
5921
|
declare const PromptVersionPublicType: {
|
|
5838
5922
|
readonly Mustache: "mustache";
|
|
5839
5923
|
readonly Jinja2: "jinja2";
|
|
5924
|
+
readonly Python: "python";
|
|
5840
5925
|
};
|
|
5841
5926
|
type PromptVersionPublicType = (typeof PromptVersionPublicType)[keyof typeof PromptVersionPublicType];
|
|
5842
5927
|
|
|
@@ -8623,6 +8708,29 @@ declare class ExperimentsClient {
|
|
|
8623
8708
|
*/
|
|
8624
8709
|
deleteExperimentsById(request: DeleteIdsHolder, requestOptions?: ExperimentsClient.RequestOptions): HttpResponsePromise<void>;
|
|
8625
8710
|
private __deleteExperimentsById;
|
|
8711
|
+
/**
|
|
8712
|
+
* Creates experiments for each prompt variant and asynchronously processes all dataset items
|
|
8713
|
+
*
|
|
8714
|
+
* @param {OpikApi.ExperimentExecutionRequest} request
|
|
8715
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
8716
|
+
*
|
|
8717
|
+
* @example
|
|
8718
|
+
* await client.experiments.executeExperiment({
|
|
8719
|
+
* datasetName: "dataset_name",
|
|
8720
|
+
* prompts: [{
|
|
8721
|
+
* model: "model",
|
|
8722
|
+
* messages: [{
|
|
8723
|
+
* role: "role",
|
|
8724
|
+
* content: {
|
|
8725
|
+
* "key": "value"
|
|
8726
|
+
* }
|
|
8727
|
+
* }]
|
|
8728
|
+
* }],
|
|
8729
|
+
* datasetId: "dataset_id"
|
|
8730
|
+
* })
|
|
8731
|
+
*/
|
|
8732
|
+
executeExperiment(request: ExperimentExecutionRequest, requestOptions?: ExperimentsClient.RequestOptions): HttpResponsePromise<ExperimentExecutionResponse>;
|
|
8733
|
+
private __executeExperiment;
|
|
8626
8734
|
/**
|
|
8627
8735
|
* Record experiment items in bulk with traces, spans, and feedback scores. Maximum request size is 4MB.
|
|
8628
8736
|
*
|
|
@@ -11495,6 +11603,8 @@ declare const PromptType: {
|
|
|
11495
11603
|
readonly MUSTACHE: "mustache";
|
|
11496
11604
|
/** Jinja2 template syntax with {% %} blocks and {{ }} variables */
|
|
11497
11605
|
readonly JINJA2: "jinja2";
|
|
11606
|
+
/** Python template syntax with {variable} placeholders */
|
|
11607
|
+
readonly PYTHON: "python";
|
|
11498
11608
|
};
|
|
11499
11609
|
type PromptType = (typeof PromptType)[keyof typeof PromptType];
|
|
11500
11610
|
/**
|
|
@@ -11669,8 +11779,8 @@ declare class PromptVersion {
|
|
|
11669
11779
|
* Base data interface for all prompt types
|
|
11670
11780
|
*/
|
|
11671
11781
|
interface BasePromptData {
|
|
11672
|
-
promptId
|
|
11673
|
-
versionId
|
|
11782
|
+
promptId?: string;
|
|
11783
|
+
versionId?: string;
|
|
11674
11784
|
name: string;
|
|
11675
11785
|
commit?: string;
|
|
11676
11786
|
metadata?: JsonNode;
|
|
@@ -11679,18 +11789,21 @@ interface BasePromptData {
|
|
|
11679
11789
|
description?: string;
|
|
11680
11790
|
tags?: string[];
|
|
11681
11791
|
templateStructure?: PromptTemplateStructure;
|
|
11792
|
+
synced?: boolean;
|
|
11682
11793
|
}
|
|
11683
11794
|
/**
|
|
11684
11795
|
* Abstract base class for all prompt types.
|
|
11685
11796
|
* Provides common functionality for versioning, property updates, and deletion.
|
|
11686
11797
|
*/
|
|
11687
11798
|
declare abstract class BasePrompt {
|
|
11688
|
-
readonly id: string;
|
|
11689
|
-
readonly versionId: string;
|
|
11799
|
+
readonly id: string | undefined;
|
|
11800
|
+
readonly versionId: string | undefined;
|
|
11690
11801
|
readonly commit: string | undefined;
|
|
11691
11802
|
readonly type: PromptType;
|
|
11692
11803
|
readonly changeDescription: string | undefined;
|
|
11693
11804
|
readonly templateStructure: PromptTemplateStructure;
|
|
11805
|
+
/** Whether the prompt has been successfully synced with the backend. */
|
|
11806
|
+
readonly synced: boolean;
|
|
11694
11807
|
protected _name: string;
|
|
11695
11808
|
protected _description: string | undefined;
|
|
11696
11809
|
protected _tags: string[];
|
|
@@ -11751,6 +11864,11 @@ declare abstract class BasePrompt {
|
|
|
11751
11864
|
* @returns Promise resolving to the API response or null if not found
|
|
11752
11865
|
*/
|
|
11753
11866
|
protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
|
|
11867
|
+
/**
|
|
11868
|
+
* Throws an error if the prompt has not been synced with the backend.
|
|
11869
|
+
* Call syncWithBackend() first to sync.
|
|
11870
|
+
*/
|
|
11871
|
+
protected requireSynced(operation: string): void;
|
|
11754
11872
|
/**
|
|
11755
11873
|
* Get a specific version by commit hash.
|
|
11756
11874
|
* Returns a new instance of the appropriate prompt type.
|
|
@@ -11766,6 +11884,15 @@ declare abstract class BasePrompt {
|
|
|
11766
11884
|
* @returns Promise resolving to a new prompt instance with the restored version
|
|
11767
11885
|
*/
|
|
11768
11886
|
abstract useVersion(version: PromptVersion): Promise<BasePrompt>;
|
|
11887
|
+
/**
|
|
11888
|
+
* Synchronize the prompt with the backend.
|
|
11889
|
+
*
|
|
11890
|
+
* Creates or updates the prompt on the Opik server. If the sync fails,
|
|
11891
|
+
* a warning is logged and the prompt continues to work locally.
|
|
11892
|
+
*
|
|
11893
|
+
* @returns Promise resolving to a new synced instance, or the same instance if sync fails
|
|
11894
|
+
*/
|
|
11895
|
+
abstract syncWithBackend(): Promise<BasePrompt>;
|
|
11769
11896
|
}
|
|
11770
11897
|
|
|
11771
11898
|
interface PromptData extends BasePromptData {
|
|
@@ -11871,6 +11998,15 @@ declare class Prompt extends BasePrompt {
|
|
|
11871
11998
|
* }
|
|
11872
11999
|
* ```
|
|
11873
12000
|
*/
|
|
12001
|
+
/**
|
|
12002
|
+
* Synchronize the prompt with the backend.
|
|
12003
|
+
*
|
|
12004
|
+
* Creates or updates the prompt on the Opik server. If the sync fails,
|
|
12005
|
+
* a warning is logged and the same (unsynced) instance is returned.
|
|
12006
|
+
*
|
|
12007
|
+
* @returns Promise resolving to a new synced Prompt instance, or this instance if sync fails
|
|
12008
|
+
*/
|
|
12009
|
+
syncWithBackend(): Promise<Prompt>;
|
|
11874
12010
|
getVersion(commit: string): Promise<Prompt | null>;
|
|
11875
12011
|
}
|
|
11876
12012
|
|
|
@@ -12563,6 +12699,15 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
12563
12699
|
* }
|
|
12564
12700
|
* ```
|
|
12565
12701
|
*/
|
|
12702
|
+
/**
|
|
12703
|
+
* Synchronize the chat prompt with the backend.
|
|
12704
|
+
*
|
|
12705
|
+
* Creates or updates the chat prompt on the Opik server. If the sync fails,
|
|
12706
|
+
* a warning is logged and the same (unsynced) instance is returned.
|
|
12707
|
+
*
|
|
12708
|
+
* @returns Promise resolving to a new synced ChatPrompt instance, or this instance if sync fails
|
|
12709
|
+
*/
|
|
12710
|
+
syncWithBackend(): Promise<ChatPrompt>;
|
|
12566
12711
|
getVersion(commit: string): Promise<ChatPrompt | null>;
|
|
12567
12712
|
}
|
|
12568
12713
|
|
|
@@ -13188,6 +13333,7 @@ declare class OpikClient {
|
|
|
13188
13333
|
filterString?: string;
|
|
13189
13334
|
maxResults?: number;
|
|
13190
13335
|
truncate?: boolean;
|
|
13336
|
+
exclude?: string[];
|
|
13191
13337
|
waitForAtLeast?: number;
|
|
13192
13338
|
waitForTimeout?: number;
|
|
13193
13339
|
}) => Promise<SpanPublic[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1121,6 +1121,32 @@ interface ExperimentBatchUpdate {
|
|
|
1121
1121
|
mergeTags?: boolean;
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
|
+
/**
|
|
1125
|
+
* @example
|
|
1126
|
+
* {
|
|
1127
|
+
* datasetName: "dataset_name",
|
|
1128
|
+
* prompts: [{
|
|
1129
|
+
* model: "model",
|
|
1130
|
+
* messages: [{
|
|
1131
|
+
* role: "role",
|
|
1132
|
+
* content: {
|
|
1133
|
+
* "key": "value"
|
|
1134
|
+
* }
|
|
1135
|
+
* }]
|
|
1136
|
+
* }],
|
|
1137
|
+
* datasetId: "dataset_id"
|
|
1138
|
+
* }
|
|
1139
|
+
*/
|
|
1140
|
+
interface ExperimentExecutionRequest {
|
|
1141
|
+
datasetName: string;
|
|
1142
|
+
datasetVersionId?: string;
|
|
1143
|
+
prompts: PromptVariant[];
|
|
1144
|
+
projectName?: string;
|
|
1145
|
+
datasetId: string;
|
|
1146
|
+
versionHash?: string;
|
|
1147
|
+
promptVersions?: PromptVersionLink[];
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1124
1150
|
/**
|
|
1125
1151
|
* @example
|
|
1126
1152
|
* {
|
|
@@ -1918,6 +1944,7 @@ type PromptWriteTemplateStructure = (typeof PromptWriteTemplateStructure)[keyof
|
|
|
1918
1944
|
declare const PromptWriteType: {
|
|
1919
1945
|
readonly Mustache: "mustache";
|
|
1920
1946
|
readonly Jinja2: "jinja2";
|
|
1947
|
+
readonly Python: "python";
|
|
1921
1948
|
};
|
|
1922
1949
|
type PromptWriteType = (typeof PromptWriteType)[keyof typeof PromptWriteType];
|
|
1923
1950
|
|
|
@@ -2398,6 +2425,8 @@ interface SpanSearchStreamRequestPublic {
|
|
|
2398
2425
|
lastRetrievedId?: string;
|
|
2399
2426
|
/** Truncate image included in either input, output or metadata */
|
|
2400
2427
|
truncate?: boolean;
|
|
2428
|
+
/** Fields to exclude from the response */
|
|
2429
|
+
exclude?: SpanSearchStreamRequestPublicExcludeItem[];
|
|
2401
2430
|
/** Filter spans created from this time (ISO-8601 format). */
|
|
2402
2431
|
fromTime?: Date;
|
|
2403
2432
|
/** Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'. */
|
|
@@ -2452,6 +2481,33 @@ declare const GetSpansByProjectRequestType: {
|
|
|
2452
2481
|
};
|
|
2453
2482
|
type GetSpansByProjectRequestType = (typeof GetSpansByProjectRequestType)[keyof typeof GetSpansByProjectRequestType];
|
|
2454
2483
|
|
|
2484
|
+
/** Fields to exclude from the response */
|
|
2485
|
+
declare const SpanSearchStreamRequestPublicExcludeItem: {
|
|
2486
|
+
readonly Name: "name";
|
|
2487
|
+
readonly Type: "type";
|
|
2488
|
+
readonly StartTime: "start_time";
|
|
2489
|
+
readonly EndTime: "end_time";
|
|
2490
|
+
readonly Input: "input";
|
|
2491
|
+
readonly Output: "output";
|
|
2492
|
+
readonly Metadata: "metadata";
|
|
2493
|
+
readonly Model: "model";
|
|
2494
|
+
readonly Provider: "provider";
|
|
2495
|
+
readonly Tags: "tags";
|
|
2496
|
+
readonly Usage: "usage";
|
|
2497
|
+
readonly ErrorInfo: "error_info";
|
|
2498
|
+
readonly CreatedAt: "created_at";
|
|
2499
|
+
readonly CreatedBy: "created_by";
|
|
2500
|
+
readonly LastUpdatedBy: "last_updated_by";
|
|
2501
|
+
readonly FeedbackScores: "feedback_scores";
|
|
2502
|
+
readonly Comments: "comments";
|
|
2503
|
+
readonly TotalEstimatedCost: "total_estimated_cost";
|
|
2504
|
+
readonly TotalEstimatedCostVersion: "total_estimated_cost_version";
|
|
2505
|
+
readonly Duration: "duration";
|
|
2506
|
+
readonly Ttft: "ttft";
|
|
2507
|
+
readonly Source: "source";
|
|
2508
|
+
};
|
|
2509
|
+
type SpanSearchStreamRequestPublicExcludeItem = (typeof SpanSearchStreamRequestPublicExcludeItem)[keyof typeof SpanSearchStreamRequestPublicExcludeItem];
|
|
2510
|
+
|
|
2455
2511
|
declare const SpanSearchStreamRequestPublicType: {
|
|
2456
2512
|
readonly General: "general";
|
|
2457
2513
|
readonly Tool: "tool";
|
|
@@ -4409,6 +4465,11 @@ interface ExecutionPolicyWrite {
|
|
|
4409
4465
|
passThreshold?: number;
|
|
4410
4466
|
}
|
|
4411
4467
|
|
|
4468
|
+
interface ExperimentExecutionResponse {
|
|
4469
|
+
experiments?: ExperimentInfo[];
|
|
4470
|
+
totalItems?: number;
|
|
4471
|
+
}
|
|
4472
|
+
|
|
4412
4473
|
interface ExperimentGroupAggregationsResponse {
|
|
4413
4474
|
content?: Record<string, GroupContentWithAggregations>;
|
|
4414
4475
|
}
|
|
@@ -4418,6 +4479,11 @@ interface ExperimentGroupResponse {
|
|
|
4418
4479
|
details?: GroupDetails;
|
|
4419
4480
|
}
|
|
4420
4481
|
|
|
4482
|
+
interface ExperimentInfo {
|
|
4483
|
+
experimentId?: string;
|
|
4484
|
+
promptIndex?: number;
|
|
4485
|
+
}
|
|
4486
|
+
|
|
4421
4487
|
interface ExperimentItem {
|
|
4422
4488
|
id?: string;
|
|
4423
4489
|
experimentId: string;
|
|
@@ -5365,7 +5431,10 @@ interface ManualEvaluationResponse {
|
|
|
5365
5431
|
rulesApplied?: number;
|
|
5366
5432
|
}
|
|
5367
5433
|
|
|
5368
|
-
|
|
5434
|
+
interface Message {
|
|
5435
|
+
role: string;
|
|
5436
|
+
content: JsonNode;
|
|
5437
|
+
}
|
|
5369
5438
|
|
|
5370
5439
|
interface MultipartUploadPart {
|
|
5371
5440
|
eTag: string;
|
|
@@ -5764,6 +5833,13 @@ interface PromptTokensDetails {
|
|
|
5764
5833
|
cachedTokens?: number;
|
|
5765
5834
|
}
|
|
5766
5835
|
|
|
5836
|
+
interface PromptVariant {
|
|
5837
|
+
model: string;
|
|
5838
|
+
messages: Message[];
|
|
5839
|
+
configs?: Record<string, JsonNode>;
|
|
5840
|
+
promptVersions?: PromptVersionLink[];
|
|
5841
|
+
}
|
|
5842
|
+
|
|
5767
5843
|
interface PromptVersionDetail {
|
|
5768
5844
|
/** version unique identifier, generated if absent */
|
|
5769
5845
|
id?: string;
|
|
@@ -5790,9 +5866,17 @@ type PromptVersionDetailTemplateStructure = (typeof PromptVersionDetailTemplateS
|
|
|
5790
5866
|
declare const PromptVersionDetailType: {
|
|
5791
5867
|
readonly Mustache: "mustache";
|
|
5792
5868
|
readonly Jinja2: "jinja2";
|
|
5869
|
+
readonly Python: "python";
|
|
5793
5870
|
};
|
|
5794
5871
|
type PromptVersionDetailType = (typeof PromptVersionDetailType)[keyof typeof PromptVersionDetailType];
|
|
5795
5872
|
|
|
5873
|
+
interface PromptVersionLink {
|
|
5874
|
+
id: string;
|
|
5875
|
+
commit?: string;
|
|
5876
|
+
promptId?: string;
|
|
5877
|
+
promptName?: string;
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5796
5880
|
interface PromptVersionLinkPublic {
|
|
5797
5881
|
promptVersionId?: string;
|
|
5798
5882
|
commit?: string;
|
|
@@ -5837,6 +5921,7 @@ type PromptVersionPublicTemplateStructure = (typeof PromptVersionPublicTemplateS
|
|
|
5837
5921
|
declare const PromptVersionPublicType: {
|
|
5838
5922
|
readonly Mustache: "mustache";
|
|
5839
5923
|
readonly Jinja2: "jinja2";
|
|
5924
|
+
readonly Python: "python";
|
|
5840
5925
|
};
|
|
5841
5926
|
type PromptVersionPublicType = (typeof PromptVersionPublicType)[keyof typeof PromptVersionPublicType];
|
|
5842
5927
|
|
|
@@ -8623,6 +8708,29 @@ declare class ExperimentsClient {
|
|
|
8623
8708
|
*/
|
|
8624
8709
|
deleteExperimentsById(request: DeleteIdsHolder, requestOptions?: ExperimentsClient.RequestOptions): HttpResponsePromise<void>;
|
|
8625
8710
|
private __deleteExperimentsById;
|
|
8711
|
+
/**
|
|
8712
|
+
* Creates experiments for each prompt variant and asynchronously processes all dataset items
|
|
8713
|
+
*
|
|
8714
|
+
* @param {OpikApi.ExperimentExecutionRequest} request
|
|
8715
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
8716
|
+
*
|
|
8717
|
+
* @example
|
|
8718
|
+
* await client.experiments.executeExperiment({
|
|
8719
|
+
* datasetName: "dataset_name",
|
|
8720
|
+
* prompts: [{
|
|
8721
|
+
* model: "model",
|
|
8722
|
+
* messages: [{
|
|
8723
|
+
* role: "role",
|
|
8724
|
+
* content: {
|
|
8725
|
+
* "key": "value"
|
|
8726
|
+
* }
|
|
8727
|
+
* }]
|
|
8728
|
+
* }],
|
|
8729
|
+
* datasetId: "dataset_id"
|
|
8730
|
+
* })
|
|
8731
|
+
*/
|
|
8732
|
+
executeExperiment(request: ExperimentExecutionRequest, requestOptions?: ExperimentsClient.RequestOptions): HttpResponsePromise<ExperimentExecutionResponse>;
|
|
8733
|
+
private __executeExperiment;
|
|
8626
8734
|
/**
|
|
8627
8735
|
* Record experiment items in bulk with traces, spans, and feedback scores. Maximum request size is 4MB.
|
|
8628
8736
|
*
|
|
@@ -11495,6 +11603,8 @@ declare const PromptType: {
|
|
|
11495
11603
|
readonly MUSTACHE: "mustache";
|
|
11496
11604
|
/** Jinja2 template syntax with {% %} blocks and {{ }} variables */
|
|
11497
11605
|
readonly JINJA2: "jinja2";
|
|
11606
|
+
/** Python template syntax with {variable} placeholders */
|
|
11607
|
+
readonly PYTHON: "python";
|
|
11498
11608
|
};
|
|
11499
11609
|
type PromptType = (typeof PromptType)[keyof typeof PromptType];
|
|
11500
11610
|
/**
|
|
@@ -11669,8 +11779,8 @@ declare class PromptVersion {
|
|
|
11669
11779
|
* Base data interface for all prompt types
|
|
11670
11780
|
*/
|
|
11671
11781
|
interface BasePromptData {
|
|
11672
|
-
promptId
|
|
11673
|
-
versionId
|
|
11782
|
+
promptId?: string;
|
|
11783
|
+
versionId?: string;
|
|
11674
11784
|
name: string;
|
|
11675
11785
|
commit?: string;
|
|
11676
11786
|
metadata?: JsonNode;
|
|
@@ -11679,18 +11789,21 @@ interface BasePromptData {
|
|
|
11679
11789
|
description?: string;
|
|
11680
11790
|
tags?: string[];
|
|
11681
11791
|
templateStructure?: PromptTemplateStructure;
|
|
11792
|
+
synced?: boolean;
|
|
11682
11793
|
}
|
|
11683
11794
|
/**
|
|
11684
11795
|
* Abstract base class for all prompt types.
|
|
11685
11796
|
* Provides common functionality for versioning, property updates, and deletion.
|
|
11686
11797
|
*/
|
|
11687
11798
|
declare abstract class BasePrompt {
|
|
11688
|
-
readonly id: string;
|
|
11689
|
-
readonly versionId: string;
|
|
11799
|
+
readonly id: string | undefined;
|
|
11800
|
+
readonly versionId: string | undefined;
|
|
11690
11801
|
readonly commit: string | undefined;
|
|
11691
11802
|
readonly type: PromptType;
|
|
11692
11803
|
readonly changeDescription: string | undefined;
|
|
11693
11804
|
readonly templateStructure: PromptTemplateStructure;
|
|
11805
|
+
/** Whether the prompt has been successfully synced with the backend. */
|
|
11806
|
+
readonly synced: boolean;
|
|
11694
11807
|
protected _name: string;
|
|
11695
11808
|
protected _description: string | undefined;
|
|
11696
11809
|
protected _tags: string[];
|
|
@@ -11751,6 +11864,11 @@ declare abstract class BasePrompt {
|
|
|
11751
11864
|
* @returns Promise resolving to the API response or null if not found
|
|
11752
11865
|
*/
|
|
11753
11866
|
protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
|
|
11867
|
+
/**
|
|
11868
|
+
* Throws an error if the prompt has not been synced with the backend.
|
|
11869
|
+
* Call syncWithBackend() first to sync.
|
|
11870
|
+
*/
|
|
11871
|
+
protected requireSynced(operation: string): void;
|
|
11754
11872
|
/**
|
|
11755
11873
|
* Get a specific version by commit hash.
|
|
11756
11874
|
* Returns a new instance of the appropriate prompt type.
|
|
@@ -11766,6 +11884,15 @@ declare abstract class BasePrompt {
|
|
|
11766
11884
|
* @returns Promise resolving to a new prompt instance with the restored version
|
|
11767
11885
|
*/
|
|
11768
11886
|
abstract useVersion(version: PromptVersion): Promise<BasePrompt>;
|
|
11887
|
+
/**
|
|
11888
|
+
* Synchronize the prompt with the backend.
|
|
11889
|
+
*
|
|
11890
|
+
* Creates or updates the prompt on the Opik server. If the sync fails,
|
|
11891
|
+
* a warning is logged and the prompt continues to work locally.
|
|
11892
|
+
*
|
|
11893
|
+
* @returns Promise resolving to a new synced instance, or the same instance if sync fails
|
|
11894
|
+
*/
|
|
11895
|
+
abstract syncWithBackend(): Promise<BasePrompt>;
|
|
11769
11896
|
}
|
|
11770
11897
|
|
|
11771
11898
|
interface PromptData extends BasePromptData {
|
|
@@ -11871,6 +11998,15 @@ declare class Prompt extends BasePrompt {
|
|
|
11871
11998
|
* }
|
|
11872
11999
|
* ```
|
|
11873
12000
|
*/
|
|
12001
|
+
/**
|
|
12002
|
+
* Synchronize the prompt with the backend.
|
|
12003
|
+
*
|
|
12004
|
+
* Creates or updates the prompt on the Opik server. If the sync fails,
|
|
12005
|
+
* a warning is logged and the same (unsynced) instance is returned.
|
|
12006
|
+
*
|
|
12007
|
+
* @returns Promise resolving to a new synced Prompt instance, or this instance if sync fails
|
|
12008
|
+
*/
|
|
12009
|
+
syncWithBackend(): Promise<Prompt>;
|
|
11874
12010
|
getVersion(commit: string): Promise<Prompt | null>;
|
|
11875
12011
|
}
|
|
11876
12012
|
|
|
@@ -12563,6 +12699,15 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
12563
12699
|
* }
|
|
12564
12700
|
* ```
|
|
12565
12701
|
*/
|
|
12702
|
+
/**
|
|
12703
|
+
* Synchronize the chat prompt with the backend.
|
|
12704
|
+
*
|
|
12705
|
+
* Creates or updates the chat prompt on the Opik server. If the sync fails,
|
|
12706
|
+
* a warning is logged and the same (unsynced) instance is returned.
|
|
12707
|
+
*
|
|
12708
|
+
* @returns Promise resolving to a new synced ChatPrompt instance, or this instance if sync fails
|
|
12709
|
+
*/
|
|
12710
|
+
syncWithBackend(): Promise<ChatPrompt>;
|
|
12566
12711
|
getVersion(commit: string): Promise<ChatPrompt | null>;
|
|
12567
12712
|
}
|
|
12568
12713
|
|
|
@@ -13188,6 +13333,7 @@ declare class OpikClient {
|
|
|
13188
13333
|
filterString?: string;
|
|
13189
13334
|
maxResults?: number;
|
|
13190
13335
|
truncate?: boolean;
|
|
13336
|
+
exclude?: string[];
|
|
13191
13337
|
waitForAtLeast?: number;
|
|
13192
13338
|
waitForTimeout?: number;
|
|
13193
13339
|
}) => Promise<SpanPublic[]>;
|