opik 2.0.0 → 2.0.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-FTTQJ4TO.js +404 -0
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +85 -51
- package/dist/index.d.ts +85 -51
- package/dist/index.js +1 -1
- package/dist/suite-2DEGP66I.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-2AOEXUQ4.js +0 -404
- package/dist/suite-DE3AOLJG.js +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -11854,21 +11854,52 @@ interface BasePromptData {
|
|
|
11854
11854
|
* Provides common functionality for versioning, property updates, and deletion.
|
|
11855
11855
|
*/
|
|
11856
11856
|
declare abstract class BasePrompt {
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11857
|
+
private _id;
|
|
11858
|
+
private _versionId;
|
|
11859
|
+
private _commit;
|
|
11860
|
+
private _synced;
|
|
11861
|
+
private _changeDescription;
|
|
11862
|
+
private _projectName;
|
|
11860
11863
|
readonly type: PromptType;
|
|
11861
|
-
readonly changeDescription: string | undefined;
|
|
11862
11864
|
readonly templateStructure: PromptTemplateStructure;
|
|
11863
|
-
readonly projectName: string | undefined;
|
|
11864
|
-
/** Whether the prompt has been successfully synced with the backend. */
|
|
11865
|
-
readonly synced: boolean;
|
|
11866
11865
|
protected _name: string;
|
|
11867
11866
|
protected _description: string | undefined;
|
|
11868
11867
|
protected _tags: string[];
|
|
11869
11868
|
protected readonly _metadata: JsonNode | undefined;
|
|
11870
11869
|
protected readonly opik: OpikClient;
|
|
11871
|
-
|
|
11870
|
+
/** Pending background sync promise, set when constructed without synced:true. */
|
|
11871
|
+
protected _pendingSync: Promise<void> | null;
|
|
11872
|
+
get id(): string | undefined;
|
|
11873
|
+
get versionId(): string | undefined;
|
|
11874
|
+
get commit(): string | undefined;
|
|
11875
|
+
/** Whether the prompt has been successfully synced with the backend. */
|
|
11876
|
+
get synced(): boolean;
|
|
11877
|
+
get changeDescription(): string | undefined;
|
|
11878
|
+
get projectName(): string | undefined;
|
|
11879
|
+
constructor(data: BasePromptData, opik?: OpikClient);
|
|
11880
|
+
/**
|
|
11881
|
+
* Updates internal state after a successful background sync.
|
|
11882
|
+
*/
|
|
11883
|
+
protected updateSyncState(result: {
|
|
11884
|
+
promptId?: string;
|
|
11885
|
+
versionId?: string;
|
|
11886
|
+
commit?: string;
|
|
11887
|
+
changeDescription?: string;
|
|
11888
|
+
tags?: string[];
|
|
11889
|
+
projectName?: string;
|
|
11890
|
+
}): void;
|
|
11891
|
+
/**
|
|
11892
|
+
* Shared background-sync helper for subclass constructors.
|
|
11893
|
+
* Calls the provided create function, then only updates sync state when the
|
|
11894
|
+
* returned instance is truly synced (has id, versionId, and commit populated).
|
|
11895
|
+
* If the create call throws, or returns an unsynced instance, _synced stays false.
|
|
11896
|
+
*/
|
|
11897
|
+
protected _syncViaCreate<T extends BasePrompt>(create: () => Promise<T>): Promise<void>;
|
|
11898
|
+
/**
|
|
11899
|
+
* Resolves when initialization completes.
|
|
11900
|
+
* Returns immediately if the prompt was already persisted (e.g. retrieved from backend).
|
|
11901
|
+
*/
|
|
11902
|
+
ready(): Promise<void>;
|
|
11872
11903
|
get name(): string;
|
|
11873
11904
|
get description(): string | undefined;
|
|
11874
11905
|
get tags(): readonly string[] | undefined;
|
|
@@ -11924,10 +11955,10 @@ declare abstract class BasePrompt {
|
|
|
11924
11955
|
*/
|
|
11925
11956
|
protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
|
|
11926
11957
|
/**
|
|
11927
|
-
* Throws an error if the prompt has not been synced with the backend.
|
|
11928
|
-
*
|
|
11958
|
+
* Throws an error if the prompt has not been successfully synced with the backend.
|
|
11959
|
+
* Used internally before backend operations to ensure we have a valid prompt ID.
|
|
11929
11960
|
*/
|
|
11930
|
-
protected
|
|
11961
|
+
protected ensureSynced(operation: string): void;
|
|
11931
11962
|
/**
|
|
11932
11963
|
* Get a specific version by commit hash.
|
|
11933
11964
|
* Returns a new instance of the appropriate prompt type.
|
|
@@ -11966,9 +11997,12 @@ declare class Prompt extends BasePrompt {
|
|
|
11966
11997
|
readonly prompt: string;
|
|
11967
11998
|
/**
|
|
11968
11999
|
* Creates a new Prompt instance.
|
|
11969
|
-
*
|
|
12000
|
+
* All operations work seamlessly without requiring manual configuration.
|
|
11970
12001
|
*/
|
|
12002
|
+
constructor(data: PromptData);
|
|
12003
|
+
/** @deprecated Passing an opik client is deprecated. */
|
|
11971
12004
|
constructor(data: PromptData, opik: OpikClient);
|
|
12005
|
+
private _performSync;
|
|
11972
12006
|
/**
|
|
11973
12007
|
* Returns the template string for this text prompt.
|
|
11974
12008
|
* Alias for the `prompt` property for consistency with ChatPrompt.
|
|
@@ -12040,23 +12074,6 @@ declare class Prompt extends BasePrompt {
|
|
|
12040
12074
|
* ```
|
|
12041
12075
|
*/
|
|
12042
12076
|
useVersion(version: PromptVersion): Promise<Prompt>;
|
|
12043
|
-
/**
|
|
12044
|
-
* Get a Prompt with a specific version by commit hash.
|
|
12045
|
-
*
|
|
12046
|
-
* @param commit - Commit hash (8-char short form or full)
|
|
12047
|
-
* @returns Prompt instance representing that version, or null if not found
|
|
12048
|
-
*
|
|
12049
|
-
* @example
|
|
12050
|
-
* ```typescript
|
|
12051
|
-
* const prompt = await client.getPrompt({ name: "greeting" });
|
|
12052
|
-
*
|
|
12053
|
-
* // Get a specific version directly as a Prompt
|
|
12054
|
-
* const versionedPrompt = await prompt.getVersion("abc123de");
|
|
12055
|
-
* if (versionedPrompt) {
|
|
12056
|
-
* const text = versionedPrompt.format({ name: "Alice" });
|
|
12057
|
-
* }
|
|
12058
|
-
* ```
|
|
12059
|
-
*/
|
|
12060
12077
|
/**
|
|
12061
12078
|
* Synchronize the prompt with the backend.
|
|
12062
12079
|
*
|
|
@@ -12066,6 +12083,12 @@ declare class Prompt extends BasePrompt {
|
|
|
12066
12083
|
* @returns Promise resolving to a new synced Prompt instance, or this instance if sync fails
|
|
12067
12084
|
*/
|
|
12068
12085
|
syncWithBackend(): Promise<Prompt>;
|
|
12086
|
+
/**
|
|
12087
|
+
* Get a Prompt with a specific version by commit hash.
|
|
12088
|
+
*
|
|
12089
|
+
* @param commit - Commit hash (8-char short form or full)
|
|
12090
|
+
* @returns Prompt instance representing that version, or null if not found
|
|
12091
|
+
*/
|
|
12069
12092
|
getVersion(commit: string): Promise<Prompt | null>;
|
|
12070
12093
|
}
|
|
12071
12094
|
|
|
@@ -12503,9 +12526,10 @@ declare class Dataset<T extends DatasetItemData = DatasetItemData> {
|
|
|
12503
12526
|
* Retrieve raw DatasetItem objects with full metadata (evaluators, executionPolicy) preserved.
|
|
12504
12527
|
*
|
|
12505
12528
|
* @param nbSamples The number of samples to retrieve. If not set - all items are returned
|
|
12529
|
+
* @param lastRetrievedId Optional ID of the last retrieved item for pagination
|
|
12506
12530
|
* @returns A list of DatasetItem objects
|
|
12507
12531
|
*/
|
|
12508
|
-
getRawItems(nbSamples?: number): Promise<DatasetItem<T>[]>;
|
|
12532
|
+
getRawItems(nbSamples?: number, lastRetrievedId?: string): Promise<DatasetItem<T>[]>;
|
|
12509
12533
|
/**
|
|
12510
12534
|
* Insert items from a JSON string array into the dataset.
|
|
12511
12535
|
*
|
|
@@ -12763,6 +12787,10 @@ interface EvaluateTestSuiteOptions<T = Record<string, unknown>> {
|
|
|
12763
12787
|
client?: OpikClient;
|
|
12764
12788
|
/** Optional list of tags to associate with the experiment */
|
|
12765
12789
|
tags?: string[];
|
|
12790
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
12791
|
+
taskThreads?: number;
|
|
12792
|
+
/** Limit the number of dataset items to evaluate. If not set, all items are evaluated. */
|
|
12793
|
+
nbSamples?: number;
|
|
12766
12794
|
}
|
|
12767
12795
|
/**
|
|
12768
12796
|
* Run a test suite using evaluators and execution policy stored in the dataset version metadata.
|
|
@@ -12783,7 +12811,6 @@ interface CreateTestSuiteOptions {
|
|
|
12783
12811
|
interface UpdateTestSuiteOptions {
|
|
12784
12812
|
globalAssertions?: string[];
|
|
12785
12813
|
globalExecutionPolicy?: ExecutionPolicy;
|
|
12786
|
-
tags?: string[];
|
|
12787
12814
|
}
|
|
12788
12815
|
declare class TestSuite {
|
|
12789
12816
|
private readonly _dataset;
|
|
@@ -12820,7 +12847,7 @@ declare class TestSuite {
|
|
|
12820
12847
|
* @throws Error if any item is missing an `id`
|
|
12821
12848
|
*/
|
|
12822
12849
|
update(items: UpdateTestSuiteItem[]): Promise<void>;
|
|
12823
|
-
getItems(): Promise<Array<{
|
|
12850
|
+
getItems(nbSamples?: number, lastRetrievedId?: string): Promise<Array<{
|
|
12824
12851
|
id: string;
|
|
12825
12852
|
data: Record<string, unknown>;
|
|
12826
12853
|
description?: string;
|
|
@@ -12889,6 +12916,10 @@ interface RunTestsOptions {
|
|
|
12889
12916
|
experimentTags?: string[];
|
|
12890
12917
|
/** Optional model name override for LLMJudge evaluators */
|
|
12891
12918
|
model?: string;
|
|
12919
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
12920
|
+
taskThreads?: number;
|
|
12921
|
+
/** Limit the number of dataset items to evaluate. If not set, all items are evaluated. */
|
|
12922
|
+
nbSamples?: number;
|
|
12892
12923
|
}
|
|
12893
12924
|
/**
|
|
12894
12925
|
* Run a test suite evaluation against a task function.
|
|
@@ -13133,9 +13164,12 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13133
13164
|
private readonly chatTemplate;
|
|
13134
13165
|
/**
|
|
13135
13166
|
* Creates a new ChatPrompt instance.
|
|
13136
|
-
*
|
|
13167
|
+
* All operations work seamlessly without requiring manual configuration.
|
|
13137
13168
|
*/
|
|
13169
|
+
constructor(data: ChatPromptData);
|
|
13170
|
+
/** @deprecated Passing an opik client is deprecated. */
|
|
13138
13171
|
constructor(data: ChatPromptData, opik: OpikClient);
|
|
13172
|
+
private _performSync;
|
|
13139
13173
|
/**
|
|
13140
13174
|
* Returns the template messages for this chat prompt.
|
|
13141
13175
|
* Alias for the `messages` property for consistency with Prompt.
|
|
@@ -13216,23 +13250,6 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13216
13250
|
* ```
|
|
13217
13251
|
*/
|
|
13218
13252
|
useVersion(version: PromptVersion): Promise<ChatPrompt>;
|
|
13219
|
-
/**
|
|
13220
|
-
* Get a ChatPrompt with a specific version by commit hash.
|
|
13221
|
-
*
|
|
13222
|
-
* @param commit - Commit hash (8-char short form or full)
|
|
13223
|
-
* @returns ChatPrompt instance representing that version, or null if not found
|
|
13224
|
-
*
|
|
13225
|
-
* @example
|
|
13226
|
-
* ```typescript
|
|
13227
|
-
* const chatPrompt = await client.getChatPrompt({ name: "greeting" });
|
|
13228
|
-
*
|
|
13229
|
-
* // Get a specific version directly as a ChatPrompt
|
|
13230
|
-
* const versionedPrompt = await chatPrompt.getVersion("abc123de");
|
|
13231
|
-
* if (versionedPrompt) {
|
|
13232
|
-
* const messages = versionedPrompt.format({ name: "Alice" });
|
|
13233
|
-
* }
|
|
13234
|
-
* ```
|
|
13235
|
-
*/
|
|
13236
13253
|
/**
|
|
13237
13254
|
* Synchronize the chat prompt with the backend.
|
|
13238
13255
|
*
|
|
@@ -13242,6 +13259,12 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13242
13259
|
* @returns Promise resolving to a new synced ChatPrompt instance, or this instance if sync fails
|
|
13243
13260
|
*/
|
|
13244
13261
|
syncWithBackend(): Promise<ChatPrompt>;
|
|
13262
|
+
/**
|
|
13263
|
+
* Get a ChatPrompt with a specific version by commit hash.
|
|
13264
|
+
*
|
|
13265
|
+
* @param commit - Commit hash (8-char short form or full)
|
|
13266
|
+
* @returns ChatPrompt instance representing that version, or null if not found
|
|
13267
|
+
*/
|
|
13245
13268
|
getVersion(commit: string): Promise<ChatPrompt | null>;
|
|
13246
13269
|
}
|
|
13247
13270
|
|
|
@@ -13940,6 +13963,11 @@ declare class OpikClient {
|
|
|
13940
13963
|
* Throws ConfigMismatchError on the first mismatch found.
|
|
13941
13964
|
*/
|
|
13942
13965
|
private _validatePromptProjects;
|
|
13966
|
+
/**
|
|
13967
|
+
* Waits for all unsynced BasePrompt values in `values` to finish syncing,
|
|
13968
|
+
* with a timeout. Returns true only when every prompt is synced.
|
|
13969
|
+
*/
|
|
13970
|
+
private _allPromptsSynced;
|
|
13943
13971
|
private _makeFallbackConfig;
|
|
13944
13972
|
/**
|
|
13945
13973
|
* Fetches a blueprint from the backend (or returns the cached one).
|
|
@@ -14118,6 +14146,8 @@ interface EvaluateOptions<T = Record<string, unknown>> {
|
|
|
14118
14146
|
scoringKeyMapping?: ScoringKeyMappingType;
|
|
14119
14147
|
/** Optional list of tags to associate with the experiment */
|
|
14120
14148
|
tags?: string[];
|
|
14149
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
14150
|
+
taskThreads?: number;
|
|
14121
14151
|
/** Optional agent configuration blueprint ID to link with the experiment */
|
|
14122
14152
|
blueprintId?: string;
|
|
14123
14153
|
}
|
|
@@ -15851,6 +15881,10 @@ declare class DatasetVersionNotFoundError extends OpikError {
|
|
|
15851
15881
|
constructor(versionName: string, datasetName: string);
|
|
15852
15882
|
}
|
|
15853
15883
|
|
|
15884
|
+
declare function getGlobalClient(): OpikClient;
|
|
15885
|
+
declare function setGlobalClient(client: OpikClient): void;
|
|
15886
|
+
declare function resetGlobalClient(): void;
|
|
15887
|
+
|
|
15854
15888
|
/**
|
|
15855
15889
|
* Type definitions for OQL (Opik Query Language) parser
|
|
15856
15890
|
*/
|
|
@@ -15979,4 +16013,4 @@ declare class ConfigMismatchError extends OpikError {
|
|
|
15979
16013
|
|
|
15980
16014
|
declare function activateRunner(): void;
|
|
15981
16015
|
|
|
15982
|
-
export { AgentTaskCompletionJudge, AgentToolCorrectnessJudge, type AllProviderOptions, AnnotationQueuePublicScope as AnnotationQueueScope, AnswerRelevance, type AnthropicProviderOptions, BaseLLMJudgeMetric, BaseMetric, BaseSuiteEvaluator, ChatPrompt, ComplianceRiskJudge, type Config, ConfigMismatchError, ConfigNotFoundError, Contains, type CreateTestSuiteOptions, DEFAULT_EXECUTION_POLICY, Dataset, type DatasetPublic, DatasetVersion, DatasetVersionNotFoundError, type DatasetVersionPublic, DemographicBiasJudge, DialogueHelpfulnessJudge, type ErrorInfo, type EvaluateOptions, type EvaluatePromptOptions, type EvaluateTestSuiteOptions, type EvaluationError, type EvaluationResult, type EvaluationScoreResult, type EvaluationTask, type EvaluationTestCase, type EvaluationTestResult, ExactMatch, type ExecutionPolicy, type FeedbackScoreData, type FewShotExampleAnswerRelevanceNoContext, type FewShotExampleAnswerRelevanceWithContext, type FewShotExampleHallucination, type FewShotExampleModeration, type FilterExpression, GEval, GEvalPreset, GenderBiasJudge, type GoogleProviderOptions, Hallucination, IsJson, type ItemResult, LLMJudge, type LLMJudgeConfig, type LLMJudgeModelSettings, type LLMJudgeOptions, type LLMJudgeResponseFormat, ModelConfigurationError, ModelError, ModelGenerationError, Moderation, type OpenAIProviderOptions, OpikClient as Opik, type OpikAssistantMessage, OpikBaseModel, type OpikConfig, type OpikMessage, OpikQueryLanguage, SpanType as OpikSpanType, type OpikSystemMessage, type OpikToolMessage, type OpikUserMessage, type Param, PoliticalBiasJudge, Prompt, PromptType, PromptUncertaintyJudge, type ProviderOptionsForModel, QARelevanceJudge, RegexMatch, RegionalBiasJudge, type RegistryEntry, ReligiousBiasJudge, ResponseSchema, type RunTestsOptions, SYSTEM_PROMPT, type ScoringKeyMappingType, Span, SpanType, SummarizationCoherenceJudge, SummarizationConsistencyJudge, type SupportedModelId, TestSuite, type TestSuiteItem, TestSuiteResult, ThreadsAnnotationQueue, Trace, TracesAnnotationQueue, USER_PROMPT_TEMPLATE, type UpdateTestSuiteItem, type UpdateTestSuiteOptions, Usefulness, VercelAIChatModel, activateRunner, agentConfigContext, buildSuiteResult, createModel, createModelFromInstance, deserializeEvaluators, detectProvider, disableLogger, evaluate, evaluatePrompt, evaluateTestSuite, flushAll, generateId, getTrackContext, logger, resolveEvaluators, resolveExecutionPolicy, resolveItemExecutionPolicy, resolveModel, runTests, serializeEvaluators, setLoggerLevel, track, validateEvaluators, validateExecutionPolicy };
|
|
16016
|
+
export { AgentTaskCompletionJudge, AgentToolCorrectnessJudge, type AllProviderOptions, AnnotationQueuePublicScope as AnnotationQueueScope, AnswerRelevance, type AnthropicProviderOptions, BaseLLMJudgeMetric, BaseMetric, BaseSuiteEvaluator, ChatPrompt, ComplianceRiskJudge, type Config, ConfigMismatchError, ConfigNotFoundError, Contains, type CreateTestSuiteOptions, DEFAULT_EXECUTION_POLICY, Dataset, type DatasetPublic, DatasetVersion, DatasetVersionNotFoundError, type DatasetVersionPublic, DemographicBiasJudge, DialogueHelpfulnessJudge, type ErrorInfo, type EvaluateOptions, type EvaluatePromptOptions, type EvaluateTestSuiteOptions, type EvaluationError, type EvaluationResult, type EvaluationScoreResult, type EvaluationTask, type EvaluationTestCase, type EvaluationTestResult, ExactMatch, type ExecutionPolicy, type FeedbackScoreData, type FewShotExampleAnswerRelevanceNoContext, type FewShotExampleAnswerRelevanceWithContext, type FewShotExampleHallucination, type FewShotExampleModeration, type FilterExpression, GEval, GEvalPreset, GenderBiasJudge, type GoogleProviderOptions, Hallucination, IsJson, type ItemResult, LLMJudge, type LLMJudgeConfig, type LLMJudgeModelSettings, type LLMJudgeOptions, type LLMJudgeResponseFormat, ModelConfigurationError, ModelError, ModelGenerationError, Moderation, type OpenAIProviderOptions, OpikClient as Opik, type OpikAssistantMessage, OpikBaseModel, type OpikConfig, type OpikMessage, OpikQueryLanguage, SpanType as OpikSpanType, type OpikSystemMessage, type OpikToolMessage, type OpikUserMessage, type Param, PoliticalBiasJudge, Prompt, PromptType, PromptUncertaintyJudge, type ProviderOptionsForModel, QARelevanceJudge, RegexMatch, RegionalBiasJudge, type RegistryEntry, ReligiousBiasJudge, ResponseSchema, type RunTestsOptions, SYSTEM_PROMPT, type ScoringKeyMappingType, Span, SpanType, SummarizationCoherenceJudge, SummarizationConsistencyJudge, type SupportedModelId, TestSuite, type TestSuiteItem, TestSuiteResult, ThreadsAnnotationQueue, Trace, TracesAnnotationQueue, USER_PROMPT_TEMPLATE, type UpdateTestSuiteItem, type UpdateTestSuiteOptions, Usefulness, VercelAIChatModel, activateRunner, agentConfigContext, buildSuiteResult, createModel, createModelFromInstance, deserializeEvaluators, detectProvider, disableLogger, evaluate, evaluatePrompt, evaluateTestSuite, flushAll, generateId, getGlobalClient, getTrackContext, logger, resetGlobalClient, resolveEvaluators, resolveExecutionPolicy, resolveItemExecutionPolicy, resolveModel, runTests, serializeEvaluators, setGlobalClient, setLoggerLevel, track, validateEvaluators, validateExecutionPolicy };
|
package/dist/index.d.ts
CHANGED
|
@@ -11854,21 +11854,52 @@ interface BasePromptData {
|
|
|
11854
11854
|
* Provides common functionality for versioning, property updates, and deletion.
|
|
11855
11855
|
*/
|
|
11856
11856
|
declare abstract class BasePrompt {
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11857
|
+
private _id;
|
|
11858
|
+
private _versionId;
|
|
11859
|
+
private _commit;
|
|
11860
|
+
private _synced;
|
|
11861
|
+
private _changeDescription;
|
|
11862
|
+
private _projectName;
|
|
11860
11863
|
readonly type: PromptType;
|
|
11861
|
-
readonly changeDescription: string | undefined;
|
|
11862
11864
|
readonly templateStructure: PromptTemplateStructure;
|
|
11863
|
-
readonly projectName: string | undefined;
|
|
11864
|
-
/** Whether the prompt has been successfully synced with the backend. */
|
|
11865
|
-
readonly synced: boolean;
|
|
11866
11865
|
protected _name: string;
|
|
11867
11866
|
protected _description: string | undefined;
|
|
11868
11867
|
protected _tags: string[];
|
|
11869
11868
|
protected readonly _metadata: JsonNode | undefined;
|
|
11870
11869
|
protected readonly opik: OpikClient;
|
|
11871
|
-
|
|
11870
|
+
/** Pending background sync promise, set when constructed without synced:true. */
|
|
11871
|
+
protected _pendingSync: Promise<void> | null;
|
|
11872
|
+
get id(): string | undefined;
|
|
11873
|
+
get versionId(): string | undefined;
|
|
11874
|
+
get commit(): string | undefined;
|
|
11875
|
+
/** Whether the prompt has been successfully synced with the backend. */
|
|
11876
|
+
get synced(): boolean;
|
|
11877
|
+
get changeDescription(): string | undefined;
|
|
11878
|
+
get projectName(): string | undefined;
|
|
11879
|
+
constructor(data: BasePromptData, opik?: OpikClient);
|
|
11880
|
+
/**
|
|
11881
|
+
* Updates internal state after a successful background sync.
|
|
11882
|
+
*/
|
|
11883
|
+
protected updateSyncState(result: {
|
|
11884
|
+
promptId?: string;
|
|
11885
|
+
versionId?: string;
|
|
11886
|
+
commit?: string;
|
|
11887
|
+
changeDescription?: string;
|
|
11888
|
+
tags?: string[];
|
|
11889
|
+
projectName?: string;
|
|
11890
|
+
}): void;
|
|
11891
|
+
/**
|
|
11892
|
+
* Shared background-sync helper for subclass constructors.
|
|
11893
|
+
* Calls the provided create function, then only updates sync state when the
|
|
11894
|
+
* returned instance is truly synced (has id, versionId, and commit populated).
|
|
11895
|
+
* If the create call throws, or returns an unsynced instance, _synced stays false.
|
|
11896
|
+
*/
|
|
11897
|
+
protected _syncViaCreate<T extends BasePrompt>(create: () => Promise<T>): Promise<void>;
|
|
11898
|
+
/**
|
|
11899
|
+
* Resolves when initialization completes.
|
|
11900
|
+
* Returns immediately if the prompt was already persisted (e.g. retrieved from backend).
|
|
11901
|
+
*/
|
|
11902
|
+
ready(): Promise<void>;
|
|
11872
11903
|
get name(): string;
|
|
11873
11904
|
get description(): string | undefined;
|
|
11874
11905
|
get tags(): readonly string[] | undefined;
|
|
@@ -11924,10 +11955,10 @@ declare abstract class BasePrompt {
|
|
|
11924
11955
|
*/
|
|
11925
11956
|
protected retrieveVersionByCommit(commit: string): Promise<PromptVersionDetail | null>;
|
|
11926
11957
|
/**
|
|
11927
|
-
* Throws an error if the prompt has not been synced with the backend.
|
|
11928
|
-
*
|
|
11958
|
+
* Throws an error if the prompt has not been successfully synced with the backend.
|
|
11959
|
+
* Used internally before backend operations to ensure we have a valid prompt ID.
|
|
11929
11960
|
*/
|
|
11930
|
-
protected
|
|
11961
|
+
protected ensureSynced(operation: string): void;
|
|
11931
11962
|
/**
|
|
11932
11963
|
* Get a specific version by commit hash.
|
|
11933
11964
|
* Returns a new instance of the appropriate prompt type.
|
|
@@ -11966,9 +11997,12 @@ declare class Prompt extends BasePrompt {
|
|
|
11966
11997
|
readonly prompt: string;
|
|
11967
11998
|
/**
|
|
11968
11999
|
* Creates a new Prompt instance.
|
|
11969
|
-
*
|
|
12000
|
+
* All operations work seamlessly without requiring manual configuration.
|
|
11970
12001
|
*/
|
|
12002
|
+
constructor(data: PromptData);
|
|
12003
|
+
/** @deprecated Passing an opik client is deprecated. */
|
|
11971
12004
|
constructor(data: PromptData, opik: OpikClient);
|
|
12005
|
+
private _performSync;
|
|
11972
12006
|
/**
|
|
11973
12007
|
* Returns the template string for this text prompt.
|
|
11974
12008
|
* Alias for the `prompt` property for consistency with ChatPrompt.
|
|
@@ -12040,23 +12074,6 @@ declare class Prompt extends BasePrompt {
|
|
|
12040
12074
|
* ```
|
|
12041
12075
|
*/
|
|
12042
12076
|
useVersion(version: PromptVersion): Promise<Prompt>;
|
|
12043
|
-
/**
|
|
12044
|
-
* Get a Prompt with a specific version by commit hash.
|
|
12045
|
-
*
|
|
12046
|
-
* @param commit - Commit hash (8-char short form or full)
|
|
12047
|
-
* @returns Prompt instance representing that version, or null if not found
|
|
12048
|
-
*
|
|
12049
|
-
* @example
|
|
12050
|
-
* ```typescript
|
|
12051
|
-
* const prompt = await client.getPrompt({ name: "greeting" });
|
|
12052
|
-
*
|
|
12053
|
-
* // Get a specific version directly as a Prompt
|
|
12054
|
-
* const versionedPrompt = await prompt.getVersion("abc123de");
|
|
12055
|
-
* if (versionedPrompt) {
|
|
12056
|
-
* const text = versionedPrompt.format({ name: "Alice" });
|
|
12057
|
-
* }
|
|
12058
|
-
* ```
|
|
12059
|
-
*/
|
|
12060
12077
|
/**
|
|
12061
12078
|
* Synchronize the prompt with the backend.
|
|
12062
12079
|
*
|
|
@@ -12066,6 +12083,12 @@ declare class Prompt extends BasePrompt {
|
|
|
12066
12083
|
* @returns Promise resolving to a new synced Prompt instance, or this instance if sync fails
|
|
12067
12084
|
*/
|
|
12068
12085
|
syncWithBackend(): Promise<Prompt>;
|
|
12086
|
+
/**
|
|
12087
|
+
* Get a Prompt with a specific version by commit hash.
|
|
12088
|
+
*
|
|
12089
|
+
* @param commit - Commit hash (8-char short form or full)
|
|
12090
|
+
* @returns Prompt instance representing that version, or null if not found
|
|
12091
|
+
*/
|
|
12069
12092
|
getVersion(commit: string): Promise<Prompt | null>;
|
|
12070
12093
|
}
|
|
12071
12094
|
|
|
@@ -12503,9 +12526,10 @@ declare class Dataset<T extends DatasetItemData = DatasetItemData> {
|
|
|
12503
12526
|
* Retrieve raw DatasetItem objects with full metadata (evaluators, executionPolicy) preserved.
|
|
12504
12527
|
*
|
|
12505
12528
|
* @param nbSamples The number of samples to retrieve. If not set - all items are returned
|
|
12529
|
+
* @param lastRetrievedId Optional ID of the last retrieved item for pagination
|
|
12506
12530
|
* @returns A list of DatasetItem objects
|
|
12507
12531
|
*/
|
|
12508
|
-
getRawItems(nbSamples?: number): Promise<DatasetItem<T>[]>;
|
|
12532
|
+
getRawItems(nbSamples?: number, lastRetrievedId?: string): Promise<DatasetItem<T>[]>;
|
|
12509
12533
|
/**
|
|
12510
12534
|
* Insert items from a JSON string array into the dataset.
|
|
12511
12535
|
*
|
|
@@ -12763,6 +12787,10 @@ interface EvaluateTestSuiteOptions<T = Record<string, unknown>> {
|
|
|
12763
12787
|
client?: OpikClient;
|
|
12764
12788
|
/** Optional list of tags to associate with the experiment */
|
|
12765
12789
|
tags?: string[];
|
|
12790
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
12791
|
+
taskThreads?: number;
|
|
12792
|
+
/** Limit the number of dataset items to evaluate. If not set, all items are evaluated. */
|
|
12793
|
+
nbSamples?: number;
|
|
12766
12794
|
}
|
|
12767
12795
|
/**
|
|
12768
12796
|
* Run a test suite using evaluators and execution policy stored in the dataset version metadata.
|
|
@@ -12783,7 +12811,6 @@ interface CreateTestSuiteOptions {
|
|
|
12783
12811
|
interface UpdateTestSuiteOptions {
|
|
12784
12812
|
globalAssertions?: string[];
|
|
12785
12813
|
globalExecutionPolicy?: ExecutionPolicy;
|
|
12786
|
-
tags?: string[];
|
|
12787
12814
|
}
|
|
12788
12815
|
declare class TestSuite {
|
|
12789
12816
|
private readonly _dataset;
|
|
@@ -12820,7 +12847,7 @@ declare class TestSuite {
|
|
|
12820
12847
|
* @throws Error if any item is missing an `id`
|
|
12821
12848
|
*/
|
|
12822
12849
|
update(items: UpdateTestSuiteItem[]): Promise<void>;
|
|
12823
|
-
getItems(): Promise<Array<{
|
|
12850
|
+
getItems(nbSamples?: number, lastRetrievedId?: string): Promise<Array<{
|
|
12824
12851
|
id: string;
|
|
12825
12852
|
data: Record<string, unknown>;
|
|
12826
12853
|
description?: string;
|
|
@@ -12889,6 +12916,10 @@ interface RunTestsOptions {
|
|
|
12889
12916
|
experimentTags?: string[];
|
|
12890
12917
|
/** Optional model name override for LLMJudge evaluators */
|
|
12891
12918
|
model?: string;
|
|
12919
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
12920
|
+
taskThreads?: number;
|
|
12921
|
+
/** Limit the number of dataset items to evaluate. If not set, all items are evaluated. */
|
|
12922
|
+
nbSamples?: number;
|
|
12892
12923
|
}
|
|
12893
12924
|
/**
|
|
12894
12925
|
* Run a test suite evaluation against a task function.
|
|
@@ -13133,9 +13164,12 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13133
13164
|
private readonly chatTemplate;
|
|
13134
13165
|
/**
|
|
13135
13166
|
* Creates a new ChatPrompt instance.
|
|
13136
|
-
*
|
|
13167
|
+
* All operations work seamlessly without requiring manual configuration.
|
|
13137
13168
|
*/
|
|
13169
|
+
constructor(data: ChatPromptData);
|
|
13170
|
+
/** @deprecated Passing an opik client is deprecated. */
|
|
13138
13171
|
constructor(data: ChatPromptData, opik: OpikClient);
|
|
13172
|
+
private _performSync;
|
|
13139
13173
|
/**
|
|
13140
13174
|
* Returns the template messages for this chat prompt.
|
|
13141
13175
|
* Alias for the `messages` property for consistency with Prompt.
|
|
@@ -13216,23 +13250,6 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13216
13250
|
* ```
|
|
13217
13251
|
*/
|
|
13218
13252
|
useVersion(version: PromptVersion): Promise<ChatPrompt>;
|
|
13219
|
-
/**
|
|
13220
|
-
* Get a ChatPrompt with a specific version by commit hash.
|
|
13221
|
-
*
|
|
13222
|
-
* @param commit - Commit hash (8-char short form or full)
|
|
13223
|
-
* @returns ChatPrompt instance representing that version, or null if not found
|
|
13224
|
-
*
|
|
13225
|
-
* @example
|
|
13226
|
-
* ```typescript
|
|
13227
|
-
* const chatPrompt = await client.getChatPrompt({ name: "greeting" });
|
|
13228
|
-
*
|
|
13229
|
-
* // Get a specific version directly as a ChatPrompt
|
|
13230
|
-
* const versionedPrompt = await chatPrompt.getVersion("abc123de");
|
|
13231
|
-
* if (versionedPrompt) {
|
|
13232
|
-
* const messages = versionedPrompt.format({ name: "Alice" });
|
|
13233
|
-
* }
|
|
13234
|
-
* ```
|
|
13235
|
-
*/
|
|
13236
13253
|
/**
|
|
13237
13254
|
* Synchronize the chat prompt with the backend.
|
|
13238
13255
|
*
|
|
@@ -13242,6 +13259,12 @@ declare class ChatPrompt extends BasePrompt {
|
|
|
13242
13259
|
* @returns Promise resolving to a new synced ChatPrompt instance, or this instance if sync fails
|
|
13243
13260
|
*/
|
|
13244
13261
|
syncWithBackend(): Promise<ChatPrompt>;
|
|
13262
|
+
/**
|
|
13263
|
+
* Get a ChatPrompt with a specific version by commit hash.
|
|
13264
|
+
*
|
|
13265
|
+
* @param commit - Commit hash (8-char short form or full)
|
|
13266
|
+
* @returns ChatPrompt instance representing that version, or null if not found
|
|
13267
|
+
*/
|
|
13245
13268
|
getVersion(commit: string): Promise<ChatPrompt | null>;
|
|
13246
13269
|
}
|
|
13247
13270
|
|
|
@@ -13940,6 +13963,11 @@ declare class OpikClient {
|
|
|
13940
13963
|
* Throws ConfigMismatchError on the first mismatch found.
|
|
13941
13964
|
*/
|
|
13942
13965
|
private _validatePromptProjects;
|
|
13966
|
+
/**
|
|
13967
|
+
* Waits for all unsynced BasePrompt values in `values` to finish syncing,
|
|
13968
|
+
* with a timeout. Returns true only when every prompt is synced.
|
|
13969
|
+
*/
|
|
13970
|
+
private _allPromptsSynced;
|
|
13943
13971
|
private _makeFallbackConfig;
|
|
13944
13972
|
/**
|
|
13945
13973
|
* Fetches a blueprint from the backend (or returns the cached one).
|
|
@@ -14118,6 +14146,8 @@ interface EvaluateOptions<T = Record<string, unknown>> {
|
|
|
14118
14146
|
scoringKeyMapping?: ScoringKeyMappingType;
|
|
14119
14147
|
/** Optional list of tags to associate with the experiment */
|
|
14120
14148
|
tags?: string[];
|
|
14149
|
+
/** Number of concurrent task executions (default: 16, matching Python SDK) */
|
|
14150
|
+
taskThreads?: number;
|
|
14121
14151
|
/** Optional agent configuration blueprint ID to link with the experiment */
|
|
14122
14152
|
blueprintId?: string;
|
|
14123
14153
|
}
|
|
@@ -15851,6 +15881,10 @@ declare class DatasetVersionNotFoundError extends OpikError {
|
|
|
15851
15881
|
constructor(versionName: string, datasetName: string);
|
|
15852
15882
|
}
|
|
15853
15883
|
|
|
15884
|
+
declare function getGlobalClient(): OpikClient;
|
|
15885
|
+
declare function setGlobalClient(client: OpikClient): void;
|
|
15886
|
+
declare function resetGlobalClient(): void;
|
|
15887
|
+
|
|
15854
15888
|
/**
|
|
15855
15889
|
* Type definitions for OQL (Opik Query Language) parser
|
|
15856
15890
|
*/
|
|
@@ -15979,4 +16013,4 @@ declare class ConfigMismatchError extends OpikError {
|
|
|
15979
16013
|
|
|
15980
16014
|
declare function activateRunner(): void;
|
|
15981
16015
|
|
|
15982
|
-
export { AgentTaskCompletionJudge, AgentToolCorrectnessJudge, type AllProviderOptions, AnnotationQueuePublicScope as AnnotationQueueScope, AnswerRelevance, type AnthropicProviderOptions, BaseLLMJudgeMetric, BaseMetric, BaseSuiteEvaluator, ChatPrompt, ComplianceRiskJudge, type Config, ConfigMismatchError, ConfigNotFoundError, Contains, type CreateTestSuiteOptions, DEFAULT_EXECUTION_POLICY, Dataset, type DatasetPublic, DatasetVersion, DatasetVersionNotFoundError, type DatasetVersionPublic, DemographicBiasJudge, DialogueHelpfulnessJudge, type ErrorInfo, type EvaluateOptions, type EvaluatePromptOptions, type EvaluateTestSuiteOptions, type EvaluationError, type EvaluationResult, type EvaluationScoreResult, type EvaluationTask, type EvaluationTestCase, type EvaluationTestResult, ExactMatch, type ExecutionPolicy, type FeedbackScoreData, type FewShotExampleAnswerRelevanceNoContext, type FewShotExampleAnswerRelevanceWithContext, type FewShotExampleHallucination, type FewShotExampleModeration, type FilterExpression, GEval, GEvalPreset, GenderBiasJudge, type GoogleProviderOptions, Hallucination, IsJson, type ItemResult, LLMJudge, type LLMJudgeConfig, type LLMJudgeModelSettings, type LLMJudgeOptions, type LLMJudgeResponseFormat, ModelConfigurationError, ModelError, ModelGenerationError, Moderation, type OpenAIProviderOptions, OpikClient as Opik, type OpikAssistantMessage, OpikBaseModel, type OpikConfig, type OpikMessage, OpikQueryLanguage, SpanType as OpikSpanType, type OpikSystemMessage, type OpikToolMessage, type OpikUserMessage, type Param, PoliticalBiasJudge, Prompt, PromptType, PromptUncertaintyJudge, type ProviderOptionsForModel, QARelevanceJudge, RegexMatch, RegionalBiasJudge, type RegistryEntry, ReligiousBiasJudge, ResponseSchema, type RunTestsOptions, SYSTEM_PROMPT, type ScoringKeyMappingType, Span, SpanType, SummarizationCoherenceJudge, SummarizationConsistencyJudge, type SupportedModelId, TestSuite, type TestSuiteItem, TestSuiteResult, ThreadsAnnotationQueue, Trace, TracesAnnotationQueue, USER_PROMPT_TEMPLATE, type UpdateTestSuiteItem, type UpdateTestSuiteOptions, Usefulness, VercelAIChatModel, activateRunner, agentConfigContext, buildSuiteResult, createModel, createModelFromInstance, deserializeEvaluators, detectProvider, disableLogger, evaluate, evaluatePrompt, evaluateTestSuite, flushAll, generateId, getTrackContext, logger, resolveEvaluators, resolveExecutionPolicy, resolveItemExecutionPolicy, resolveModel, runTests, serializeEvaluators, setLoggerLevel, track, validateEvaluators, validateExecutionPolicy };
|
|
16016
|
+
export { AgentTaskCompletionJudge, AgentToolCorrectnessJudge, type AllProviderOptions, AnnotationQueuePublicScope as AnnotationQueueScope, AnswerRelevance, type AnthropicProviderOptions, BaseLLMJudgeMetric, BaseMetric, BaseSuiteEvaluator, ChatPrompt, ComplianceRiskJudge, type Config, ConfigMismatchError, ConfigNotFoundError, Contains, type CreateTestSuiteOptions, DEFAULT_EXECUTION_POLICY, Dataset, type DatasetPublic, DatasetVersion, DatasetVersionNotFoundError, type DatasetVersionPublic, DemographicBiasJudge, DialogueHelpfulnessJudge, type ErrorInfo, type EvaluateOptions, type EvaluatePromptOptions, type EvaluateTestSuiteOptions, type EvaluationError, type EvaluationResult, type EvaluationScoreResult, type EvaluationTask, type EvaluationTestCase, type EvaluationTestResult, ExactMatch, type ExecutionPolicy, type FeedbackScoreData, type FewShotExampleAnswerRelevanceNoContext, type FewShotExampleAnswerRelevanceWithContext, type FewShotExampleHallucination, type FewShotExampleModeration, type FilterExpression, GEval, GEvalPreset, GenderBiasJudge, type GoogleProviderOptions, Hallucination, IsJson, type ItemResult, LLMJudge, type LLMJudgeConfig, type LLMJudgeModelSettings, type LLMJudgeOptions, type LLMJudgeResponseFormat, ModelConfigurationError, ModelError, ModelGenerationError, Moderation, type OpenAIProviderOptions, OpikClient as Opik, type OpikAssistantMessage, OpikBaseModel, type OpikConfig, type OpikMessage, OpikQueryLanguage, SpanType as OpikSpanType, type OpikSystemMessage, type OpikToolMessage, type OpikUserMessage, type Param, PoliticalBiasJudge, Prompt, PromptType, PromptUncertaintyJudge, type ProviderOptionsForModel, QARelevanceJudge, RegexMatch, RegionalBiasJudge, type RegistryEntry, ReligiousBiasJudge, ResponseSchema, type RunTestsOptions, SYSTEM_PROMPT, type ScoringKeyMappingType, Span, SpanType, SummarizationCoherenceJudge, SummarizationConsistencyJudge, type SupportedModelId, TestSuite, type TestSuiteItem, TestSuiteResult, ThreadsAnnotationQueue, Trace, TracesAnnotationQueue, USER_PROMPT_TEMPLATE, type UpdateTestSuiteItem, type UpdateTestSuiteOptions, Usefulness, VercelAIChatModel, activateRunner, agentConfigContext, buildSuiteResult, createModel, createModelFromInstance, deserializeEvaluators, detectProvider, disableLogger, evaluate, evaluatePrompt, evaluateTestSuite, flushAll, generateId, getGlobalClient, getTrackContext, logger, resetGlobalClient, resolveEvaluators, resolveExecutionPolicy, resolveItemExecutionPolicy, resolveModel, runTests, serializeEvaluators, setGlobalClient, setLoggerLevel, track, validateEvaluators, validateExecutionPolicy };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
import {Ba}from'./chunk-FTTQJ4TO.js';export{ra as AgentTaskCompletionJudge,qa as AgentToolCorrectnessJudge,ea as AnswerRelevance,aa as BaseLLMJudgeMetric,B as BaseMetric,C as BaseSuiteEvaluator,p as ChatPrompt,ta as ComplianceRiskJudge,i as ConfigMismatchError,h as ConfigNotFoundError,Z as Contains,y as DEFAULT_EXECUTION_POLICY,j as Dataset,f as DatasetVersion,g as DatasetVersionNotFoundError,la as DemographicBiasJudge,ja as DialogueHelpfulnessJudge,Y as ExactMatch,fa as GEval,ga as GEvalPreset,na as GenderBiasJudge,da as Hallucination,$ as IsJson,P as LLMJudge,G as ModelConfigurationError,E as ModelError,F as ModelGenerationError,ba as Moderation,za as Opik,D as OpikBaseModel,q as OpikQueryLanguage,d as OpikSpanType,ma as PoliticalBiasJudge,o as Prompt,k as PromptType,sa as PromptUncertaintyJudge,ka as QARelevanceJudge,_ as RegexMatch,pa as RegionalBiasJudge,oa as ReligiousBiasJudge,O as ResponseSchema,M as SYSTEM_PROMPT,ia as SummarizationCoherenceJudge,ha as SummarizationConsistencyJudge,xa as TestSuite,z as TestSuiteResult,s as ThreadsAnnotationQueue,r as TracesAnnotationQueue,N as USER_PROMPT_TEMPLATE,ca as Usefulness,I as VercelAIChatModel,v as activateRunner,t as agentConfigContext,A as buildSuiteResult,J as createModel,K as createModelFromInstance,R as deserializeEvaluators,H as detectProvider,c as disableLogger,W as evaluate,X as evaluatePrompt,U as evaluateTestSuite,u as flushAll,e as generateId,l as getGlobalClient,w as getTrackContext,a as logger,n as resetGlobalClient,ua as resolveEvaluators,S as resolveExecutionPolicy,T as resolveItemExecutionPolicy,L as resolveModel,V as runTests,Q as serializeEvaluators,m as setGlobalClient,b as setLoggerLevel,x as track,va as validateEvaluators,wa as validateExecutionPolicy,Aa as z}from'./chunk-FTTQJ4TO.js';Ba();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {ya}from'./chunk-FTTQJ4TO.js';export{y as DEFAULT_EXECUTION_POLICY,xa as TestSuite,z as TestSuiteResult,A as buildSuiteResult,R as deserializeEvaluators,U as evaluateTestSuite,S as resolveExecutionPolicy,T as resolveItemExecutionPolicy,V as runTests,Q as serializeEvaluators}from'./chunk-FTTQJ4TO.js';ya();
|