opik 2.0.44 → 2.0.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.d.cts CHANGED
@@ -12142,10 +12142,23 @@ interface CreatePromptOptions extends CommonPromptOptions {
12142
12142
  projectName?: string;
12143
12143
  }
12144
12144
  /**
12145
- * Options for retrieving a specific prompt version
12146
- * Re-exported from REST API PromptVersionRetrieveDetail
12145
+ * Options for retrieving a specific prompt version.
12146
+ *
12147
+ * `commit` and `version` are mutually exclusive. If neither is provided,
12148
+ * the latest version is returned.
12147
12149
  */
12148
- type GetPromptOptions = PromptVersionRetrieveDetail;
12150
+ interface GetPromptOptions {
12151
+ /** Name of the prompt to retrieve. */
12152
+ name: string;
12153
+ /** @deprecated Use `version` instead. */
12154
+ commit?: string;
12155
+ /**
12156
+ * Sequential version identifier, e.g. `"v3"`. Mutually exclusive with `commit`.
12157
+ */
12158
+ version?: string;
12159
+ /** Optional project name to scope the lookup. */
12160
+ projectName?: string;
12161
+ }
12149
12162
  /**
12150
12163
  * Variables to be substituted into prompt template.
12151
12164
  */
@@ -12157,6 +12170,7 @@ interface PromptVersionData {
12157
12170
  name: string;
12158
12171
  prompt: string;
12159
12172
  commit: string;
12173
+ version?: string;
12160
12174
  promptId: string;
12161
12175
  versionId: string;
12162
12176
  type: PromptType;
@@ -12214,7 +12228,15 @@ declare class PromptVersion {
12214
12228
  readonly id: string;
12215
12229
  readonly name: string;
12216
12230
  readonly prompt: string;
12231
+ /**
12232
+ * @deprecated Legacy commit hash of this prompt version. Use {@link version} instead — `commit` is no longer surfaced in the Opik UI and is kept only for backwards compatibility with older SDK callers.
12233
+ */
12217
12234
  readonly commit: string;
12235
+ /**
12236
+ * Sequential version identifier of this prompt version (e.g. `"v3"`).
12237
+ * Undefined for mask versions, which do not carry a version number.
12238
+ */
12239
+ readonly version?: string;
12218
12240
  readonly type: PromptType;
12219
12241
  readonly metadata?: JsonNode;
12220
12242
  readonly changeDescription?: string;
@@ -12231,8 +12253,9 @@ declare class PromptVersion {
12231
12253
  */
12232
12254
  getVersionAge(): string;
12233
12255
  /**
12234
- * Get formatted version information string
12235
- * Format: "[commitHash] YYYY-MM-DD by user@email.com - Change description"
12256
+ * Get formatted version information string.
12257
+ * Format: "[v3] YYYY-MM-DD by user@email.com - Change description"
12258
+ * (falls back to the commit hash for mask versions, which have no version number).
12236
12259
  */
12237
12260
  getVersionInfo(): string;
12238
12261
  /**
@@ -12247,11 +12270,11 @@ declare class PromptVersion {
12247
12270
  *
12248
12271
  * @example
12249
12272
  * ```typescript
12250
- * const currentVersion = await prompt.getVersion("commit123");
12251
- * const previousVersion = await prompt.getVersion("commit456");
12273
+ * const versions = await prompt.getVersions();
12274
+ * const [current, previous] = versions;
12252
12275
  *
12253
12276
  * // Logs diff to terminal and returns it
12254
- * const diff = currentVersion.compareTo(previousVersion);
12277
+ * const diff = current.compareTo(previous);
12255
12278
  * ```
12256
12279
  */
12257
12280
  compareTo(other: PromptVersion): string;
@@ -12277,6 +12300,7 @@ interface BasePromptData {
12277
12300
  versionId?: string;
12278
12301
  name: string;
12279
12302
  commit?: string;
12303
+ version?: string;
12280
12304
  metadata?: JsonNode;
12281
12305
  type?: PromptType;
12282
12306
  changeDescription?: string;
@@ -12294,6 +12318,7 @@ declare abstract class BasePrompt {
12294
12318
  private _id;
12295
12319
  private _versionId;
12296
12320
  private _commit;
12321
+ private _version;
12297
12322
  private _synced;
12298
12323
  private _changeDescription;
12299
12324
  private _projectName;
@@ -12309,6 +12334,7 @@ declare abstract class BasePrompt {
12309
12334
  get id(): string | undefined;
12310
12335
  get versionId(): string | undefined;
12311
12336
  get commit(): string | undefined;
12337
+ get version(): string | undefined;
12312
12338
  /** Whether the prompt has been successfully synced with the backend. */
12313
12339
  get synced(): boolean;
12314
12340
  get changeDescription(): string | undefined;
@@ -12321,6 +12347,7 @@ declare abstract class BasePrompt {
12321
12347
  promptId?: string;
12322
12348
  versionId?: string;
12323
12349
  commit?: string;
12350
+ version?: string;
12324
12351
  changeDescription?: string;
12325
12352
  tags?: string[];
12326
12353
  projectName?: string;
@@ -12384,26 +12411,31 @@ declare abstract class BasePrompt {
12384
12411
  */
12385
12412
  protected restoreVersion(version: PromptVersion): Promise<PromptVersionDetail>;
12386
12413
  /**
12387
- * Helper method to retrieve a version by commit hash.
12388
- * Used by subclasses in their getVersion implementations.
12414
+ * Helper method to retrieve a version by its sequential version identifier
12415
+ * (e.g. `"v3"`) or, for backwards compatibility, by its commit hash.
12389
12416
  *
12390
- * @param commit - Commit hash (8-char short form or full)
12417
+ * Input matching `/^v\d+$/` is dispatched to the `versionNumber` endpoint;
12418
+ * anything else is treated as a commit hash. Commit-based fetching is
12419
+ * deprecated — pass a `"v<N>"` identifier instead.
12420
+ *
12421
+ * @param version - Sequential version (`"v3"`) or commit hash (deprecated)
12391
12422
  * @returns Promise resolving to the API response or null if not found
12392
12423
  */
12393
- protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
12424
+ protected retrieveVersion(version: string): Promise<PromptVersionDetail | null>;
12394
12425
  /**
12395
12426
  * Throws an error if the prompt has not been successfully synced with the backend.
12396
12427
  * Used internally before backend operations to ensure we have a valid prompt ID.
12397
12428
  */
12398
12429
  protected ensureSynced(operation: string): void;
12399
12430
  /**
12400
- * Get a specific version by commit hash.
12401
- * Returns a new instance of the appropriate prompt type.
12431
+ * Get a specific version by its sequential version identifier (e.g. `"v3"`)
12432
+ * or, for backwards compatibility, by its commit hash. Returns a new instance
12433
+ * of the appropriate prompt type.
12402
12434
  *
12403
- * @param commit - Commit hash (8-char short form or full)
12435
+ * @param version - Sequential version (`"v<N>"`) preferred; or commit hash (deprecated)
12404
12436
  * @returns Promise resolving to prompt instance or null if not found
12405
12437
  */
12406
- abstract getVersion(commit: string): Promise<BasePrompt | null>;
12438
+ abstract getVersion(version: string): Promise<BasePrompt | null>;
12407
12439
  /**
12408
12440
  * Restores a specific version by creating a new version with content from the specified version.
12409
12441
  *
@@ -13262,12 +13294,26 @@ declare class Prompt extends BasePrompt {
13262
13294
  */
13263
13295
  syncWithBackend(): Promise<Prompt>;
13264
13296
  /**
13265
- * Get a Prompt with a specific version by commit hash.
13297
+ * Get a Prompt at a specific version.
13298
+ *
13299
+ * Accepts either the sequential version identifier (e.g. `"v3"`) — preferred —
13300
+ * or a commit hash for backwards compatibility. Inputs matching `/^v\d+$/`
13301
+ * are treated as version numbers; anything else is treated as a commit.
13266
13302
  *
13267
- * @param commit - Commit hash (8-char short form or full)
13303
+ * @param version - Sequential version (`"v<N>"`) or commit hash
13304
+ * (commit input is **deprecated** — pass a `"v<N>"` identifier instead).
13268
13305
  * @returns Prompt instance representing that version, or null if not found
13306
+ *
13307
+ * @example
13308
+ * ```typescript
13309
+ * // Preferred
13310
+ * const v3 = await prompt.getVersion("v3");
13311
+ *
13312
+ * // @deprecated — commit-shaped input
13313
+ * const byCommit = await prompt.getVersion("abc123de");
13314
+ * ```
13269
13315
  */
13270
- getVersion(commit: string): Promise<Prompt | null>;
13316
+ getVersion(version: string): Promise<Prompt | null>;
13271
13317
  }
13272
13318
 
13273
13319
  interface EvaluateTestSuiteOptions<T = Record<string, unknown>> {
@@ -13807,12 +13853,26 @@ declare class ChatPrompt extends BasePrompt {
13807
13853
  */
13808
13854
  syncWithBackend(): Promise<ChatPrompt>;
13809
13855
  /**
13810
- * Get a ChatPrompt with a specific version by commit hash.
13856
+ * Get a ChatPrompt at a specific version.
13857
+ *
13858
+ * Accepts either the sequential version identifier (e.g. `"v3"`) — preferred —
13859
+ * or a commit hash for backwards compatibility. Inputs matching `/^v\d+$/`
13860
+ * are treated as version numbers; anything else is treated as a commit.
13811
13861
  *
13812
- * @param commit - Commit hash (8-char short form or full)
13862
+ * @param version - Sequential version (`"v<N>"`) or commit hash
13863
+ * (commit input is **deprecated** — pass a `"v<N>"` identifier instead).
13813
13864
  * @returns ChatPrompt instance representing that version, or null if not found
13865
+ *
13866
+ * @example
13867
+ * ```typescript
13868
+ * // Preferred
13869
+ * const v3 = await chatPrompt.getVersion("v3");
13870
+ *
13871
+ * // @deprecated — commit-shaped input
13872
+ * const byCommit = await chatPrompt.getVersion("abc123de");
13873
+ * ```
13814
13874
  */
13815
- getVersion(commit: string): Promise<ChatPrompt | null>;
13875
+ getVersion(version: string): Promise<ChatPrompt | null>;
13816
13876
  }
13817
13877
 
13818
13878
  interface AnnotationQueueData {
@@ -14221,24 +14281,36 @@ declare class OpikClient {
14221
14281
  */
14222
14282
  createChatPrompt: (options: CreateChatPromptOptions) => Promise<ChatPrompt>;
14223
14283
  /**
14224
- * Retrieves a text prompt by name and optional version.
14284
+ * Retrieves a text prompt by name, optionally targeting a specific `version`.
14225
14285
  * Results are cached client-side (TTL configurable via OPIK_PROMPT_CACHE_TTL_SECONDS,
14226
- * default 300s). Pinned commits are cached indefinitely. When called inside a track()
14227
- * context the prompt reference is injected into the active trace/span metadata.
14228
- *
14229
- * @param options - Prompt name and optional commit hash
14286
+ * default 300s). When called inside a track() context the prompt reference
14287
+ * is injected into the active trace/span metadata.
14288
+ *
14289
+ * @param options - Prompt name and optional version pin
14290
+ * @param options.name - Name of the prompt
14291
+ * @param options.version - Sequential version identifier (e.g. `"v3"`). If not
14292
+ * provided, the latest version is returned.
14293
+ * @param options.commit - **Deprecated.** Use `version` instead.
14294
+ * @param options.projectName - Optional project scope.
14230
14295
  * @returns Promise resolving to Prompt or null if not found
14296
+ * @throws Error if both `commit` and `version` are provided
14231
14297
  * @throws PromptTemplateStructureMismatch if prompt exists but is a chat prompt
14232
14298
  */
14233
14299
  getPrompt: (options: GetPromptOptions) => Promise<Prompt | null>;
14234
14300
  /**
14235
- * Retrieves a chat prompt by name and optional version.
14301
+ * Retrieves a chat prompt by name, optionally targeting a specific `version`.
14236
14302
  * Results are cached client-side (TTL configurable via OPIK_PROMPT_CACHE_TTL_SECONDS,
14237
- * default 300s). Pinned commits are cached indefinitely. When called inside a track()
14238
- * context the prompt reference is injected into the active trace/span metadata.
14239
- *
14240
- * @param options - Prompt name and optional commit hash
14303
+ * default 300s). When called inside a track() context the prompt reference
14304
+ * is injected into the active trace/span metadata.
14305
+ *
14306
+ * @param options - Prompt name and optional version pin
14307
+ * @param options.name - Name of the prompt
14308
+ * @param options.version - Sequential version identifier (e.g. `"v3"`). If not
14309
+ * provided, the latest version is returned.
14310
+ * @param options.commit - **Deprecated.** Use `version` instead.
14311
+ * @param options.projectName - Optional project scope.
14241
14312
  * @returns Promise resolving to ChatPrompt or null if not found
14313
+ * @throws Error if both `commit` and `version` are provided
14242
14314
  * @throws PromptTemplateStructureMismatch if prompt exists but is a text prompt
14243
14315
  *
14244
14316
  * @example
package/dist/index.d.ts CHANGED
@@ -12142,10 +12142,23 @@ interface CreatePromptOptions extends CommonPromptOptions {
12142
12142
  projectName?: string;
12143
12143
  }
12144
12144
  /**
12145
- * Options for retrieving a specific prompt version
12146
- * Re-exported from REST API PromptVersionRetrieveDetail
12145
+ * Options for retrieving a specific prompt version.
12146
+ *
12147
+ * `commit` and `version` are mutually exclusive. If neither is provided,
12148
+ * the latest version is returned.
12147
12149
  */
12148
- type GetPromptOptions = PromptVersionRetrieveDetail;
12150
+ interface GetPromptOptions {
12151
+ /** Name of the prompt to retrieve. */
12152
+ name: string;
12153
+ /** @deprecated Use `version` instead. */
12154
+ commit?: string;
12155
+ /**
12156
+ * Sequential version identifier, e.g. `"v3"`. Mutually exclusive with `commit`.
12157
+ */
12158
+ version?: string;
12159
+ /** Optional project name to scope the lookup. */
12160
+ projectName?: string;
12161
+ }
12149
12162
  /**
12150
12163
  * Variables to be substituted into prompt template.
12151
12164
  */
@@ -12157,6 +12170,7 @@ interface PromptVersionData {
12157
12170
  name: string;
12158
12171
  prompt: string;
12159
12172
  commit: string;
12173
+ version?: string;
12160
12174
  promptId: string;
12161
12175
  versionId: string;
12162
12176
  type: PromptType;
@@ -12214,7 +12228,15 @@ declare class PromptVersion {
12214
12228
  readonly id: string;
12215
12229
  readonly name: string;
12216
12230
  readonly prompt: string;
12231
+ /**
12232
+ * @deprecated Legacy commit hash of this prompt version. Use {@link version} instead — `commit` is no longer surfaced in the Opik UI and is kept only for backwards compatibility with older SDK callers.
12233
+ */
12217
12234
  readonly commit: string;
12235
+ /**
12236
+ * Sequential version identifier of this prompt version (e.g. `"v3"`).
12237
+ * Undefined for mask versions, which do not carry a version number.
12238
+ */
12239
+ readonly version?: string;
12218
12240
  readonly type: PromptType;
12219
12241
  readonly metadata?: JsonNode;
12220
12242
  readonly changeDescription?: string;
@@ -12231,8 +12253,9 @@ declare class PromptVersion {
12231
12253
  */
12232
12254
  getVersionAge(): string;
12233
12255
  /**
12234
- * Get formatted version information string
12235
- * Format: "[commitHash] YYYY-MM-DD by user@email.com - Change description"
12256
+ * Get formatted version information string.
12257
+ * Format: "[v3] YYYY-MM-DD by user@email.com - Change description"
12258
+ * (falls back to the commit hash for mask versions, which have no version number).
12236
12259
  */
12237
12260
  getVersionInfo(): string;
12238
12261
  /**
@@ -12247,11 +12270,11 @@ declare class PromptVersion {
12247
12270
  *
12248
12271
  * @example
12249
12272
  * ```typescript
12250
- * const currentVersion = await prompt.getVersion("commit123");
12251
- * const previousVersion = await prompt.getVersion("commit456");
12273
+ * const versions = await prompt.getVersions();
12274
+ * const [current, previous] = versions;
12252
12275
  *
12253
12276
  * // Logs diff to terminal and returns it
12254
- * const diff = currentVersion.compareTo(previousVersion);
12277
+ * const diff = current.compareTo(previous);
12255
12278
  * ```
12256
12279
  */
12257
12280
  compareTo(other: PromptVersion): string;
@@ -12277,6 +12300,7 @@ interface BasePromptData {
12277
12300
  versionId?: string;
12278
12301
  name: string;
12279
12302
  commit?: string;
12303
+ version?: string;
12280
12304
  metadata?: JsonNode;
12281
12305
  type?: PromptType;
12282
12306
  changeDescription?: string;
@@ -12294,6 +12318,7 @@ declare abstract class BasePrompt {
12294
12318
  private _id;
12295
12319
  private _versionId;
12296
12320
  private _commit;
12321
+ private _version;
12297
12322
  private _synced;
12298
12323
  private _changeDescription;
12299
12324
  private _projectName;
@@ -12309,6 +12334,7 @@ declare abstract class BasePrompt {
12309
12334
  get id(): string | undefined;
12310
12335
  get versionId(): string | undefined;
12311
12336
  get commit(): string | undefined;
12337
+ get version(): string | undefined;
12312
12338
  /** Whether the prompt has been successfully synced with the backend. */
12313
12339
  get synced(): boolean;
12314
12340
  get changeDescription(): string | undefined;
@@ -12321,6 +12347,7 @@ declare abstract class BasePrompt {
12321
12347
  promptId?: string;
12322
12348
  versionId?: string;
12323
12349
  commit?: string;
12350
+ version?: string;
12324
12351
  changeDescription?: string;
12325
12352
  tags?: string[];
12326
12353
  projectName?: string;
@@ -12384,26 +12411,31 @@ declare abstract class BasePrompt {
12384
12411
  */
12385
12412
  protected restoreVersion(version: PromptVersion): Promise<PromptVersionDetail>;
12386
12413
  /**
12387
- * Helper method to retrieve a version by commit hash.
12388
- * Used by subclasses in their getVersion implementations.
12414
+ * Helper method to retrieve a version by its sequential version identifier
12415
+ * (e.g. `"v3"`) or, for backwards compatibility, by its commit hash.
12389
12416
  *
12390
- * @param commit - Commit hash (8-char short form or full)
12417
+ * Input matching `/^v\d+$/` is dispatched to the `versionNumber` endpoint;
12418
+ * anything else is treated as a commit hash. Commit-based fetching is
12419
+ * deprecated — pass a `"v<N>"` identifier instead.
12420
+ *
12421
+ * @param version - Sequential version (`"v3"`) or commit hash (deprecated)
12391
12422
  * @returns Promise resolving to the API response or null if not found
12392
12423
  */
12393
- protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
12424
+ protected retrieveVersion(version: string): Promise<PromptVersionDetail | null>;
12394
12425
  /**
12395
12426
  * Throws an error if the prompt has not been successfully synced with the backend.
12396
12427
  * Used internally before backend operations to ensure we have a valid prompt ID.
12397
12428
  */
12398
12429
  protected ensureSynced(operation: string): void;
12399
12430
  /**
12400
- * Get a specific version by commit hash.
12401
- * Returns a new instance of the appropriate prompt type.
12431
+ * Get a specific version by its sequential version identifier (e.g. `"v3"`)
12432
+ * or, for backwards compatibility, by its commit hash. Returns a new instance
12433
+ * of the appropriate prompt type.
12402
12434
  *
12403
- * @param commit - Commit hash (8-char short form or full)
12435
+ * @param version - Sequential version (`"v<N>"`) preferred; or commit hash (deprecated)
12404
12436
  * @returns Promise resolving to prompt instance or null if not found
12405
12437
  */
12406
- abstract getVersion(commit: string): Promise<BasePrompt | null>;
12438
+ abstract getVersion(version: string): Promise<BasePrompt | null>;
12407
12439
  /**
12408
12440
  * Restores a specific version by creating a new version with content from the specified version.
12409
12441
  *
@@ -13262,12 +13294,26 @@ declare class Prompt extends BasePrompt {
13262
13294
  */
13263
13295
  syncWithBackend(): Promise<Prompt>;
13264
13296
  /**
13265
- * Get a Prompt with a specific version by commit hash.
13297
+ * Get a Prompt at a specific version.
13298
+ *
13299
+ * Accepts either the sequential version identifier (e.g. `"v3"`) — preferred —
13300
+ * or a commit hash for backwards compatibility. Inputs matching `/^v\d+$/`
13301
+ * are treated as version numbers; anything else is treated as a commit.
13266
13302
  *
13267
- * @param commit - Commit hash (8-char short form or full)
13303
+ * @param version - Sequential version (`"v<N>"`) or commit hash
13304
+ * (commit input is **deprecated** — pass a `"v<N>"` identifier instead).
13268
13305
  * @returns Prompt instance representing that version, or null if not found
13306
+ *
13307
+ * @example
13308
+ * ```typescript
13309
+ * // Preferred
13310
+ * const v3 = await prompt.getVersion("v3");
13311
+ *
13312
+ * // @deprecated — commit-shaped input
13313
+ * const byCommit = await prompt.getVersion("abc123de");
13314
+ * ```
13269
13315
  */
13270
- getVersion(commit: string): Promise<Prompt | null>;
13316
+ getVersion(version: string): Promise<Prompt | null>;
13271
13317
  }
13272
13318
 
13273
13319
  interface EvaluateTestSuiteOptions<T = Record<string, unknown>> {
@@ -13807,12 +13853,26 @@ declare class ChatPrompt extends BasePrompt {
13807
13853
  */
13808
13854
  syncWithBackend(): Promise<ChatPrompt>;
13809
13855
  /**
13810
- * Get a ChatPrompt with a specific version by commit hash.
13856
+ * Get a ChatPrompt at a specific version.
13857
+ *
13858
+ * Accepts either the sequential version identifier (e.g. `"v3"`) — preferred —
13859
+ * or a commit hash for backwards compatibility. Inputs matching `/^v\d+$/`
13860
+ * are treated as version numbers; anything else is treated as a commit.
13811
13861
  *
13812
- * @param commit - Commit hash (8-char short form or full)
13862
+ * @param version - Sequential version (`"v<N>"`) or commit hash
13863
+ * (commit input is **deprecated** — pass a `"v<N>"` identifier instead).
13813
13864
  * @returns ChatPrompt instance representing that version, or null if not found
13865
+ *
13866
+ * @example
13867
+ * ```typescript
13868
+ * // Preferred
13869
+ * const v3 = await chatPrompt.getVersion("v3");
13870
+ *
13871
+ * // @deprecated — commit-shaped input
13872
+ * const byCommit = await chatPrompt.getVersion("abc123de");
13873
+ * ```
13814
13874
  */
13815
- getVersion(commit: string): Promise<ChatPrompt | null>;
13875
+ getVersion(version: string): Promise<ChatPrompt | null>;
13816
13876
  }
13817
13877
 
13818
13878
  interface AnnotationQueueData {
@@ -14221,24 +14281,36 @@ declare class OpikClient {
14221
14281
  */
14222
14282
  createChatPrompt: (options: CreateChatPromptOptions) => Promise<ChatPrompt>;
14223
14283
  /**
14224
- * Retrieves a text prompt by name and optional version.
14284
+ * Retrieves a text prompt by name, optionally targeting a specific `version`.
14225
14285
  * Results are cached client-side (TTL configurable via OPIK_PROMPT_CACHE_TTL_SECONDS,
14226
- * default 300s). Pinned commits are cached indefinitely. When called inside a track()
14227
- * context the prompt reference is injected into the active trace/span metadata.
14228
- *
14229
- * @param options - Prompt name and optional commit hash
14286
+ * default 300s). When called inside a track() context the prompt reference
14287
+ * is injected into the active trace/span metadata.
14288
+ *
14289
+ * @param options - Prompt name and optional version pin
14290
+ * @param options.name - Name of the prompt
14291
+ * @param options.version - Sequential version identifier (e.g. `"v3"`). If not
14292
+ * provided, the latest version is returned.
14293
+ * @param options.commit - **Deprecated.** Use `version` instead.
14294
+ * @param options.projectName - Optional project scope.
14230
14295
  * @returns Promise resolving to Prompt or null if not found
14296
+ * @throws Error if both `commit` and `version` are provided
14231
14297
  * @throws PromptTemplateStructureMismatch if prompt exists but is a chat prompt
14232
14298
  */
14233
14299
  getPrompt: (options: GetPromptOptions) => Promise<Prompt | null>;
14234
14300
  /**
14235
- * Retrieves a chat prompt by name and optional version.
14301
+ * Retrieves a chat prompt by name, optionally targeting a specific `version`.
14236
14302
  * Results are cached client-side (TTL configurable via OPIK_PROMPT_CACHE_TTL_SECONDS,
14237
- * default 300s). Pinned commits are cached indefinitely. When called inside a track()
14238
- * context the prompt reference is injected into the active trace/span metadata.
14239
- *
14240
- * @param options - Prompt name and optional commit hash
14303
+ * default 300s). When called inside a track() context the prompt reference
14304
+ * is injected into the active trace/span metadata.
14305
+ *
14306
+ * @param options - Prompt name and optional version pin
14307
+ * @param options.name - Name of the prompt
14308
+ * @param options.version - Sequential version identifier (e.g. `"v3"`). If not
14309
+ * provided, the latest version is returned.
14310
+ * @param options.commit - **Deprecated.** Use `version` instead.
14311
+ * @param options.projectName - Optional project scope.
14241
14312
  * @returns Promise resolving to ChatPrompt or null if not found
14313
+ * @throws Error if both `commit` and `version` are provided
14242
14314
  * @throws PromptTemplateStructureMismatch if prompt exists but is a text prompt
14243
14315
  *
14244
14316
  * @example
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {Fa}from'./chunk-7EDVDI2X.js';export{sa as AgentTaskCompletionJudge,ra as AgentToolCorrectnessJudge,fa as AnswerRelevance,ba as BaseLLMJudgeMetric,C as BaseMetric,D as BaseSuiteEvaluator,p as ChatPrompt,ua as ComplianceRiskJudge,i as ConfigMismatchError,h as ConfigNotFoundError,_ as Contains,y as DEFAULT_EXECUTION_POLICY,j as Dataset,f as DatasetVersion,g as DatasetVersionNotFoundError,ma as DemographicBiasJudge,ka as DialogueHelpfulnessJudge,Z as ExactMatch,ga as GEval,ha as GEvalPreset,oa as GenderBiasJudge,ea as Hallucination,aa as IsJson,Q as LLMJudge,H as ModelConfigurationError,F as ModelError,G as ModelGenerationError,ca as Moderation,Ca as OPIK_PARENT_SPAN_ID_HEADER,Ba as OPIK_TRACE_ID_HEADER,Aa as Opik,E as OpikBaseModel,q as OpikQueryLanguage,d as OpikSpanType,na as PoliticalBiasJudge,o as Prompt,k as PromptType,ta as PromptUncertaintyJudge,la as QARelevanceJudge,$ as RegexMatch,qa as RegionalBiasJudge,pa as ReligiousBiasJudge,P as ResponseSchema,N as SYSTEM_PROMPT,ja as SummarizationCoherenceJudge,ia as SummarizationConsistencyJudge,B as TASK_ERROR_SCORE_NAME,ya as TestSuite,z as TestSuiteResult,s as ThreadsAnnotationQueue,r as TracesAnnotationQueue,O as USER_PROMPT_TEMPLATE,da as Usefulness,J as VercelAIChatModel,v as activateRunner,t as agentConfigContext,A as buildSuiteResult,K as createModel,L as createModelFromInstance,S as deserializeEvaluators,I as detectProvider,c as disableLogger,X as evaluate,Y as evaluatePrompt,V as evaluateTestSuite,u as flushAll,e as generateId,Da as getDistributedTraceHeaders,l as getGlobalClient,w as getTrackContext,a as logger,n as resetGlobalClient,va as resolveEvaluators,T as resolveExecutionPolicy,U as resolveItemExecutionPolicy,M as resolveModel,W as runTests,R as serializeEvaluators,m as setGlobalClient,b as setLoggerLevel,x as track,wa as validateEvaluators,xa as validateExecutionPolicy,Ea as z}from'./chunk-7EDVDI2X.js';Fa();
1
+ import {Fa}from'./chunk-6P6ABA5K.js';export{sa as AgentTaskCompletionJudge,ra as AgentToolCorrectnessJudge,fa as AnswerRelevance,ba as BaseLLMJudgeMetric,C as BaseMetric,D as BaseSuiteEvaluator,p as ChatPrompt,ua as ComplianceRiskJudge,i as ConfigMismatchError,h as ConfigNotFoundError,_ as Contains,y as DEFAULT_EXECUTION_POLICY,j as Dataset,f as DatasetVersion,g as DatasetVersionNotFoundError,ma as DemographicBiasJudge,ka as DialogueHelpfulnessJudge,Z as ExactMatch,ga as GEval,ha as GEvalPreset,oa as GenderBiasJudge,ea as Hallucination,aa as IsJson,Q as LLMJudge,H as ModelConfigurationError,F as ModelError,G as ModelGenerationError,ca as Moderation,Ca as OPIK_PARENT_SPAN_ID_HEADER,Ba as OPIK_TRACE_ID_HEADER,Aa as Opik,E as OpikBaseModel,q as OpikQueryLanguage,d as OpikSpanType,na as PoliticalBiasJudge,o as Prompt,k as PromptType,ta as PromptUncertaintyJudge,la as QARelevanceJudge,$ as RegexMatch,qa as RegionalBiasJudge,pa as ReligiousBiasJudge,P as ResponseSchema,N as SYSTEM_PROMPT,ja as SummarizationCoherenceJudge,ia as SummarizationConsistencyJudge,B as TASK_ERROR_SCORE_NAME,ya as TestSuite,z as TestSuiteResult,s as ThreadsAnnotationQueue,r as TracesAnnotationQueue,O as USER_PROMPT_TEMPLATE,da as Usefulness,J as VercelAIChatModel,v as activateRunner,t as agentConfigContext,A as buildSuiteResult,K as createModel,L as createModelFromInstance,S as deserializeEvaluators,I as detectProvider,c as disableLogger,X as evaluate,Y as evaluatePrompt,V as evaluateTestSuite,u as flushAll,e as generateId,Da as getDistributedTraceHeaders,l as getGlobalClient,w as getTrackContext,a as logger,n as resetGlobalClient,va as resolveEvaluators,T as resolveExecutionPolicy,U as resolveItemExecutionPolicy,M as resolveModel,W as runTests,R as serializeEvaluators,m as setGlobalClient,b as setLoggerLevel,x as track,wa as validateEvaluators,xa as validateExecutionPolicy,Ea as z}from'./chunk-6P6ABA5K.js';Fa();
@@ -1 +1 @@
1
- import {za}from'./chunk-7EDVDI2X.js';export{y as DEFAULT_EXECUTION_POLICY,ya as TestSuite,z as TestSuiteResult,A as buildSuiteResult,S as deserializeEvaluators,V as evaluateTestSuite,T as resolveExecutionPolicy,U as resolveItemExecutionPolicy,W as runTests,R as serializeEvaluators}from'./chunk-7EDVDI2X.js';za();
1
+ import {za}from'./chunk-6P6ABA5K.js';export{y as DEFAULT_EXECUTION_POLICY,ya as TestSuite,z as TestSuiteResult,A as buildSuiteResult,S as deserializeEvaluators,V as evaluateTestSuite,T as resolveExecutionPolicy,U as resolveItemExecutionPolicy,W as runTests,R as serializeEvaluators}from'./chunk-6P6ABA5K.js';za();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opik",
3
3
  "description": "Opik TypeScript and JavaScript SDK",
4
- "version": "2.0.44",
4
+ "version": "2.0.46",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/comet-ml/opik.git",