netra-sdk 1.0.3 → 1.0.5
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.cjs +457 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -2
- package/dist/index.d.ts +108 -2
- package/dist/index.js +454 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -110,7 +110,9 @@ declare enum Measure {
|
|
|
110
110
|
REQUEST_COUNT = "Request Count",
|
|
111
111
|
TOTAL_COST = "Total Cost",
|
|
112
112
|
VIOLATIONS = "Violations",
|
|
113
|
-
TOTAL_TOKENS = "Total Tokens"
|
|
113
|
+
TOTAL_TOKENS = "Total Tokens",
|
|
114
|
+
AUDIO_DURATION = "Audio Duration",
|
|
115
|
+
CHARACTER_COUNT = "Character Count"
|
|
114
116
|
}
|
|
115
117
|
declare enum Aggregation {
|
|
116
118
|
AVERAGE = "Average",
|
|
@@ -814,6 +816,105 @@ declare enum ConversationType {
|
|
|
814
816
|
OUTPUT = "output"
|
|
815
817
|
}
|
|
816
818
|
|
|
819
|
+
/**
|
|
820
|
+
* Represents a single item in a simulation run.
|
|
821
|
+
*/
|
|
822
|
+
interface SimulationItem {
|
|
823
|
+
runItemId: string;
|
|
824
|
+
message: string;
|
|
825
|
+
turnId: string;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Response from the conversation trigger API.
|
|
829
|
+
*/
|
|
830
|
+
interface ConversationResponse {
|
|
831
|
+
decision: string;
|
|
832
|
+
reason?: string;
|
|
833
|
+
nextTurnId?: string;
|
|
834
|
+
nextUserMessage?: string;
|
|
835
|
+
nextRunItemId?: string;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Result returned from the user's task function.
|
|
839
|
+
*/
|
|
840
|
+
interface TaskResult {
|
|
841
|
+
message: string;
|
|
842
|
+
sessionId: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Result of a single conversation execution.
|
|
846
|
+
*/
|
|
847
|
+
interface ConversationResult {
|
|
848
|
+
runItemId: string;
|
|
849
|
+
success: boolean;
|
|
850
|
+
error?: string;
|
|
851
|
+
finalTurnId?: string;
|
|
852
|
+
turnId?: string;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Overall simulation run result.
|
|
856
|
+
*/
|
|
857
|
+
interface SimulationResult {
|
|
858
|
+
success: boolean;
|
|
859
|
+
completed: ConversationResult[];
|
|
860
|
+
failed: ConversationResult[];
|
|
861
|
+
totalItems: number;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
declare abstract class BaseTask {
|
|
865
|
+
/**
|
|
866
|
+
* @param message - The input message from the simulation.
|
|
867
|
+
* @param sessionId - The Session identifier.
|
|
868
|
+
* @returns The task result containing:
|
|
869
|
+
* - message (string): The response message from the task.
|
|
870
|
+
* - sessionId (string): The session identifier.
|
|
871
|
+
*/
|
|
872
|
+
abstract run(message: string, sessionId?: string | null): Promise<TaskResult> | TaskResult;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Public API for running multi-turn conversation simulations.
|
|
877
|
+
*/
|
|
878
|
+
|
|
879
|
+
interface SimulationOptions {
|
|
880
|
+
name: string;
|
|
881
|
+
datasetId: string;
|
|
882
|
+
task: BaseTask;
|
|
883
|
+
context?: Record<string, any>;
|
|
884
|
+
maxConcurrency?: number;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Public API for running multi-turn conversation simulations.
|
|
888
|
+
*/
|
|
889
|
+
declare class Simulation {
|
|
890
|
+
private _config;
|
|
891
|
+
private _client;
|
|
892
|
+
constructor(config: Config);
|
|
893
|
+
/**
|
|
894
|
+
* Run a multi-turn conversation simulation.
|
|
895
|
+
*
|
|
896
|
+
* @param options - Simulation configuration options
|
|
897
|
+
* @returns Dictionary with simulation results, or null on failure
|
|
898
|
+
*/
|
|
899
|
+
runSimulation(options: SimulationOptions): Promise<SimulationResult | null>;
|
|
900
|
+
/**
|
|
901
|
+
* Async implementation of run_simulation with concurrency control.
|
|
902
|
+
*/
|
|
903
|
+
private _runSimulationAsync;
|
|
904
|
+
/**
|
|
905
|
+
* Execute a multi-turn conversation for a single simulation item.
|
|
906
|
+
*/
|
|
907
|
+
private _executeConversation;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Result from creating a simulation run.
|
|
912
|
+
*/
|
|
913
|
+
interface CreateRunResult {
|
|
914
|
+
runId: string;
|
|
915
|
+
simulationItems: SimulationItem[];
|
|
916
|
+
}
|
|
917
|
+
|
|
817
918
|
/**
|
|
818
919
|
* Type definitions for Netra SDK
|
|
819
920
|
*/
|
|
@@ -1134,6 +1235,11 @@ declare class Netra {
|
|
|
1134
1235
|
* Available after calling Netra.init()
|
|
1135
1236
|
*/
|
|
1136
1237
|
static dashboard: Dashboard;
|
|
1238
|
+
static simulation: Simulation;
|
|
1239
|
+
/**
|
|
1240
|
+
* Get the current Netra configuration
|
|
1241
|
+
*/
|
|
1242
|
+
static getConfig(): Config;
|
|
1137
1243
|
/**
|
|
1138
1244
|
* Check if Netra has been initialized
|
|
1139
1245
|
*/
|
|
@@ -1237,4 +1343,4 @@ declare class Netra {
|
|
|
1237
1343
|
static withBlockedSpansLocal: typeof withBlockedSpansLocal;
|
|
1238
1344
|
}
|
|
1239
1345
|
|
|
1240
|
-
export { type ActionModel, Aggregation, type CategoricalDataPoint, ChartType, Config, ConversationType, type CreateDatasetParams, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraInstruments, type NumberResponse, Operator, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, SpanType, type SpansPage, type TaskFunction, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, span, task, workflow };
|
|
1346
|
+
export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraInstruments, type NumberResponse, Operator, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanType, type SpansPage, type TaskFunction, type TaskResult, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, span, task, workflow };
|
package/dist/index.d.ts
CHANGED
|
@@ -110,7 +110,9 @@ declare enum Measure {
|
|
|
110
110
|
REQUEST_COUNT = "Request Count",
|
|
111
111
|
TOTAL_COST = "Total Cost",
|
|
112
112
|
VIOLATIONS = "Violations",
|
|
113
|
-
TOTAL_TOKENS = "Total Tokens"
|
|
113
|
+
TOTAL_TOKENS = "Total Tokens",
|
|
114
|
+
AUDIO_DURATION = "Audio Duration",
|
|
115
|
+
CHARACTER_COUNT = "Character Count"
|
|
114
116
|
}
|
|
115
117
|
declare enum Aggregation {
|
|
116
118
|
AVERAGE = "Average",
|
|
@@ -814,6 +816,105 @@ declare enum ConversationType {
|
|
|
814
816
|
OUTPUT = "output"
|
|
815
817
|
}
|
|
816
818
|
|
|
819
|
+
/**
|
|
820
|
+
* Represents a single item in a simulation run.
|
|
821
|
+
*/
|
|
822
|
+
interface SimulationItem {
|
|
823
|
+
runItemId: string;
|
|
824
|
+
message: string;
|
|
825
|
+
turnId: string;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Response from the conversation trigger API.
|
|
829
|
+
*/
|
|
830
|
+
interface ConversationResponse {
|
|
831
|
+
decision: string;
|
|
832
|
+
reason?: string;
|
|
833
|
+
nextTurnId?: string;
|
|
834
|
+
nextUserMessage?: string;
|
|
835
|
+
nextRunItemId?: string;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Result returned from the user's task function.
|
|
839
|
+
*/
|
|
840
|
+
interface TaskResult {
|
|
841
|
+
message: string;
|
|
842
|
+
sessionId: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Result of a single conversation execution.
|
|
846
|
+
*/
|
|
847
|
+
interface ConversationResult {
|
|
848
|
+
runItemId: string;
|
|
849
|
+
success: boolean;
|
|
850
|
+
error?: string;
|
|
851
|
+
finalTurnId?: string;
|
|
852
|
+
turnId?: string;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Overall simulation run result.
|
|
856
|
+
*/
|
|
857
|
+
interface SimulationResult {
|
|
858
|
+
success: boolean;
|
|
859
|
+
completed: ConversationResult[];
|
|
860
|
+
failed: ConversationResult[];
|
|
861
|
+
totalItems: number;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
declare abstract class BaseTask {
|
|
865
|
+
/**
|
|
866
|
+
* @param message - The input message from the simulation.
|
|
867
|
+
* @param sessionId - The Session identifier.
|
|
868
|
+
* @returns The task result containing:
|
|
869
|
+
* - message (string): The response message from the task.
|
|
870
|
+
* - sessionId (string): The session identifier.
|
|
871
|
+
*/
|
|
872
|
+
abstract run(message: string, sessionId?: string | null): Promise<TaskResult> | TaskResult;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Public API for running multi-turn conversation simulations.
|
|
877
|
+
*/
|
|
878
|
+
|
|
879
|
+
interface SimulationOptions {
|
|
880
|
+
name: string;
|
|
881
|
+
datasetId: string;
|
|
882
|
+
task: BaseTask;
|
|
883
|
+
context?: Record<string, any>;
|
|
884
|
+
maxConcurrency?: number;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Public API for running multi-turn conversation simulations.
|
|
888
|
+
*/
|
|
889
|
+
declare class Simulation {
|
|
890
|
+
private _config;
|
|
891
|
+
private _client;
|
|
892
|
+
constructor(config: Config);
|
|
893
|
+
/**
|
|
894
|
+
* Run a multi-turn conversation simulation.
|
|
895
|
+
*
|
|
896
|
+
* @param options - Simulation configuration options
|
|
897
|
+
* @returns Dictionary with simulation results, or null on failure
|
|
898
|
+
*/
|
|
899
|
+
runSimulation(options: SimulationOptions): Promise<SimulationResult | null>;
|
|
900
|
+
/**
|
|
901
|
+
* Async implementation of run_simulation with concurrency control.
|
|
902
|
+
*/
|
|
903
|
+
private _runSimulationAsync;
|
|
904
|
+
/**
|
|
905
|
+
* Execute a multi-turn conversation for a single simulation item.
|
|
906
|
+
*/
|
|
907
|
+
private _executeConversation;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Result from creating a simulation run.
|
|
912
|
+
*/
|
|
913
|
+
interface CreateRunResult {
|
|
914
|
+
runId: string;
|
|
915
|
+
simulationItems: SimulationItem[];
|
|
916
|
+
}
|
|
917
|
+
|
|
817
918
|
/**
|
|
818
919
|
* Type definitions for Netra SDK
|
|
819
920
|
*/
|
|
@@ -1134,6 +1235,11 @@ declare class Netra {
|
|
|
1134
1235
|
* Available after calling Netra.init()
|
|
1135
1236
|
*/
|
|
1136
1237
|
static dashboard: Dashboard;
|
|
1238
|
+
static simulation: Simulation;
|
|
1239
|
+
/**
|
|
1240
|
+
* Get the current Netra configuration
|
|
1241
|
+
*/
|
|
1242
|
+
static getConfig(): Config;
|
|
1137
1243
|
/**
|
|
1138
1244
|
* Check if Netra has been initialized
|
|
1139
1245
|
*/
|
|
@@ -1237,4 +1343,4 @@ declare class Netra {
|
|
|
1237
1343
|
static withBlockedSpansLocal: typeof withBlockedSpansLocal;
|
|
1238
1344
|
}
|
|
1239
1345
|
|
|
1240
|
-
export { type ActionModel, Aggregation, type CategoricalDataPoint, ChartType, Config, ConversationType, type CreateDatasetParams, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraInstruments, type NumberResponse, Operator, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, SpanType, type SpansPage, type TaskFunction, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, span, task, workflow };
|
|
1346
|
+
export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraInstruments, type NumberResponse, Operator, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanType, type SpansPage, type TaskFunction, type TaskResult, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, span, task, workflow };
|