netra-sdk 1.9.0 → 1.10.1

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
@@ -77,7 +77,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
77
77
  declare class Config {
78
78
  static readonly SDK_NAME = "netra";
79
79
  static readonly LIBRARY_NAME = "netra";
80
- static readonly LIBRARY_VERSION = "1.8.0";
80
+ static readonly LIBRARY_VERSION = "1.10.0";
81
81
  static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
82
82
  static readonly TRACE_ORIGIN_KEY = "netra.trace.origin";
83
83
  static readonly TRACE_ORIGIN_EVALUATION = "evaluation";
@@ -883,9 +883,18 @@ declare class Dashboard {
883
883
  /**
884
884
  * Prompts API Models
885
885
  */
886
+ /** Default TTL (seconds) for prompt cache when useCache is true and cacheTtl is omitted. */
887
+ declare const PROMPT_CACHE_TTL_SECONDS = 60;
886
888
  interface GetPromptParams {
887
889
  name: string;
888
890
  label?: string;
891
+ /** When true, serve from in-memory cache when available (default: false). */
892
+ useCache?: boolean;
893
+ /**
894
+ * Per-call TTL in seconds.
895
+ * When omitted with useCache: true, uses PROMPT_CACHE_TTL_SECONDS (60).
896
+ */
897
+ cacheTtl?: number;
889
898
  }
890
899
  /**
891
900
  * Prompt response is intentionally flexible because
@@ -896,16 +905,67 @@ type PromptResponse = Record<string, any>;
896
905
  declare class Prompts {
897
906
  private config;
898
907
  private client;
908
+ private cache;
899
909
  constructor(config: Config);
910
+ /** Clear all cached prompt entries. */
911
+ clearCache(): void;
900
912
  /**
901
913
  * Fetch prompt version by name and label.
902
914
  *
903
- * @param params.name - Name of the prompt (required)
904
- * @param params.label - Label of the prompt version (default: "production")
915
+ * @param params.name - Name of the prompt (required)
916
+ * @param params.label - Label of the prompt version (default: "production")
917
+ * @param params.useCache - When true, read/write the in-memory cache (default: false)
918
+ * @param params.cacheTtl - Per-call cache TTL in seconds (default: PROMPT_CACHE_TTL_SECONDS)
905
919
  */
906
920
  getPrompt(params: GetPromptParams): Promise<PromptResponse | null>;
907
921
  }
908
922
 
923
+ /**
924
+ * Models API Models
925
+ */
926
+ /** Default TTL (seconds) for model pricing cache when useCache is true and cacheTtl is omitted. */
927
+ declare const MODEL_PRICING_CACHE_TTL_SECONDS = 300;
928
+ interface ModelPrice {
929
+ usageType: string;
930
+ minUnits: number;
931
+ maxUnits: number;
932
+ price: number;
933
+ unitValue: number;
934
+ }
935
+ interface ModelPricing {
936
+ name: string;
937
+ projectId: string | null;
938
+ matchPattern: string;
939
+ prices: ModelPrice[];
940
+ }
941
+ interface GetModelPricingParams {
942
+ name?: string;
943
+ /** When true, read/write in-memory cache (default: false). */
944
+ useCache?: boolean;
945
+ /**
946
+ * Per-call TTL in seconds.
947
+ * When omitted with useCache: true, uses MODEL_PRICING_CACHE_TTL_SECONDS (300).
948
+ */
949
+ cacheTtl?: number;
950
+ }
951
+
952
+ declare class Models {
953
+ private config;
954
+ private client;
955
+ private cache;
956
+ constructor(config: Config);
957
+ /** Clear all cached model pricing entries. */
958
+ clearCache(): void;
959
+ /**
960
+ * Fetch model pricing from the backend.
961
+ *
962
+ * @param params.name - Optional model name filter
963
+ * @param params.useCache - When true, read/write the in-memory cache (default: false)
964
+ * @param params.cacheTtl - Per-call cache TTL in seconds (default: MODEL_PRICING_CACHE_TTL_SECONDS)
965
+ */
966
+ getModelPricing(params?: GetModelPricingParams): Promise<ModelPricing[] | null>;
967
+ }
968
+
909
969
  /**
910
970
  * Instrumentation Span Processor
911
971
  *
@@ -1790,8 +1850,12 @@ declare class Netra {
1790
1850
  static dashboard: Dashboard;
1791
1851
  static simulation: Simulation;
1792
1852
  static prompts: Prompts;
1853
+ static models: Models;
1793
1854
  static getConfig(): Config;
1794
1855
  static isInitialized(): boolean;
1856
+ /**
1857
+ * Initialize the Netra SDK.
1858
+ */
1795
1859
  static init(config?: NetraConfig): Promise<void>;
1796
1860
  static shutdown(): Promise<void>;
1797
1861
  static getTraceId(): string | undefined;
@@ -1829,4 +1893,4 @@ declare class Netra {
1829
1893
  static withBlockedSpansLocal: typeof withBlockedSpansLocal;
1830
1894
  }
1831
1895
 
1832
- export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, 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, type InitializeRunResult, 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, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, type SessionDetailsResponse, type SessionDetailsToolCall, type SessionDetailsTrace, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, 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, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };
1896
+ export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, 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 GetModelPricingParams, type GetPromptParams, GroupBy, type InitializeRunResult, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, MODEL_PRICING_CACHE_TTL_SECONDS, Measure, type Metrics, type ModelPrice, type ModelPricing, Models, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, PROMPT_CACHE_TTL_SECONDS, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, type SessionDetailsResponse, type SessionDetailsToolCall, type SessionDetailsTrace, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, 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, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };
package/dist/index.d.ts CHANGED
@@ -77,7 +77,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
77
77
  declare class Config {
78
78
  static readonly SDK_NAME = "netra";
79
79
  static readonly LIBRARY_NAME = "netra";
80
- static readonly LIBRARY_VERSION = "1.8.0";
80
+ static readonly LIBRARY_VERSION = "1.10.0";
81
81
  static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
82
82
  static readonly TRACE_ORIGIN_KEY = "netra.trace.origin";
83
83
  static readonly TRACE_ORIGIN_EVALUATION = "evaluation";
@@ -883,9 +883,18 @@ declare class Dashboard {
883
883
  /**
884
884
  * Prompts API Models
885
885
  */
886
+ /** Default TTL (seconds) for prompt cache when useCache is true and cacheTtl is omitted. */
887
+ declare const PROMPT_CACHE_TTL_SECONDS = 60;
886
888
  interface GetPromptParams {
887
889
  name: string;
888
890
  label?: string;
891
+ /** When true, serve from in-memory cache when available (default: false). */
892
+ useCache?: boolean;
893
+ /**
894
+ * Per-call TTL in seconds.
895
+ * When omitted with useCache: true, uses PROMPT_CACHE_TTL_SECONDS (60).
896
+ */
897
+ cacheTtl?: number;
889
898
  }
890
899
  /**
891
900
  * Prompt response is intentionally flexible because
@@ -896,16 +905,67 @@ type PromptResponse = Record<string, any>;
896
905
  declare class Prompts {
897
906
  private config;
898
907
  private client;
908
+ private cache;
899
909
  constructor(config: Config);
910
+ /** Clear all cached prompt entries. */
911
+ clearCache(): void;
900
912
  /**
901
913
  * Fetch prompt version by name and label.
902
914
  *
903
- * @param params.name - Name of the prompt (required)
904
- * @param params.label - Label of the prompt version (default: "production")
915
+ * @param params.name - Name of the prompt (required)
916
+ * @param params.label - Label of the prompt version (default: "production")
917
+ * @param params.useCache - When true, read/write the in-memory cache (default: false)
918
+ * @param params.cacheTtl - Per-call cache TTL in seconds (default: PROMPT_CACHE_TTL_SECONDS)
905
919
  */
906
920
  getPrompt(params: GetPromptParams): Promise<PromptResponse | null>;
907
921
  }
908
922
 
923
+ /**
924
+ * Models API Models
925
+ */
926
+ /** Default TTL (seconds) for model pricing cache when useCache is true and cacheTtl is omitted. */
927
+ declare const MODEL_PRICING_CACHE_TTL_SECONDS = 300;
928
+ interface ModelPrice {
929
+ usageType: string;
930
+ minUnits: number;
931
+ maxUnits: number;
932
+ price: number;
933
+ unitValue: number;
934
+ }
935
+ interface ModelPricing {
936
+ name: string;
937
+ projectId: string | null;
938
+ matchPattern: string;
939
+ prices: ModelPrice[];
940
+ }
941
+ interface GetModelPricingParams {
942
+ name?: string;
943
+ /** When true, read/write in-memory cache (default: false). */
944
+ useCache?: boolean;
945
+ /**
946
+ * Per-call TTL in seconds.
947
+ * When omitted with useCache: true, uses MODEL_PRICING_CACHE_TTL_SECONDS (300).
948
+ */
949
+ cacheTtl?: number;
950
+ }
951
+
952
+ declare class Models {
953
+ private config;
954
+ private client;
955
+ private cache;
956
+ constructor(config: Config);
957
+ /** Clear all cached model pricing entries. */
958
+ clearCache(): void;
959
+ /**
960
+ * Fetch model pricing from the backend.
961
+ *
962
+ * @param params.name - Optional model name filter
963
+ * @param params.useCache - When true, read/write the in-memory cache (default: false)
964
+ * @param params.cacheTtl - Per-call cache TTL in seconds (default: MODEL_PRICING_CACHE_TTL_SECONDS)
965
+ */
966
+ getModelPricing(params?: GetModelPricingParams): Promise<ModelPricing[] | null>;
967
+ }
968
+
909
969
  /**
910
970
  * Instrumentation Span Processor
911
971
  *
@@ -1790,8 +1850,12 @@ declare class Netra {
1790
1850
  static dashboard: Dashboard;
1791
1851
  static simulation: Simulation;
1792
1852
  static prompts: Prompts;
1853
+ static models: Models;
1793
1854
  static getConfig(): Config;
1794
1855
  static isInitialized(): boolean;
1856
+ /**
1857
+ * Initialize the Netra SDK.
1858
+ */
1795
1859
  static init(config?: NetraConfig): Promise<void>;
1796
1860
  static shutdown(): Promise<void>;
1797
1861
  static getTraceId(): string | undefined;
@@ -1829,4 +1893,4 @@ declare class Netra {
1829
1893
  static withBlockedSpansLocal: typeof withBlockedSpansLocal;
1830
1894
  }
1831
1895
 
1832
- export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, 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, type InitializeRunResult, 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, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, type SessionDetailsResponse, type SessionDetailsToolCall, type SessionDetailsTrace, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, 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, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };
1896
+ export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, 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 GetModelPricingParams, type GetPromptParams, GroupBy, type InitializeRunResult, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, MODEL_PRICING_CACHE_TTL_SECONDS, Measure, type Metrics, type ModelPrice, type ModelPricing, Models, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, PROMPT_CACHE_TTL_SECONDS, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, type SessionDetailsResponse, type SessionDetailsToolCall, type SessionDetailsTrace, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, 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, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };