netra-sdk 1.3.0 → 1.5.0

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
@@ -28,7 +28,8 @@ declare enum NetraInstruments {
28
28
  */
29
29
  ALL = "__all__",
30
30
  OPENAI = "openai",
31
- GOOGLE_GENERATIVE_AI = "google_genai",
31
+ GOOGLE_GENAI = "google_genai",
32
+ GOOGLE_GENERATIVE_AI = "google_generative_ai",
32
33
  MISTRAL = "mistral_ai",
33
34
  GROQ = "groq",
34
35
  VERTEX_AI = "vertexai",
@@ -59,10 +60,11 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
59
60
  declare class Config {
60
61
  static readonly SDK_NAME = "netra";
61
62
  static readonly LIBRARY_NAME = "netra";
62
- static readonly LIBRARY_VERSION = "1.0.0";
63
+ static readonly LIBRARY_VERSION = "1.5.0";
63
64
  static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
64
65
  static readonly ATTRIBUTE_MAX_LEN: number;
65
66
  static readonly CONVERSATION_MAX_LEN: number;
67
+ static readonly SPAN_ATTRIBUTE_MAX_SIZE: number;
66
68
  appName: string;
67
69
  otlpEndpoint?: string;
68
70
  apiKey?: string;
@@ -94,6 +96,7 @@ declare class Config {
94
96
  * This ensures the Traceloop SDK picks up our configuration.
95
97
  */
96
98
  setTraceloopEnv(): void;
99
+ private _setResourceAttributesEnv;
97
100
  }
98
101
 
99
102
  /**
@@ -847,6 +850,23 @@ declare class Prompts {
847
850
  getPrompt(params: GetPromptParams): Promise<PromptResponse | null>;
848
851
  }
849
852
 
853
+ /**
854
+ * Attribute Size Limit Span Processor
855
+ *
856
+ * Enforces a hard max length on every span attribute value via setAttribute
857
+ * wrapping in onStart. Prevents "entity too large" errors during export.
858
+ */
859
+
860
+ declare class AttributeSizeLimitProcessor implements SpanProcessor {
861
+ private maxAttributeSize;
862
+ constructor(maxAttributeSize?: number);
863
+ onStart(span: Span, _parentContext: Context): void;
864
+ onEnd(_span: ReadableSpan): void;
865
+ shutdown(): Promise<void>;
866
+ forceFlush(): Promise<void>;
867
+ private _wrapSetAttribute;
868
+ }
869
+
850
870
  /**
851
871
  * Instrumentation Span Processor
852
872
  *
@@ -947,6 +967,8 @@ declare class ScrubbingSpanProcessor implements SpanProcessor {
947
967
  */
948
968
 
949
969
  declare class SessionSpanProcessor implements SpanProcessor {
970
+ private readonly environment;
971
+ constructor(environment?: string);
950
972
  /**
951
973
  * Called when a span starts. Adds session and entity context attributes.
952
974
  */
@@ -967,7 +989,7 @@ declare class SessionSpanProcessor implements SpanProcessor {
967
989
 
968
990
  declare class SpanIOProcessor implements SpanProcessor {
969
991
  onStart(span: Span, _parentContext: Context): void;
970
- onEnd(span: ReadableSpan): void;
992
+ onEnd(_span: ReadableSpan): void;
971
993
  shutdown(): Promise<void>;
972
994
  forceFlush(): Promise<void>;
973
995
  private _wrapSetAttribute;
@@ -1326,6 +1348,23 @@ interface SpanData {
1326
1348
  input_tokens?: number;
1327
1349
  output_tokens?: number;
1328
1350
  details?: Record<string, unknown> | null;
1351
+ input_tokens_details?: {
1352
+ cached_tokens?: number;
1353
+ cache_write_tokens?: number;
1354
+ } | null;
1355
+ output_tokens_details?: {
1356
+ reasoning_tokens?: number;
1357
+ } | null;
1358
+ prompt_tokens?: number;
1359
+ completion_tokens?: number;
1360
+ total_tokens?: number;
1361
+ prompt_tokens_details?: {
1362
+ cached_tokens?: number;
1363
+ cache_write_tokens?: number;
1364
+ } | null;
1365
+ completion_tokens_details?: {
1366
+ reasoning_tokens?: number;
1367
+ } | null;
1329
1368
  };
1330
1369
  to_agent?: string;
1331
1370
  from_agent?: string;
@@ -1585,4 +1624,4 @@ declare class Netra {
1585
1624
  static withBlockedSpansLocal: typeof withBlockedSpansLocal;
1586
1625
  }
1587
1626
 
1588
- export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, 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, type GetPromptParams, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, 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, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, span, task, workflow };
1627
+ export { type ActionModel, Aggregation, AttributeSizeLimitProcessor, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, 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, type GetPromptParams, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, 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, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, span, task, workflow };
package/dist/index.d.ts CHANGED
@@ -28,7 +28,8 @@ declare enum NetraInstruments {
28
28
  */
29
29
  ALL = "__all__",
30
30
  OPENAI = "openai",
31
- GOOGLE_GENERATIVE_AI = "google_genai",
31
+ GOOGLE_GENAI = "google_genai",
32
+ GOOGLE_GENERATIVE_AI = "google_generative_ai",
32
33
  MISTRAL = "mistral_ai",
33
34
  GROQ = "groq",
34
35
  VERTEX_AI = "vertexai",
@@ -59,10 +60,11 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
59
60
  declare class Config {
60
61
  static readonly SDK_NAME = "netra";
61
62
  static readonly LIBRARY_NAME = "netra";
62
- static readonly LIBRARY_VERSION = "1.0.0";
63
+ static readonly LIBRARY_VERSION = "1.5.0";
63
64
  static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
64
65
  static readonly ATTRIBUTE_MAX_LEN: number;
65
66
  static readonly CONVERSATION_MAX_LEN: number;
67
+ static readonly SPAN_ATTRIBUTE_MAX_SIZE: number;
66
68
  appName: string;
67
69
  otlpEndpoint?: string;
68
70
  apiKey?: string;
@@ -94,6 +96,7 @@ declare class Config {
94
96
  * This ensures the Traceloop SDK picks up our configuration.
95
97
  */
96
98
  setTraceloopEnv(): void;
99
+ private _setResourceAttributesEnv;
97
100
  }
98
101
 
99
102
  /**
@@ -847,6 +850,23 @@ declare class Prompts {
847
850
  getPrompt(params: GetPromptParams): Promise<PromptResponse | null>;
848
851
  }
849
852
 
853
+ /**
854
+ * Attribute Size Limit Span Processor
855
+ *
856
+ * Enforces a hard max length on every span attribute value via setAttribute
857
+ * wrapping in onStart. Prevents "entity too large" errors during export.
858
+ */
859
+
860
+ declare class AttributeSizeLimitProcessor implements SpanProcessor {
861
+ private maxAttributeSize;
862
+ constructor(maxAttributeSize?: number);
863
+ onStart(span: Span, _parentContext: Context): void;
864
+ onEnd(_span: ReadableSpan): void;
865
+ shutdown(): Promise<void>;
866
+ forceFlush(): Promise<void>;
867
+ private _wrapSetAttribute;
868
+ }
869
+
850
870
  /**
851
871
  * Instrumentation Span Processor
852
872
  *
@@ -947,6 +967,8 @@ declare class ScrubbingSpanProcessor implements SpanProcessor {
947
967
  */
948
968
 
949
969
  declare class SessionSpanProcessor implements SpanProcessor {
970
+ private readonly environment;
971
+ constructor(environment?: string);
950
972
  /**
951
973
  * Called when a span starts. Adds session and entity context attributes.
952
974
  */
@@ -967,7 +989,7 @@ declare class SessionSpanProcessor implements SpanProcessor {
967
989
 
968
990
  declare class SpanIOProcessor implements SpanProcessor {
969
991
  onStart(span: Span, _parentContext: Context): void;
970
- onEnd(span: ReadableSpan): void;
992
+ onEnd(_span: ReadableSpan): void;
971
993
  shutdown(): Promise<void>;
972
994
  forceFlush(): Promise<void>;
973
995
  private _wrapSetAttribute;
@@ -1326,6 +1348,23 @@ interface SpanData {
1326
1348
  input_tokens?: number;
1327
1349
  output_tokens?: number;
1328
1350
  details?: Record<string, unknown> | null;
1351
+ input_tokens_details?: {
1352
+ cached_tokens?: number;
1353
+ cache_write_tokens?: number;
1354
+ } | null;
1355
+ output_tokens_details?: {
1356
+ reasoning_tokens?: number;
1357
+ } | null;
1358
+ prompt_tokens?: number;
1359
+ completion_tokens?: number;
1360
+ total_tokens?: number;
1361
+ prompt_tokens_details?: {
1362
+ cached_tokens?: number;
1363
+ cache_write_tokens?: number;
1364
+ } | null;
1365
+ completion_tokens_details?: {
1366
+ reasoning_tokens?: number;
1367
+ } | null;
1329
1368
  };
1330
1369
  to_agent?: string;
1331
1370
  from_agent?: string;
@@ -1585,4 +1624,4 @@ declare class Netra {
1585
1624
  static withBlockedSpansLocal: typeof withBlockedSpansLocal;
1586
1625
  }
1587
1626
 
1588
- export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, 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, type GetPromptParams, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, 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, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, span, task, workflow };
1627
+ export { type ActionModel, Aggregation, AttributeSizeLimitProcessor, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, type CreateRunResult, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, 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, type GetPromptParams, GroupBy, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, Scope, ScrubbingSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, 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, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, span, task, workflow };