opik 1.9.75 → 1.9.76

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.d.cts CHANGED
@@ -614,6 +614,7 @@ interface ExperimentWrite {
614
614
  datasetName: string;
615
615
  name?: string;
616
616
  metadata?: JsonListStringWrite;
617
+ tags?: string[];
617
618
  type?: ExperimentWriteType;
618
619
  optimizationId?: string;
619
620
  status?: ExperimentWriteStatus;
@@ -727,6 +728,7 @@ interface FindExperimentGroupsAggregationsRequest {
727
728
  interface ExperimentUpdate {
728
729
  name?: string;
729
730
  metadata?: JsonNode;
731
+ tags?: string[];
730
732
  type?: ExperimentUpdateType;
731
733
  /** The status of the experiment */
732
734
  status?: ExperimentUpdateStatus;
@@ -4796,6 +4798,7 @@ interface ExperimentPublic {
4796
4798
  projectId?: string;
4797
4799
  name?: string;
4798
4800
  metadata?: JsonListStringPublic;
4801
+ tags?: string[];
4799
4802
  type?: ExperimentPublicType;
4800
4803
  optimizationId?: string;
4801
4804
  feedbackScores?: FeedbackScoreAveragePublic[];
@@ -10404,6 +10407,7 @@ interface PromptVersionData {
10404
10407
  type: PromptType;
10405
10408
  metadata?: JsonNode;
10406
10409
  changeDescription?: string;
10410
+ tags?: string[];
10407
10411
  createdAt?: Date;
10408
10412
  createdBy?: string;
10409
10413
  }
@@ -10420,6 +10424,7 @@ declare class PromptVersion {
10420
10424
  readonly type: PromptType;
10421
10425
  readonly metadata?: JsonNode;
10422
10426
  readonly changeDescription?: string;
10427
+ readonly tags?: string[];
10423
10428
  readonly createdAt?: Date;
10424
10429
  readonly createdBy?: string;
10425
10430
  constructor(data: PromptVersionData);
@@ -10572,21 +10577,36 @@ declare class Prompt {
10572
10577
  * Fetches and returns complete version history, sorted by creation date (newest first).
10573
10578
  * Automatically handles pagination to fetch all versions.
10574
10579
  *
10580
+ * @param options - Optional filtering, sorting, and search parameters
10581
+ * @param options.search - Search text to find in template or change description fields
10582
+ * @param options.sorting - Sorting specification (e.g., JSON array of sort criteria)
10583
+ * @param options.filters - Filter specification (e.g., JSON array of filter criteria)
10575
10584
  * @returns Promise resolving to array of all PromptVersion instances for this prompt
10576
10585
  * @throws OpikApiError if REST API call fails
10577
10586
  *
10578
10587
  * @example
10579
10588
  * ```typescript
10580
10589
  * const prompt = await client.getPrompt({ name: "my-prompt" });
10581
- * const versions = await prompt.getVersions();
10582
10590
  *
10583
- * console.log(`Found ${versions.length} versions`);
10584
- * versions.forEach(v => {
10585
- * console.log(`Commit: ${v.commit}, Age: ${v.getVersionAge()}`);
10591
+ * // Get all versions
10592
+ * const allVersions = await prompt.getVersions();
10593
+ *
10594
+ * // Get versions with tags filter
10595
+ * const prodVersions = await prompt.getVersions({
10596
+ * filters: JSON.stringify([{ field: "tags", operator: "contains", value: "production" }])
10597
+ * });
10598
+ *
10599
+ * // Search in templates
10600
+ * const searchResults = await prompt.getVersions({
10601
+ * search: "greeting"
10586
10602
  * });
10587
10603
  * ```
10588
10604
  */
10589
- getVersions(): Promise<PromptVersion[]>;
10605
+ getVersions(options?: {
10606
+ search?: string;
10607
+ sorting?: string;
10608
+ filters?: string;
10609
+ }): Promise<PromptVersion[]>;
10590
10610
  /**
10591
10611
  * Restores a specific version by creating a new version with content from the specified version.
10592
10612
  * The version must be obtained from the backend (e.g., via getVersions()).
@@ -11240,6 +11260,41 @@ declare class OpikClient {
11240
11260
  waitForTimeout?: number;
11241
11261
  }) => Promise<TracePublic[]>;
11242
11262
  flush: () => Promise<void>;
11263
+ /**
11264
+ * Updates tags for one or more prompt versions in a single batch operation.
11265
+ *
11266
+ * @param versionIds - Array of prompt version IDs to update
11267
+ * @param options - Update options
11268
+ * @param options.tags - Tags to set or merge:
11269
+ * - `[]`: Clear all tags (when mergeTags is false or unspecified)
11270
+ * - `['tag1', 'tag2']`: Set or merge tags (based on mergeTags)
11271
+ * @param options.mergeTags - If true, adds new tags to existing tags (union). If false, replaces all existing tags (default: false)
11272
+ * @returns Promise that resolves when update is complete
11273
+ * @throws OpikApiError if update fails
11274
+ *
11275
+ * @example
11276
+ * ```typescript
11277
+ * // Replace tags on multiple versions (default behavior)
11278
+ * await client.updatePromptVersionTags(["version-id-1", "version-id-2"], {
11279
+ * tags: ["production", "v2"]
11280
+ * });
11281
+ *
11282
+ * // Merge new tags with existing tags
11283
+ * await client.updatePromptVersionTags(["version-id-1"], {
11284
+ * tags: ["hotfix"],
11285
+ * mergeTags: true
11286
+ * });
11287
+ *
11288
+ * // Clear all tags
11289
+ * await client.updatePromptVersionTags(["version-id-1"], {
11290
+ * tags: []
11291
+ * });
11292
+ * ```
11293
+ */
11294
+ updatePromptVersionTags: (versionIds: string[], options?: {
11295
+ tags?: string[] | null;
11296
+ mergeTags?: boolean;
11297
+ }) => Promise<void>;
11243
11298
  }
11244
11299
 
11245
11300
  type TrackContext = {
package/dist/index.d.ts CHANGED
@@ -614,6 +614,7 @@ interface ExperimentWrite {
614
614
  datasetName: string;
615
615
  name?: string;
616
616
  metadata?: JsonListStringWrite;
617
+ tags?: string[];
617
618
  type?: ExperimentWriteType;
618
619
  optimizationId?: string;
619
620
  status?: ExperimentWriteStatus;
@@ -727,6 +728,7 @@ interface FindExperimentGroupsAggregationsRequest {
727
728
  interface ExperimentUpdate {
728
729
  name?: string;
729
730
  metadata?: JsonNode;
731
+ tags?: string[];
730
732
  type?: ExperimentUpdateType;
731
733
  /** The status of the experiment */
732
734
  status?: ExperimentUpdateStatus;
@@ -4796,6 +4798,7 @@ interface ExperimentPublic {
4796
4798
  projectId?: string;
4797
4799
  name?: string;
4798
4800
  metadata?: JsonListStringPublic;
4801
+ tags?: string[];
4799
4802
  type?: ExperimentPublicType;
4800
4803
  optimizationId?: string;
4801
4804
  feedbackScores?: FeedbackScoreAveragePublic[];
@@ -10404,6 +10407,7 @@ interface PromptVersionData {
10404
10407
  type: PromptType;
10405
10408
  metadata?: JsonNode;
10406
10409
  changeDescription?: string;
10410
+ tags?: string[];
10407
10411
  createdAt?: Date;
10408
10412
  createdBy?: string;
10409
10413
  }
@@ -10420,6 +10424,7 @@ declare class PromptVersion {
10420
10424
  readonly type: PromptType;
10421
10425
  readonly metadata?: JsonNode;
10422
10426
  readonly changeDescription?: string;
10427
+ readonly tags?: string[];
10423
10428
  readonly createdAt?: Date;
10424
10429
  readonly createdBy?: string;
10425
10430
  constructor(data: PromptVersionData);
@@ -10572,21 +10577,36 @@ declare class Prompt {
10572
10577
  * Fetches and returns complete version history, sorted by creation date (newest first).
10573
10578
  * Automatically handles pagination to fetch all versions.
10574
10579
  *
10580
+ * @param options - Optional filtering, sorting, and search parameters
10581
+ * @param options.search - Search text to find in template or change description fields
10582
+ * @param options.sorting - Sorting specification (e.g., JSON array of sort criteria)
10583
+ * @param options.filters - Filter specification (e.g., JSON array of filter criteria)
10575
10584
  * @returns Promise resolving to array of all PromptVersion instances for this prompt
10576
10585
  * @throws OpikApiError if REST API call fails
10577
10586
  *
10578
10587
  * @example
10579
10588
  * ```typescript
10580
10589
  * const prompt = await client.getPrompt({ name: "my-prompt" });
10581
- * const versions = await prompt.getVersions();
10582
10590
  *
10583
- * console.log(`Found ${versions.length} versions`);
10584
- * versions.forEach(v => {
10585
- * console.log(`Commit: ${v.commit}, Age: ${v.getVersionAge()}`);
10591
+ * // Get all versions
10592
+ * const allVersions = await prompt.getVersions();
10593
+ *
10594
+ * // Get versions with tags filter
10595
+ * const prodVersions = await prompt.getVersions({
10596
+ * filters: JSON.stringify([{ field: "tags", operator: "contains", value: "production" }])
10597
+ * });
10598
+ *
10599
+ * // Search in templates
10600
+ * const searchResults = await prompt.getVersions({
10601
+ * search: "greeting"
10586
10602
  * });
10587
10603
  * ```
10588
10604
  */
10589
- getVersions(): Promise<PromptVersion[]>;
10605
+ getVersions(options?: {
10606
+ search?: string;
10607
+ sorting?: string;
10608
+ filters?: string;
10609
+ }): Promise<PromptVersion[]>;
10590
10610
  /**
10591
10611
  * Restores a specific version by creating a new version with content from the specified version.
10592
10612
  * The version must be obtained from the backend (e.g., via getVersions()).
@@ -11240,6 +11260,41 @@ declare class OpikClient {
11240
11260
  waitForTimeout?: number;
11241
11261
  }) => Promise<TracePublic[]>;
11242
11262
  flush: () => Promise<void>;
11263
+ /**
11264
+ * Updates tags for one or more prompt versions in a single batch operation.
11265
+ *
11266
+ * @param versionIds - Array of prompt version IDs to update
11267
+ * @param options - Update options
11268
+ * @param options.tags - Tags to set or merge:
11269
+ * - `[]`: Clear all tags (when mergeTags is false or unspecified)
11270
+ * - `['tag1', 'tag2']`: Set or merge tags (based on mergeTags)
11271
+ * @param options.mergeTags - If true, adds new tags to existing tags (union). If false, replaces all existing tags (default: false)
11272
+ * @returns Promise that resolves when update is complete
11273
+ * @throws OpikApiError if update fails
11274
+ *
11275
+ * @example
11276
+ * ```typescript
11277
+ * // Replace tags on multiple versions (default behavior)
11278
+ * await client.updatePromptVersionTags(["version-id-1", "version-id-2"], {
11279
+ * tags: ["production", "v2"]
11280
+ * });
11281
+ *
11282
+ * // Merge new tags with existing tags
11283
+ * await client.updatePromptVersionTags(["version-id-1"], {
11284
+ * tags: ["hotfix"],
11285
+ * mergeTags: true
11286
+ * });
11287
+ *
11288
+ * // Clear all tags
11289
+ * await client.updatePromptVersionTags(["version-id-1"], {
11290
+ * tags: []
11291
+ * });
11292
+ * ```
11293
+ */
11294
+ updatePromptVersionTags: (versionIds: string[], options?: {
11295
+ tags?: string[] | null;
11296
+ mergeTags?: boolean;
11297
+ }) => Promise<void>;
11243
11298
  }
11244
11299
 
11245
11300
  type TrackContext = {