opik 2.0.39 → 2.0.41

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
@@ -1915,7 +1915,12 @@ type GetPromptByCommitRequest = {};
1915
1915
  * @example
1916
1916
  * {}
1917
1917
  */
1918
- type GetPromptByIdRequest = {};
1918
+ interface GetPromptByIdRequest {
1919
+ /** Optional mask version id; when set, requestedVersion is the mask row for that id */
1920
+ maskId?: string;
1921
+ /** Optional environment name; when set, requestedVersion is the version mapped to that environment for the prompt */
1922
+ environment?: string;
1923
+ }
1919
1924
 
1920
1925
  /**
1921
1926
  * @example
@@ -1990,6 +1995,24 @@ interface PromptVersionCommitsRequestPublic {
1990
1995
  commits: string[];
1991
1996
  }
1992
1997
 
1998
+ /**
1999
+ * @example
2000
+ * {}
2001
+ */
2002
+ interface PromptVersionEnvironmentUpdate {
2003
+ environment?: string;
2004
+ }
2005
+
2006
+ /**
2007
+ * @example
2008
+ * {
2009
+ * ids: ["ids"]
2010
+ * }
2011
+ */
2012
+ interface PromptVersionIdsRequestDetail {
2013
+ ids: string[];
2014
+ }
2015
+
1993
2016
  /**
1994
2017
  * @example
1995
2018
  * {
@@ -1999,6 +2022,8 @@ interface PromptVersionCommitsRequestPublic {
1999
2022
  interface PromptVersionRetrieveDetail {
2000
2023
  name: string;
2001
2024
  commit?: string;
2025
+ /** If provided, resolves to the version mapped to this environment for the prompt; mutually exclusive with commit */
2026
+ environment?: string;
2002
2027
  /** If provided, scopes the search to the specified project */
2003
2028
  projectName?: string;
2004
2029
  }
@@ -2219,7 +2244,10 @@ interface CreateLocalRunnerJobRequest {
2219
2244
  agentName: string;
2220
2245
  inputs?: JsonNode;
2221
2246
  projectId: string;
2247
+ /** Deprecated. Use prompt_masks to pass one or more mask overlays keyed by prompt id. */
2222
2248
  maskId?: string;
2249
+ /** Mask overlays to apply during agent execution, keyed by prompt id. */
2250
+ promptMasks?: Record<string, string>;
2223
2251
  blueprintName?: string;
2224
2252
  metadata?: LocalRunnerJobMetadata;
2225
2253
  }
@@ -5457,7 +5485,10 @@ interface LocalRunnerJob {
5457
5485
  error?: string;
5458
5486
  projectId?: string;
5459
5487
  traceId?: string;
5488
+ /** Deprecated. Use prompt_masks to read one or more mask overlays keyed by prompt id. */
5460
5489
  maskId?: string;
5490
+ /** Mask overlays to apply during agent execution, keyed by prompt id. */
5491
+ promptMasks?: Record<string, string>;
5461
5492
  blueprintName?: string;
5462
5493
  metadata?: LocalRunnerJobMetadata;
5463
5494
  timeout?: number;
@@ -5999,6 +6030,9 @@ interface PromptVersionDetail {
5999
6030
  template: string;
6000
6031
  metadata?: JsonNodeDetail;
6001
6032
  type?: PromptVersionDetailType;
6033
+ /** version type discriminator; defaults to prompt_version */
6034
+ versionType?: PromptVersionDetailVersionType;
6035
+ environment?: string;
6002
6036
  changeDescription?: string;
6003
6037
  tags?: string[];
6004
6038
  variables?: string[];
@@ -6020,6 +6054,13 @@ declare const PromptVersionDetailType: {
6020
6054
  };
6021
6055
  type PromptVersionDetailType = (typeof PromptVersionDetailType)[keyof typeof PromptVersionDetailType];
6022
6056
 
6057
+ /** version type discriminator; defaults to prompt_version */
6058
+ declare const PromptVersionDetailVersionType: {
6059
+ readonly PromptVersion: "prompt_version";
6060
+ readonly Mask: "mask";
6061
+ };
6062
+ type PromptVersionDetailVersionType = (typeof PromptVersionDetailVersionType)[keyof typeof PromptVersionDetailVersionType];
6063
+
6023
6064
  interface PromptVersionLink {
6024
6065
  id: string;
6025
6066
  commit?: string;
@@ -6055,6 +6096,9 @@ interface PromptVersionPublic {
6055
6096
  template: string;
6056
6097
  metadata?: JsonNodePublic;
6057
6098
  type?: PromptVersionPublicType;
6099
+ /** version type discriminator; defaults to prompt_version */
6100
+ versionType?: PromptVersionPublicVersionType;
6101
+ environment?: string;
6058
6102
  changeDescription?: string;
6059
6103
  tags?: string[];
6060
6104
  templateStructure?: PromptVersionPublicTemplateStructure;
@@ -6075,6 +6119,13 @@ declare const PromptVersionPublicType: {
6075
6119
  };
6076
6120
  type PromptVersionPublicType = (typeof PromptVersionPublicType)[keyof typeof PromptVersionPublicType];
6077
6121
 
6122
+ /** version type discriminator; defaults to prompt_version */
6123
+ declare const PromptVersionPublicVersionType: {
6124
+ readonly PromptVersion: "prompt_version";
6125
+ readonly Mask: "mask";
6126
+ };
6127
+ type PromptVersionPublicVersionType = (typeof PromptVersionPublicVersionType)[keyof typeof PromptVersionPublicVersionType];
6128
+
6078
6129
  /**
6079
6130
  * Update to apply to prompt versions.
6080
6131
  * Note: Prompt versions are immutable by design.
@@ -10233,12 +10284,13 @@ declare class PromptsClient {
10233
10284
  updatePromptVersions(request: PromptVersionBatchUpdate, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<void>;
10234
10285
  private __updatePromptVersions;
10235
10286
  /**
10236
- * Get prompt by id
10287
+ * Get prompt by id; when mask_id or environment is provided, requestedVersion is populated with the resolved version. mask_id and environment are mutually exclusive.
10237
10288
  *
10238
10289
  * @param {string} id
10239
10290
  * @param {OpikApi.GetPromptByIdRequest} request
10240
10291
  * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10241
10292
  *
10293
+ * @throws {@link OpikApi.BadRequestError}
10242
10294
  * @throws {@link OpikApi.NotFoundError}
10243
10295
  *
10244
10296
  * @example
@@ -10378,6 +10430,40 @@ declare class PromptsClient {
10378
10430
  */
10379
10431
  retrievePromptVersion(request: PromptVersionRetrieveDetail, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<PromptVersionDetail>;
10380
10432
  private __retrievePromptVersion;
10433
+ /**
10434
+ * Retrieve a batch of prompt versions by their ids. Typically used by the UI to resolve mask overlays.
10435
+ *
10436
+ * @param {OpikApi.PromptVersionIdsRequestDetail} request
10437
+ * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10438
+ *
10439
+ * @throws {@link OpikApi.BadRequestError}
10440
+ *
10441
+ * @example
10442
+ * await client.prompts.retrievePromptVersionsByIds({
10443
+ * ids: ["ids"]
10444
+ * })
10445
+ */
10446
+ retrievePromptVersionsByIds(request: PromptVersionIdsRequestDetail, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<PromptVersionDetail[]>;
10447
+ private __retrievePromptVersionsByIds;
10448
+ /**
10449
+ * Set or clear the environment owned by a prompt version.
10450
+ * Setting a non-null environment moves ownership atomically: any previous owner of that
10451
+ * environment for the same prompt has its environment cleared in the same transaction.
10452
+ * Setting null clears the environment from the version.
10453
+ * The environment must already exist in the workspace registry; unknown names return 404.
10454
+ *
10455
+ * @param {string} versionId
10456
+ * @param {OpikApi.PromptVersionEnvironmentUpdate} request
10457
+ * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10458
+ *
10459
+ * @throws {@link OpikApi.BadRequestError}
10460
+ * @throws {@link OpikApi.NotFoundError}
10461
+ *
10462
+ * @example
10463
+ * await client.prompts.setPromptVersionEnvironment("versionId")
10464
+ */
10465
+ setPromptVersionEnvironment(versionId: string, request?: PromptVersionEnvironmentUpdate, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<void>;
10466
+ private __setPromptVersionEnvironment;
10381
10467
  }
10382
10468
 
10383
10469
  declare namespace RedirectClient {
package/dist/index.d.ts CHANGED
@@ -1915,7 +1915,12 @@ type GetPromptByCommitRequest = {};
1915
1915
  * @example
1916
1916
  * {}
1917
1917
  */
1918
- type GetPromptByIdRequest = {};
1918
+ interface GetPromptByIdRequest {
1919
+ /** Optional mask version id; when set, requestedVersion is the mask row for that id */
1920
+ maskId?: string;
1921
+ /** Optional environment name; when set, requestedVersion is the version mapped to that environment for the prompt */
1922
+ environment?: string;
1923
+ }
1919
1924
 
1920
1925
  /**
1921
1926
  * @example
@@ -1990,6 +1995,24 @@ interface PromptVersionCommitsRequestPublic {
1990
1995
  commits: string[];
1991
1996
  }
1992
1997
 
1998
+ /**
1999
+ * @example
2000
+ * {}
2001
+ */
2002
+ interface PromptVersionEnvironmentUpdate {
2003
+ environment?: string;
2004
+ }
2005
+
2006
+ /**
2007
+ * @example
2008
+ * {
2009
+ * ids: ["ids"]
2010
+ * }
2011
+ */
2012
+ interface PromptVersionIdsRequestDetail {
2013
+ ids: string[];
2014
+ }
2015
+
1993
2016
  /**
1994
2017
  * @example
1995
2018
  * {
@@ -1999,6 +2022,8 @@ interface PromptVersionCommitsRequestPublic {
1999
2022
  interface PromptVersionRetrieveDetail {
2000
2023
  name: string;
2001
2024
  commit?: string;
2025
+ /** If provided, resolves to the version mapped to this environment for the prompt; mutually exclusive with commit */
2026
+ environment?: string;
2002
2027
  /** If provided, scopes the search to the specified project */
2003
2028
  projectName?: string;
2004
2029
  }
@@ -2219,7 +2244,10 @@ interface CreateLocalRunnerJobRequest {
2219
2244
  agentName: string;
2220
2245
  inputs?: JsonNode;
2221
2246
  projectId: string;
2247
+ /** Deprecated. Use prompt_masks to pass one or more mask overlays keyed by prompt id. */
2222
2248
  maskId?: string;
2249
+ /** Mask overlays to apply during agent execution, keyed by prompt id. */
2250
+ promptMasks?: Record<string, string>;
2223
2251
  blueprintName?: string;
2224
2252
  metadata?: LocalRunnerJobMetadata;
2225
2253
  }
@@ -5457,7 +5485,10 @@ interface LocalRunnerJob {
5457
5485
  error?: string;
5458
5486
  projectId?: string;
5459
5487
  traceId?: string;
5488
+ /** Deprecated. Use prompt_masks to read one or more mask overlays keyed by prompt id. */
5460
5489
  maskId?: string;
5490
+ /** Mask overlays to apply during agent execution, keyed by prompt id. */
5491
+ promptMasks?: Record<string, string>;
5461
5492
  blueprintName?: string;
5462
5493
  metadata?: LocalRunnerJobMetadata;
5463
5494
  timeout?: number;
@@ -5999,6 +6030,9 @@ interface PromptVersionDetail {
5999
6030
  template: string;
6000
6031
  metadata?: JsonNodeDetail;
6001
6032
  type?: PromptVersionDetailType;
6033
+ /** version type discriminator; defaults to prompt_version */
6034
+ versionType?: PromptVersionDetailVersionType;
6035
+ environment?: string;
6002
6036
  changeDescription?: string;
6003
6037
  tags?: string[];
6004
6038
  variables?: string[];
@@ -6020,6 +6054,13 @@ declare const PromptVersionDetailType: {
6020
6054
  };
6021
6055
  type PromptVersionDetailType = (typeof PromptVersionDetailType)[keyof typeof PromptVersionDetailType];
6022
6056
 
6057
+ /** version type discriminator; defaults to prompt_version */
6058
+ declare const PromptVersionDetailVersionType: {
6059
+ readonly PromptVersion: "prompt_version";
6060
+ readonly Mask: "mask";
6061
+ };
6062
+ type PromptVersionDetailVersionType = (typeof PromptVersionDetailVersionType)[keyof typeof PromptVersionDetailVersionType];
6063
+
6023
6064
  interface PromptVersionLink {
6024
6065
  id: string;
6025
6066
  commit?: string;
@@ -6055,6 +6096,9 @@ interface PromptVersionPublic {
6055
6096
  template: string;
6056
6097
  metadata?: JsonNodePublic;
6057
6098
  type?: PromptVersionPublicType;
6099
+ /** version type discriminator; defaults to prompt_version */
6100
+ versionType?: PromptVersionPublicVersionType;
6101
+ environment?: string;
6058
6102
  changeDescription?: string;
6059
6103
  tags?: string[];
6060
6104
  templateStructure?: PromptVersionPublicTemplateStructure;
@@ -6075,6 +6119,13 @@ declare const PromptVersionPublicType: {
6075
6119
  };
6076
6120
  type PromptVersionPublicType = (typeof PromptVersionPublicType)[keyof typeof PromptVersionPublicType];
6077
6121
 
6122
+ /** version type discriminator; defaults to prompt_version */
6123
+ declare const PromptVersionPublicVersionType: {
6124
+ readonly PromptVersion: "prompt_version";
6125
+ readonly Mask: "mask";
6126
+ };
6127
+ type PromptVersionPublicVersionType = (typeof PromptVersionPublicVersionType)[keyof typeof PromptVersionPublicVersionType];
6128
+
6078
6129
  /**
6079
6130
  * Update to apply to prompt versions.
6080
6131
  * Note: Prompt versions are immutable by design.
@@ -10233,12 +10284,13 @@ declare class PromptsClient {
10233
10284
  updatePromptVersions(request: PromptVersionBatchUpdate, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<void>;
10234
10285
  private __updatePromptVersions;
10235
10286
  /**
10236
- * Get prompt by id
10287
+ * Get prompt by id; when mask_id or environment is provided, requestedVersion is populated with the resolved version. mask_id and environment are mutually exclusive.
10237
10288
  *
10238
10289
  * @param {string} id
10239
10290
  * @param {OpikApi.GetPromptByIdRequest} request
10240
10291
  * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10241
10292
  *
10293
+ * @throws {@link OpikApi.BadRequestError}
10242
10294
  * @throws {@link OpikApi.NotFoundError}
10243
10295
  *
10244
10296
  * @example
@@ -10378,6 +10430,40 @@ declare class PromptsClient {
10378
10430
  */
10379
10431
  retrievePromptVersion(request: PromptVersionRetrieveDetail, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<PromptVersionDetail>;
10380
10432
  private __retrievePromptVersion;
10433
+ /**
10434
+ * Retrieve a batch of prompt versions by their ids. Typically used by the UI to resolve mask overlays.
10435
+ *
10436
+ * @param {OpikApi.PromptVersionIdsRequestDetail} request
10437
+ * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10438
+ *
10439
+ * @throws {@link OpikApi.BadRequestError}
10440
+ *
10441
+ * @example
10442
+ * await client.prompts.retrievePromptVersionsByIds({
10443
+ * ids: ["ids"]
10444
+ * })
10445
+ */
10446
+ retrievePromptVersionsByIds(request: PromptVersionIdsRequestDetail, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<PromptVersionDetail[]>;
10447
+ private __retrievePromptVersionsByIds;
10448
+ /**
10449
+ * Set or clear the environment owned by a prompt version.
10450
+ * Setting a non-null environment moves ownership atomically: any previous owner of that
10451
+ * environment for the same prompt has its environment cleared in the same transaction.
10452
+ * Setting null clears the environment from the version.
10453
+ * The environment must already exist in the workspace registry; unknown names return 404.
10454
+ *
10455
+ * @param {string} versionId
10456
+ * @param {OpikApi.PromptVersionEnvironmentUpdate} request
10457
+ * @param {PromptsClient.RequestOptions} requestOptions - Request-specific configuration.
10458
+ *
10459
+ * @throws {@link OpikApi.BadRequestError}
10460
+ * @throws {@link OpikApi.NotFoundError}
10461
+ *
10462
+ * @example
10463
+ * await client.prompts.setPromptVersionEnvironment("versionId")
10464
+ */
10465
+ setPromptVersionEnvironment(versionId: string, request?: PromptVersionEnvironmentUpdate, requestOptions?: PromptsClient.RequestOptions): HttpResponsePromise<void>;
10466
+ private __setPromptVersionEnvironment;
10381
10467
  }
10382
10468
 
10383
10469
  declare namespace RedirectClient {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {Fa}from'./chunk-EHVVWQKE.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-EHVVWQKE.js';Fa();
1
+ import {Fa}from'./chunk-SINZQROK.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-SINZQROK.js';Fa();
@@ -1 +1 @@
1
- import {za}from'./chunk-EHVVWQKE.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-EHVVWQKE.js';za();
1
+ import {za}from'./chunk-SINZQROK.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-SINZQROK.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.39",
4
+ "version": "2.0.41",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/comet-ml/opik.git",