opik 2.4.1 → 2.4.3

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
@@ -1721,7 +1721,9 @@ type CancelGuardrailTrainingRunRequest = {};
1721
1721
  * @example
1722
1722
  * {
1723
1723
  * name: "name",
1724
- * description: "description",
1724
+ * config: {
1725
+ * prompt: "prompt"
1726
+ * },
1725
1727
  * file: {
1726
1728
  * "key": "value"
1727
1729
  * }
@@ -1729,7 +1731,9 @@ type CancelGuardrailTrainingRunRequest = {};
1729
1731
  */
1730
1732
  interface CreateGuardrailModelRequest {
1731
1733
  name: string;
1732
- description: string;
1734
+ /** A note for people on what the model is for; the classifier never sees it */
1735
+ description?: string;
1736
+ config: GuardrailModelConfig;
1733
1737
  /** JSON Lines in UTF-8, one {"text": "...", "label": "yes" | "no"} object per line, yes meaning the text violates. The deployment sets the limits; by default 20 to 50,000 rows, at least 5 per label, up to 12,000 characters each, 50 MB */
1734
1738
  file: Record<string, unknown>;
1735
1739
  }
@@ -1776,12 +1780,12 @@ type GetGuardrailTrainingRunByIdRequest = {};
1776
1780
 
1777
1781
  /**
1778
1782
  * @example
1779
- * {
1780
- * description: "description"
1781
- * }
1783
+ * {}
1782
1784
  */
1783
1785
  interface GuardrailModelUpdate {
1784
- description: string;
1786
+ /** A new note for people; a blank one removes the note */
1787
+ description?: string;
1788
+ config?: GuardrailModelConfig;
1785
1789
  }
1786
1790
 
1787
1791
  /**
@@ -5566,6 +5570,10 @@ interface DashboardWidgetQueryRequest {
5566
5570
  intervalStart?: Date;
5567
5571
  /** End of the date range, bound to {{window_end}} in the dashboard saved query. Omit for now. */
5568
5572
  intervalEnd?: Date;
5573
+ /** For a view widget: the name of the view input whose saved query to run. */
5574
+ input?: string;
5575
+ /** For a view widget: the version of the widget's view to read the input from. Omit for the version the saved widget pins. */
5576
+ version?: number;
5569
5577
  }
5570
5578
 
5571
5579
  interface DashboardWrite {
@@ -6736,8 +6744,9 @@ interface GuardrailModel {
6736
6744
  id?: string;
6737
6745
  /** Unique in the workspace, ignoring case; never changes */
6738
6746
  name: string;
6739
- /** What the model flags: the question its adapter is trained and served on */
6740
- description: string;
6747
+ /** A note for people on what the model is for; the classifier never sees it */
6748
+ description?: string;
6749
+ config: GuardrailModelConfig;
6741
6750
  servingRun?: GuardrailTrainingRun;
6742
6751
  latestRun?: GuardrailTrainingRun;
6743
6752
  createdAt?: Date;
@@ -6746,6 +6755,16 @@ interface GuardrailModel {
6746
6755
  lastUpdatedBy?: string;
6747
6756
  }
6748
6757
 
6758
+ /**
6759
+ * A new config, replacing the current one whole; it applies from the next check, with no retrain
6760
+ */
6761
+ interface GuardrailModelConfig {
6762
+ /** The shape of this config, which the server sets */
6763
+ version?: number;
6764
+ /** The task the classifier judges each text with, asked as a yes/no question, yes meaning the text violates; examples, if any, go here. Every check uses the current prompt, so editing it needs no retrain */
6765
+ prompt: string;
6766
+ }
6767
+
6749
6768
  interface GuardrailModelPage {
6750
6769
  content?: GuardrailModel[];
6751
6770
  page?: number;
@@ -10995,7 +11014,7 @@ declare class DashboardsClient {
10995
11014
  deleteDashboardsBatch(request: BatchDelete, requestOptions?: DashboardsClient.RequestOptions): HttpResponsePromise<void>;
10996
11015
  private __deleteDashboardsBatch;
10997
11016
  /**
10998
- * Runs the query saved on an Ollie chart widget of this dashboard over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
11017
+ * Runs the query saved on an Ollie chart widget of this dashboard, or the query of the given input of the view version a view widget pins, over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
10999
11018
  *
11000
11019
  * @param {string} dashboardId
11001
11020
  * @param {string} widgetId
@@ -12080,7 +12099,7 @@ declare class GuardrailModelsClient {
12080
12099
  findGuardrailModels(request?: FindGuardrailModelsRequest, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<GuardrailModelPage>;
12081
12100
  private __findGuardrailModels;
12082
12101
  /**
12083
- * Create a guardrail model and start its first training run from a labelled JSONL file
12102
+ * Create a guardrail model from its config and start its first training run from a labelled JSONL file; a rule can use the model once a training run completes
12084
12103
  *
12085
12104
  * @param {OpikApi.CreateGuardrailModelRequest} request
12086
12105
  * @param {GuardrailModelsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -12095,7 +12114,9 @@ declare class GuardrailModelsClient {
12095
12114
  * import { createReadStream } from "fs";
12096
12115
  * await client.guardrailModels.createGuardrailModel({
12097
12116
  * name: "name",
12098
- * description: "description",
12117
+ * config: {
12118
+ * prompt: "prompt"
12119
+ * },
12099
12120
  * file: {
12100
12121
  * "key": "value"
12101
12122
  * }
@@ -12136,7 +12157,7 @@ declare class GuardrailModelsClient {
12136
12157
  deleteGuardrailModel(id: string, request?: DeleteGuardrailModelRequest, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12137
12158
  private __deleteGuardrailModel;
12138
12159
  /**
12139
- * Update a guardrail model's description; its name never changes
12160
+ * Update a guardrail model's description, its config or both; what is absent stays as it is, a blank description removes it, and the name never changes. A new config applies from the next check, with no retrain
12140
12161
  *
12141
12162
  * @param {string} id
12142
12163
  * @param {OpikApi.GuardrailModelUpdate} request
@@ -12148,11 +12169,9 @@ declare class GuardrailModelsClient {
12148
12169
  * @throws {@link OpikApi.ServiceUnavailableError}
12149
12170
  *
12150
12171
  * @example
12151
- * await client.guardrailModels.updateGuardrailModel("id", {
12152
- * description: "description"
12153
- * })
12172
+ * await client.guardrailModels.updateGuardrailModel("id")
12154
12173
  */
12155
- updateGuardrailModel(id: string, request: GuardrailModelUpdate, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12174
+ updateGuardrailModel(id: string, request?: GuardrailModelUpdate, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12156
12175
  private __updateGuardrailModel;
12157
12176
  /**
12158
12177
  * Find a guardrail model's training runs, newest first
@@ -12485,7 +12504,7 @@ declare class InsightsViewsClient {
12485
12504
  deleteInsightsViewsBatch(request: BatchDelete, requestOptions?: InsightsViewsClient.RequestOptions): HttpResponsePromise<void>;
12486
12505
  private __deleteInsightsViewsBatch;
12487
12506
  /**
12488
- * Runs the query saved on an Ollie chart widget of this insights view over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
12507
+ * Runs the query saved on an Ollie chart widget of this insights view, or the query of the given input of the view version a view widget pins, over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
12489
12508
  *
12490
12509
  * @param {string} insightsViewId
12491
12510
  * @param {string} widgetId
package/dist/index.d.ts CHANGED
@@ -1721,7 +1721,9 @@ type CancelGuardrailTrainingRunRequest = {};
1721
1721
  * @example
1722
1722
  * {
1723
1723
  * name: "name",
1724
- * description: "description",
1724
+ * config: {
1725
+ * prompt: "prompt"
1726
+ * },
1725
1727
  * file: {
1726
1728
  * "key": "value"
1727
1729
  * }
@@ -1729,7 +1731,9 @@ type CancelGuardrailTrainingRunRequest = {};
1729
1731
  */
1730
1732
  interface CreateGuardrailModelRequest {
1731
1733
  name: string;
1732
- description: string;
1734
+ /** A note for people on what the model is for; the classifier never sees it */
1735
+ description?: string;
1736
+ config: GuardrailModelConfig;
1733
1737
  /** JSON Lines in UTF-8, one {"text": "...", "label": "yes" | "no"} object per line, yes meaning the text violates. The deployment sets the limits; by default 20 to 50,000 rows, at least 5 per label, up to 12,000 characters each, 50 MB */
1734
1738
  file: Record<string, unknown>;
1735
1739
  }
@@ -1776,12 +1780,12 @@ type GetGuardrailTrainingRunByIdRequest = {};
1776
1780
 
1777
1781
  /**
1778
1782
  * @example
1779
- * {
1780
- * description: "description"
1781
- * }
1783
+ * {}
1782
1784
  */
1783
1785
  interface GuardrailModelUpdate {
1784
- description: string;
1786
+ /** A new note for people; a blank one removes the note */
1787
+ description?: string;
1788
+ config?: GuardrailModelConfig;
1785
1789
  }
1786
1790
 
1787
1791
  /**
@@ -5566,6 +5570,10 @@ interface DashboardWidgetQueryRequest {
5566
5570
  intervalStart?: Date;
5567
5571
  /** End of the date range, bound to {{window_end}} in the dashboard saved query. Omit for now. */
5568
5572
  intervalEnd?: Date;
5573
+ /** For a view widget: the name of the view input whose saved query to run. */
5574
+ input?: string;
5575
+ /** For a view widget: the version of the widget's view to read the input from. Omit for the version the saved widget pins. */
5576
+ version?: number;
5569
5577
  }
5570
5578
 
5571
5579
  interface DashboardWrite {
@@ -6736,8 +6744,9 @@ interface GuardrailModel {
6736
6744
  id?: string;
6737
6745
  /** Unique in the workspace, ignoring case; never changes */
6738
6746
  name: string;
6739
- /** What the model flags: the question its adapter is trained and served on */
6740
- description: string;
6747
+ /** A note for people on what the model is for; the classifier never sees it */
6748
+ description?: string;
6749
+ config: GuardrailModelConfig;
6741
6750
  servingRun?: GuardrailTrainingRun;
6742
6751
  latestRun?: GuardrailTrainingRun;
6743
6752
  createdAt?: Date;
@@ -6746,6 +6755,16 @@ interface GuardrailModel {
6746
6755
  lastUpdatedBy?: string;
6747
6756
  }
6748
6757
 
6758
+ /**
6759
+ * A new config, replacing the current one whole; it applies from the next check, with no retrain
6760
+ */
6761
+ interface GuardrailModelConfig {
6762
+ /** The shape of this config, which the server sets */
6763
+ version?: number;
6764
+ /** The task the classifier judges each text with, asked as a yes/no question, yes meaning the text violates; examples, if any, go here. Every check uses the current prompt, so editing it needs no retrain */
6765
+ prompt: string;
6766
+ }
6767
+
6749
6768
  interface GuardrailModelPage {
6750
6769
  content?: GuardrailModel[];
6751
6770
  page?: number;
@@ -10995,7 +11014,7 @@ declare class DashboardsClient {
10995
11014
  deleteDashboardsBatch(request: BatchDelete, requestOptions?: DashboardsClient.RequestOptions): HttpResponsePromise<void>;
10996
11015
  private __deleteDashboardsBatch;
10997
11016
  /**
10998
- * Runs the query saved on an Ollie chart widget of this dashboard over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
11017
+ * Runs the query saved on an Ollie chart widget of this dashboard, or the query of the given input of the view version a view widget pins, over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
10999
11018
  *
11000
11019
  * @param {string} dashboardId
11001
11020
  * @param {string} widgetId
@@ -12080,7 +12099,7 @@ declare class GuardrailModelsClient {
12080
12099
  findGuardrailModels(request?: FindGuardrailModelsRequest, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<GuardrailModelPage>;
12081
12100
  private __findGuardrailModels;
12082
12101
  /**
12083
- * Create a guardrail model and start its first training run from a labelled JSONL file
12102
+ * Create a guardrail model from its config and start its first training run from a labelled JSONL file; a rule can use the model once a training run completes
12084
12103
  *
12085
12104
  * @param {OpikApi.CreateGuardrailModelRequest} request
12086
12105
  * @param {GuardrailModelsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -12095,7 +12114,9 @@ declare class GuardrailModelsClient {
12095
12114
  * import { createReadStream } from "fs";
12096
12115
  * await client.guardrailModels.createGuardrailModel({
12097
12116
  * name: "name",
12098
- * description: "description",
12117
+ * config: {
12118
+ * prompt: "prompt"
12119
+ * },
12099
12120
  * file: {
12100
12121
  * "key": "value"
12101
12122
  * }
@@ -12136,7 +12157,7 @@ declare class GuardrailModelsClient {
12136
12157
  deleteGuardrailModel(id: string, request?: DeleteGuardrailModelRequest, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12137
12158
  private __deleteGuardrailModel;
12138
12159
  /**
12139
- * Update a guardrail model's description; its name never changes
12160
+ * Update a guardrail model's description, its config or both; what is absent stays as it is, a blank description removes it, and the name never changes. A new config applies from the next check, with no retrain
12140
12161
  *
12141
12162
  * @param {string} id
12142
12163
  * @param {OpikApi.GuardrailModelUpdate} request
@@ -12148,11 +12169,9 @@ declare class GuardrailModelsClient {
12148
12169
  * @throws {@link OpikApi.ServiceUnavailableError}
12149
12170
  *
12150
12171
  * @example
12151
- * await client.guardrailModels.updateGuardrailModel("id", {
12152
- * description: "description"
12153
- * })
12172
+ * await client.guardrailModels.updateGuardrailModel("id")
12154
12173
  */
12155
- updateGuardrailModel(id: string, request: GuardrailModelUpdate, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12174
+ updateGuardrailModel(id: string, request?: GuardrailModelUpdate, requestOptions?: GuardrailModelsClient.RequestOptions): HttpResponsePromise<void>;
12156
12175
  private __updateGuardrailModel;
12157
12176
  /**
12158
12177
  * Find a guardrail model's training runs, newest first
@@ -12485,7 +12504,7 @@ declare class InsightsViewsClient {
12485
12504
  deleteInsightsViewsBatch(request: BatchDelete, requestOptions?: InsightsViewsClient.RequestOptions): HttpResponsePromise<void>;
12486
12505
  private __deleteInsightsViewsBatch;
12487
12506
  /**
12488
- * Runs the query saved on an Ollie chart widget of this insights view over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
12507
+ * Runs the query saved on an Ollie chart widget of this insights view, or the query of the given input of the view version a view widget pins, over the given date range and returns its rows. The query is read from the saved widget; the request carries no SQL. Returns 501 when Ollie or Custom Charts is not enabled for the workspace.
12489
12508
  *
12490
12509
  * @param {string} insightsViewId
12491
12510
  * @param {string} widgetId
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {Ia}from'./chunk-YLGPJ5MO.js';export{va as AgentTaskCompletionJudge,ua as AgentToolCorrectnessJudge,ia as AnswerRelevance,ea as BaseLLMJudgeMetric,F as BaseMetric,G as BaseSuiteEvaluator,s as ChatPrompt,xa as ComplianceRiskJudge,l as ConfigMismatchError,k as ConfigNotFoundError,ba as Contains,B as DEFAULT_EXECUTION_POLICY,m as Dataset,i as DatasetVersion,j as DatasetVersionNotFoundError,pa as DemographicBiasJudge,na as DialogueHelpfulnessJudge,aa as ExactMatch,ja as GEval,ka as GEvalPreset,ra as GenderBiasJudge,ha as Hallucination,da as IsJson,T as LLMJudge,K as ModelConfigurationError,I as ModelError,J as ModelGenerationError,fa as Moderation,Fa as OPIK_PARENT_SPAN_ID_HEADER,Ea as OPIK_TRACE_ID_HEADER,Da as Opik,H as OpikBaseModel,t as OpikQueryLanguage,g as OpikSpanType,qa as PoliticalBiasJudge,r as Prompt,n as PromptType,wa as PromptUncertaintyJudge,oa as QARelevanceJudge,ca as RegexMatch,ta as RegionalBiasJudge,sa as ReligiousBiasJudge,S as ResponseSchema,Q as SYSTEM_PROMPT,ma as SummarizationCoherenceJudge,la as SummarizationConsistencyJudge,E as TASK_ERROR_SCORE_NAME,Ba as TestSuite,C as TestSuiteResult,v as ThreadsAnnotationQueue,u as TracesAnnotationQueue,R as USER_PROMPT_TEMPLATE,ga as Usefulness,M as VercelAIChatModel,y as activateRunner,w as agentConfigContext,D as buildSuiteResult,N as createModel,O as createModelFromInstance,V as deserializeEvaluators,L as detectProvider,c as disableLogger,_ as evaluate,$ as evaluatePrompt,Y as evaluateTestSuite,x as flushAll,h as generateId,Ga as getDistributedTraceHeaders,o as getGlobalClient,z as getTrackContext,e as isTracingActive,a as logger,q as resetGlobalClient,f as resetTracingToConfigDefault,ya as resolveEvaluators,W as resolveExecutionPolicy,X as resolveItemExecutionPolicy,P as resolveModel,Z as runTests,U as serializeEvaluators,p as setGlobalClient,b as setLoggerLevel,d as setTracingActive,A as track,za as validateEvaluators,Aa as validateExecutionPolicy,Ha as z}from'./chunk-YLGPJ5MO.js';Ia();
1
+ import {Ia}from'./chunk-6JVISNS2.js';export{va as AgentTaskCompletionJudge,ua as AgentToolCorrectnessJudge,ia as AnswerRelevance,ea as BaseLLMJudgeMetric,F as BaseMetric,G as BaseSuiteEvaluator,s as ChatPrompt,xa as ComplianceRiskJudge,l as ConfigMismatchError,k as ConfigNotFoundError,ba as Contains,B as DEFAULT_EXECUTION_POLICY,m as Dataset,i as DatasetVersion,j as DatasetVersionNotFoundError,pa as DemographicBiasJudge,na as DialogueHelpfulnessJudge,aa as ExactMatch,ja as GEval,ka as GEvalPreset,ra as GenderBiasJudge,ha as Hallucination,da as IsJson,T as LLMJudge,K as ModelConfigurationError,I as ModelError,J as ModelGenerationError,fa as Moderation,Fa as OPIK_PARENT_SPAN_ID_HEADER,Ea as OPIK_TRACE_ID_HEADER,Da as Opik,H as OpikBaseModel,t as OpikQueryLanguage,g as OpikSpanType,qa as PoliticalBiasJudge,r as Prompt,n as PromptType,wa as PromptUncertaintyJudge,oa as QARelevanceJudge,ca as RegexMatch,ta as RegionalBiasJudge,sa as ReligiousBiasJudge,S as ResponseSchema,Q as SYSTEM_PROMPT,ma as SummarizationCoherenceJudge,la as SummarizationConsistencyJudge,E as TASK_ERROR_SCORE_NAME,Ba as TestSuite,C as TestSuiteResult,v as ThreadsAnnotationQueue,u as TracesAnnotationQueue,R as USER_PROMPT_TEMPLATE,ga as Usefulness,M as VercelAIChatModel,y as activateRunner,w as agentConfigContext,D as buildSuiteResult,N as createModel,O as createModelFromInstance,V as deserializeEvaluators,L as detectProvider,c as disableLogger,_ as evaluate,$ as evaluatePrompt,Y as evaluateTestSuite,x as flushAll,h as generateId,Ga as getDistributedTraceHeaders,o as getGlobalClient,z as getTrackContext,e as isTracingActive,a as logger,q as resetGlobalClient,f as resetTracingToConfigDefault,ya as resolveEvaluators,W as resolveExecutionPolicy,X as resolveItemExecutionPolicy,P as resolveModel,Z as runTests,U as serializeEvaluators,p as setGlobalClient,b as setLoggerLevel,d as setTracingActive,A as track,za as validateEvaluators,Aa as validateExecutionPolicy,Ha as z}from'./chunk-6JVISNS2.js';Ia();
@@ -1 +1 @@
1
- import {Ca}from'./chunk-YLGPJ5MO.js';export{B as DEFAULT_EXECUTION_POLICY,Ba as TestSuite,C as TestSuiteResult,D as buildSuiteResult,V as deserializeEvaluators,Y as evaluateTestSuite,W as resolveExecutionPolicy,X as resolveItemExecutionPolicy,Z as runTests,U as serializeEvaluators}from'./chunk-YLGPJ5MO.js';Ca();
1
+ import {Ca}from'./chunk-6JVISNS2.js';export{B as DEFAULT_EXECUTION_POLICY,Ba as TestSuite,C as TestSuiteResult,D as buildSuiteResult,V as deserializeEvaluators,Y as evaluateTestSuite,W as resolveExecutionPolicy,X as resolveItemExecutionPolicy,Z as runTests,U as serializeEvaluators}from'./chunk-6JVISNS2.js';Ca();
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.4.1",
4
+ "version": "2.4.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/comet-ml/opik.git",