netra-sdk 1.10.0 → 1.11.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/chunk-LRCHNZDG.js +419 -0
- package/dist/chunk-LRCHNZDG.js.map +1 -0
- package/dist/chunk-TFPEWHM4.js +564 -0
- package/dist/chunk-TFPEWHM4.js.map +1 -0
- package/dist/dist-4UBY6Q6Z.js +21658 -0
- package/dist/dist-4UBY6Q6Z.js.map +1 -0
- package/dist/index.cjs +37735 -12621
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +24 -347
- package/dist/index.js.map +1 -1
- package/dist/manager-BKZT7MYF.js +15991 -0
- package/dist/manager-BKZT7MYF.js.map +1 -0
- package/package.json +17 -8
- package/dist/chunk-WMQRYJGR.js +0 -649
- package/dist/chunk-WMQRYJGR.js.map +0 -1
- package/dist/dist-GIPRCO2C.js +0 -13704
- package/dist/dist-GIPRCO2C.js.map +0 -1
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.
|
|
80
|
+
static readonly LIBRARY_VERSION = "1.11.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";
|
|
@@ -1556,6 +1556,10 @@ interface SpanData {
|
|
|
1556
1556
|
input_tokens_details?: {
|
|
1557
1557
|
cached_tokens?: number;
|
|
1558
1558
|
cache_write_tokens?: number;
|
|
1559
|
+
cache_write_tokens_details?: {
|
|
1560
|
+
ttl_30m_tokens?: number;
|
|
1561
|
+
ttl_12h_tokens?: number;
|
|
1562
|
+
} | null;
|
|
1559
1563
|
} | null;
|
|
1560
1564
|
output_tokens_details?: {
|
|
1561
1565
|
reasoning_tokens?: number;
|
|
@@ -1566,6 +1570,10 @@ interface SpanData {
|
|
|
1566
1570
|
prompt_tokens_details?: {
|
|
1567
1571
|
cached_tokens?: number;
|
|
1568
1572
|
cache_write_tokens?: number;
|
|
1573
|
+
cache_write_tokens_details?: {
|
|
1574
|
+
ttl_30m_tokens?: number;
|
|
1575
|
+
ttl_12h_tokens?: number;
|
|
1576
|
+
} | null;
|
|
1569
1577
|
} | null;
|
|
1570
1578
|
completion_tokens_details?: {
|
|
1571
1579
|
reasoning_tokens?: number;
|
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.
|
|
80
|
+
static readonly LIBRARY_VERSION = "1.11.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";
|
|
@@ -1556,6 +1556,10 @@ interface SpanData {
|
|
|
1556
1556
|
input_tokens_details?: {
|
|
1557
1557
|
cached_tokens?: number;
|
|
1558
1558
|
cache_write_tokens?: number;
|
|
1559
|
+
cache_write_tokens_details?: {
|
|
1560
|
+
ttl_30m_tokens?: number;
|
|
1561
|
+
ttl_12h_tokens?: number;
|
|
1562
|
+
} | null;
|
|
1559
1563
|
} | null;
|
|
1560
1564
|
output_tokens_details?: {
|
|
1561
1565
|
reasoning_tokens?: number;
|
|
@@ -1566,6 +1570,10 @@ interface SpanData {
|
|
|
1566
1570
|
prompt_tokens_details?: {
|
|
1567
1571
|
cached_tokens?: number;
|
|
1568
1572
|
cache_write_tokens?: number;
|
|
1573
|
+
cache_write_tokens_details?: {
|
|
1574
|
+
ttl_30m_tokens?: number;
|
|
1575
|
+
ttl_12h_tokens?: number;
|
|
1576
|
+
} | null;
|
|
1569
1577
|
} | null;
|
|
1570
1578
|
completion_tokens_details?: {
|
|
1571
1579
|
reasoning_tokens?: number;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __require, BaseCallbackHandler } from './chunk-LRCHNZDG.js';
|
|
2
2
|
import { createContextKey, propagation, trace, context, SpanKind, SpanStatusCode, ROOT_CONTEXT } from '@opentelemetry/api';
|
|
3
3
|
import { createRequire } from 'module';
|
|
4
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
@@ -579,7 +579,7 @@ var Usage = class {
|
|
|
579
579
|
};
|
|
580
580
|
|
|
581
581
|
// src/version.ts
|
|
582
|
-
var SDK_VERSION = "1.
|
|
582
|
+
var SDK_VERSION = "1.11.0";
|
|
583
583
|
|
|
584
584
|
// src/config.ts
|
|
585
585
|
var NetraInstruments = /* @__PURE__ */ ((NetraInstruments2) => {
|
|
@@ -4231,6 +4231,8 @@ var SpanAttributes2 = {
|
|
|
4231
4231
|
LLM_USAGE_COMPLETION_TOKENS: "gen_ai.usage.completion_tokens",
|
|
4232
4232
|
LLM_USAGE_CACHE_READ_INPUT_TOKENS: "gen_ai.usage.cache_read_input_tokens",
|
|
4233
4233
|
LLM_USAGE_CACHE_CREATION_INPUT_TOKENS: "gen_ai.usage.cache_creation_input_tokens",
|
|
4234
|
+
LLM_USAGE_CACHE_CREATION_INPUT_TOKENS_30M: "gen_ai.usage.cache_creation_input_tokens_30m",
|
|
4235
|
+
LLM_USAGE_CACHE_CREATION_INPUT_TOKENS_12H: "gen_ai.usage.cache_creation_input_tokens_12h",
|
|
4234
4236
|
LLM_USAGE_REASONING_TOKENS: "gen_ai.usage.reasoning_tokens",
|
|
4235
4237
|
LLM_USAGE_TOTAL_TOKENS: "llm.usage.total_tokens",
|
|
4236
4238
|
LLM_FREQUENCY_PENALTY: "llm.frequency_penalty",
|
|
@@ -4568,6 +4570,19 @@ function setFinishReason(span2, response) {
|
|
|
4568
4570
|
}
|
|
4569
4571
|
}
|
|
4570
4572
|
}
|
|
4573
|
+
var CACHE_WRITE_TTL_ATTRIBUTES = {
|
|
4574
|
+
ttl_30m_tokens: SpanAttributes2.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS_30M,
|
|
4575
|
+
ttl_12h_tokens: SpanAttributes2.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS_12H
|
|
4576
|
+
};
|
|
4577
|
+
function setCacheWriteTtlAttributes(span2, inputTokensDetails) {
|
|
4578
|
+
if (!isDict(inputTokensDetails)) return;
|
|
4579
|
+
const breakdown = inputTokensDetails.cache_write_tokens_details;
|
|
4580
|
+
if (!isDict(breakdown)) return;
|
|
4581
|
+
for (const [field, attribute] of Object.entries(CACHE_WRITE_TTL_ATTRIBUTES)) {
|
|
4582
|
+
const tokens = breakdown[field];
|
|
4583
|
+
if (typeof tokens === "number") span2.setAttribute(attribute, tokens);
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4571
4586
|
function setUsageAttributes(span2, response) {
|
|
4572
4587
|
const usage = response.usage ?? response.usage_metadata;
|
|
4573
4588
|
if (!usage) return;
|
|
@@ -4606,6 +4621,10 @@ function setUsageAttributes(span2, response) {
|
|
|
4606
4621
|
Number(cacheCreationTokens)
|
|
4607
4622
|
);
|
|
4608
4623
|
}
|
|
4624
|
+
setCacheWriteTtlAttributes(
|
|
4625
|
+
span2,
|
|
4626
|
+
usage.prompt_tokens_details ?? usage.input_tokens_details
|
|
4627
|
+
);
|
|
4609
4628
|
const reasoningTokens = (usage.completion_tokens_details ?? usage.output_tokens_details)?.reasoning_tokens;
|
|
4610
4629
|
if (reasoningTokens !== void 0) {
|
|
4611
4630
|
span2.setAttribute(
|
|
@@ -7658,350 +7677,6 @@ var groqInstrumentor = new NetraGroqInstrumentor();
|
|
|
7658
7677
|
// src/instrumentation/langgraph/version.ts
|
|
7659
7678
|
var __version__5 = "1.0.0";
|
|
7660
7679
|
|
|
7661
|
-
// node_modules/@langchain/core/dist/_virtual/rolldown_runtime.js
|
|
7662
|
-
var __defProp = Object.defineProperty;
|
|
7663
|
-
var __export = (target, all) => {
|
|
7664
|
-
for (var name in all) __defProp(target, name, {
|
|
7665
|
-
get: all[name],
|
|
7666
|
-
enumerable: true
|
|
7667
|
-
});
|
|
7668
|
-
};
|
|
7669
|
-
|
|
7670
|
-
// node_modules/@langchain/core/dist/load/map_keys.js
|
|
7671
|
-
var import_decamelize = __toESM(require_decamelize(), 1);
|
|
7672
|
-
__toESM(require_camelcase(), 1);
|
|
7673
|
-
function keyToJson(key, map) {
|
|
7674
|
-
return map?.[key] || (0, import_decamelize.default)(key);
|
|
7675
|
-
}
|
|
7676
|
-
function mapKeys(fields, mapper, map) {
|
|
7677
|
-
const mapped = {};
|
|
7678
|
-
for (const key in fields) if (Object.hasOwn(fields, key)) mapped[mapper(key, map)] = fields[key];
|
|
7679
|
-
return mapped;
|
|
7680
|
-
}
|
|
7681
|
-
|
|
7682
|
-
// node_modules/@langchain/core/dist/load/validation.js
|
|
7683
|
-
var LC_ESCAPED_KEY = "__lc_escaped__";
|
|
7684
|
-
function needsEscaping(obj) {
|
|
7685
|
-
return "lc" in obj || Object.keys(obj).length === 1 && LC_ESCAPED_KEY in obj;
|
|
7686
|
-
}
|
|
7687
|
-
function escapeObject(obj) {
|
|
7688
|
-
return { [LC_ESCAPED_KEY]: obj };
|
|
7689
|
-
}
|
|
7690
|
-
function isSerializableLike(obj) {
|
|
7691
|
-
return obj !== null && typeof obj === "object" && "lc_serializable" in obj && typeof obj.toJSON === "function";
|
|
7692
|
-
}
|
|
7693
|
-
function createNotImplemented(obj) {
|
|
7694
|
-
let id;
|
|
7695
|
-
if (obj !== null && typeof obj === "object") if ("lc_id" in obj && Array.isArray(obj.lc_id)) id = obj.lc_id;
|
|
7696
|
-
else id = [obj.constructor?.name ?? "Object"];
|
|
7697
|
-
else id = [typeof obj];
|
|
7698
|
-
return {
|
|
7699
|
-
lc: 1,
|
|
7700
|
-
type: "not_implemented",
|
|
7701
|
-
id
|
|
7702
|
-
};
|
|
7703
|
-
}
|
|
7704
|
-
function escapeIfNeeded(value, pathSet = /* @__PURE__ */ new WeakSet()) {
|
|
7705
|
-
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
7706
|
-
if (pathSet.has(value)) return createNotImplemented(value);
|
|
7707
|
-
if (isSerializableLike(value)) return value;
|
|
7708
|
-
pathSet.add(value);
|
|
7709
|
-
const record = value;
|
|
7710
|
-
if (needsEscaping(record)) {
|
|
7711
|
-
pathSet.delete(value);
|
|
7712
|
-
return escapeObject(record);
|
|
7713
|
-
}
|
|
7714
|
-
const result = {};
|
|
7715
|
-
for (const [key, val] of Object.entries(record)) result[key] = escapeIfNeeded(val, pathSet);
|
|
7716
|
-
pathSet.delete(value);
|
|
7717
|
-
return result;
|
|
7718
|
-
}
|
|
7719
|
-
if (Array.isArray(value)) return value.map((item) => escapeIfNeeded(item, pathSet));
|
|
7720
|
-
return value;
|
|
7721
|
-
}
|
|
7722
|
-
|
|
7723
|
-
// node_modules/@langchain/core/dist/load/serializable.js
|
|
7724
|
-
var serializable_exports = {};
|
|
7725
|
-
__export(serializable_exports, {
|
|
7726
|
-
Serializable: () => Serializable,
|
|
7727
|
-
get_lc_unique_name: () => get_lc_unique_name
|
|
7728
|
-
});
|
|
7729
|
-
function shallowCopy(obj) {
|
|
7730
|
-
return Array.isArray(obj) ? [...obj] : { ...obj };
|
|
7731
|
-
}
|
|
7732
|
-
function replaceSecrets(root, secretsMap) {
|
|
7733
|
-
const result = shallowCopy(root);
|
|
7734
|
-
for (const [path, secretId] of Object.entries(secretsMap)) {
|
|
7735
|
-
const [last, ...partsReverse] = path.split(".").reverse();
|
|
7736
|
-
let current = result;
|
|
7737
|
-
for (const part of partsReverse.reverse()) {
|
|
7738
|
-
if (current[part] === void 0) break;
|
|
7739
|
-
current[part] = shallowCopy(current[part]);
|
|
7740
|
-
current = current[part];
|
|
7741
|
-
}
|
|
7742
|
-
if (current[last] !== void 0) current[last] = {
|
|
7743
|
-
lc: 1,
|
|
7744
|
-
type: "secret",
|
|
7745
|
-
id: [secretId]
|
|
7746
|
-
};
|
|
7747
|
-
}
|
|
7748
|
-
return result;
|
|
7749
|
-
}
|
|
7750
|
-
function get_lc_unique_name(serializableClass) {
|
|
7751
|
-
const parentClass = Object.getPrototypeOf(serializableClass);
|
|
7752
|
-
const lcNameIsSubclassed = typeof serializableClass.lc_name === "function" && (typeof parentClass.lc_name !== "function" || serializableClass.lc_name() !== parentClass.lc_name());
|
|
7753
|
-
if (lcNameIsSubclassed) return serializableClass.lc_name();
|
|
7754
|
-
else return serializableClass.name;
|
|
7755
|
-
}
|
|
7756
|
-
var Serializable = class Serializable2 {
|
|
7757
|
-
constructor(kwargs, ..._args) {
|
|
7758
|
-
__publicField(this, "lc_serializable", false);
|
|
7759
|
-
__publicField(this, "lc_kwargs");
|
|
7760
|
-
if (this.lc_serializable_keys !== void 0) this.lc_kwargs = Object.fromEntries(Object.entries(kwargs || {}).filter(([key]) => this.lc_serializable_keys?.includes(key)));
|
|
7761
|
-
else this.lc_kwargs = kwargs ?? {};
|
|
7762
|
-
}
|
|
7763
|
-
/**
|
|
7764
|
-
* The name of the serializable. Override to provide an alias or
|
|
7765
|
-
* to preserve the serialized module name in minified environments.
|
|
7766
|
-
*
|
|
7767
|
-
* Implemented as a static method to support loading logic.
|
|
7768
|
-
*/
|
|
7769
|
-
static lc_name() {
|
|
7770
|
-
return this.name;
|
|
7771
|
-
}
|
|
7772
|
-
/**
|
|
7773
|
-
* The final serialized identifier for the module.
|
|
7774
|
-
*/
|
|
7775
|
-
get lc_id() {
|
|
7776
|
-
return [...this.lc_namespace, get_lc_unique_name(this.constructor)];
|
|
7777
|
-
}
|
|
7778
|
-
/**
|
|
7779
|
-
* A map of secrets, which will be omitted from serialization.
|
|
7780
|
-
* Keys are paths to the secret in constructor args, e.g. "foo.bar.baz".
|
|
7781
|
-
* Values are the secret ids, which will be used when deserializing.
|
|
7782
|
-
*/
|
|
7783
|
-
get lc_secrets() {
|
|
7784
|
-
return void 0;
|
|
7785
|
-
}
|
|
7786
|
-
/**
|
|
7787
|
-
* A map of additional attributes to merge with constructor args.
|
|
7788
|
-
* Keys are the attribute names, e.g. "foo".
|
|
7789
|
-
* Values are the attribute values, which will be serialized.
|
|
7790
|
-
* These attributes need to be accepted by the constructor as arguments.
|
|
7791
|
-
*/
|
|
7792
|
-
get lc_attributes() {
|
|
7793
|
-
return void 0;
|
|
7794
|
-
}
|
|
7795
|
-
/**
|
|
7796
|
-
* A map of aliases for constructor args.
|
|
7797
|
-
* Keys are the attribute names, e.g. "foo".
|
|
7798
|
-
* Values are the alias that will replace the key in serialization.
|
|
7799
|
-
* This is used to eg. make argument names match Python.
|
|
7800
|
-
*/
|
|
7801
|
-
get lc_aliases() {
|
|
7802
|
-
return void 0;
|
|
7803
|
-
}
|
|
7804
|
-
/**
|
|
7805
|
-
* A manual list of keys that should be serialized.
|
|
7806
|
-
* If not overridden, all fields passed into the constructor will be serialized.
|
|
7807
|
-
*/
|
|
7808
|
-
get lc_serializable_keys() {
|
|
7809
|
-
return void 0;
|
|
7810
|
-
}
|
|
7811
|
-
toJSON() {
|
|
7812
|
-
if (!this.lc_serializable) return this.toJSONNotImplemented();
|
|
7813
|
-
if (this.lc_kwargs instanceof Serializable2 || typeof this.lc_kwargs !== "object" || Array.isArray(this.lc_kwargs)) return this.toJSONNotImplemented();
|
|
7814
|
-
const aliases = {};
|
|
7815
|
-
const secrets = {};
|
|
7816
|
-
const kwargs = Object.keys(this.lc_kwargs).reduce((acc, key) => {
|
|
7817
|
-
acc[key] = key in this ? this[key] : this.lc_kwargs[key];
|
|
7818
|
-
return acc;
|
|
7819
|
-
}, {});
|
|
7820
|
-
for (let current = Object.getPrototypeOf(this); current; current = Object.getPrototypeOf(current)) {
|
|
7821
|
-
Object.assign(aliases, Reflect.get(current, "lc_aliases", this));
|
|
7822
|
-
Object.assign(secrets, Reflect.get(current, "lc_secrets", this));
|
|
7823
|
-
Object.assign(kwargs, Reflect.get(current, "lc_attributes", this));
|
|
7824
|
-
}
|
|
7825
|
-
Object.keys(secrets).forEach((keyPath) => {
|
|
7826
|
-
let read = this;
|
|
7827
|
-
let write = kwargs;
|
|
7828
|
-
const [last, ...partsReverse] = keyPath.split(".").reverse();
|
|
7829
|
-
for (const key of partsReverse.reverse()) {
|
|
7830
|
-
if (!(key in read) || read[key] === void 0) return;
|
|
7831
|
-
if (!(key in write) || write[key] === void 0) {
|
|
7832
|
-
if (typeof read[key] === "object" && read[key] != null) write[key] = {};
|
|
7833
|
-
else if (Array.isArray(read[key])) write[key] = [];
|
|
7834
|
-
}
|
|
7835
|
-
read = read[key];
|
|
7836
|
-
write = write[key];
|
|
7837
|
-
}
|
|
7838
|
-
if (last in read && read[last] !== void 0) write[last] = write[last] || read[last];
|
|
7839
|
-
});
|
|
7840
|
-
const escapedKwargs = {};
|
|
7841
|
-
const pathSet = /* @__PURE__ */ new WeakSet();
|
|
7842
|
-
pathSet.add(this);
|
|
7843
|
-
for (const [key, value] of Object.entries(kwargs)) escapedKwargs[key] = escapeIfNeeded(value, pathSet);
|
|
7844
|
-
const kwargsWithSecrets = Object.keys(secrets).length ? replaceSecrets(escapedKwargs, secrets) : escapedKwargs;
|
|
7845
|
-
const processedKwargs = mapKeys(kwargsWithSecrets, keyToJson, aliases);
|
|
7846
|
-
return {
|
|
7847
|
-
lc: 1,
|
|
7848
|
-
type: "constructor",
|
|
7849
|
-
id: this.lc_id,
|
|
7850
|
-
kwargs: processedKwargs
|
|
7851
|
-
};
|
|
7852
|
-
}
|
|
7853
|
-
toJSONNotImplemented() {
|
|
7854
|
-
return {
|
|
7855
|
-
lc: 1,
|
|
7856
|
-
type: "not_implemented",
|
|
7857
|
-
id: this.lc_id
|
|
7858
|
-
};
|
|
7859
|
-
}
|
|
7860
|
-
};
|
|
7861
|
-
|
|
7862
|
-
// node_modules/@langchain/core/dist/utils/env.js
|
|
7863
|
-
var env_exports = {};
|
|
7864
|
-
__export(env_exports, {
|
|
7865
|
-
getEnv: () => getEnv,
|
|
7866
|
-
getEnvironmentVariable: () => getEnvironmentVariable,
|
|
7867
|
-
getRuntimeEnvironment: () => getRuntimeEnvironment,
|
|
7868
|
-
isBrowser: () => isBrowser,
|
|
7869
|
-
isDeno: () => isDeno,
|
|
7870
|
-
isJsDom: () => isJsDom,
|
|
7871
|
-
isNode: () => isNode,
|
|
7872
|
-
isWebWorker: () => isWebWorker
|
|
7873
|
-
});
|
|
7874
|
-
var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
7875
|
-
var isWebWorker = () => typeof globalThis === "object" && globalThis.constructor && globalThis.constructor.name === "DedicatedWorkerGlobalScope";
|
|
7876
|
-
var isJsDom = () => typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom");
|
|
7877
|
-
var isDeno = () => typeof Deno !== "undefined";
|
|
7878
|
-
var isNode = () => typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined" && !isDeno();
|
|
7879
|
-
var getEnv = () => {
|
|
7880
|
-
let env;
|
|
7881
|
-
if (isBrowser()) env = "browser";
|
|
7882
|
-
else if (isNode()) env = "node";
|
|
7883
|
-
else if (isWebWorker()) env = "webworker";
|
|
7884
|
-
else if (isJsDom()) env = "jsdom";
|
|
7885
|
-
else if (isDeno()) env = "deno";
|
|
7886
|
-
else env = "other";
|
|
7887
|
-
return env;
|
|
7888
|
-
};
|
|
7889
|
-
var runtimeEnvironment;
|
|
7890
|
-
function getRuntimeEnvironment() {
|
|
7891
|
-
if (runtimeEnvironment === void 0) {
|
|
7892
|
-
const env = getEnv();
|
|
7893
|
-
runtimeEnvironment = {
|
|
7894
|
-
library: "langchain-js",
|
|
7895
|
-
runtime: env
|
|
7896
|
-
};
|
|
7897
|
-
}
|
|
7898
|
-
return runtimeEnvironment;
|
|
7899
|
-
}
|
|
7900
|
-
function getEnvironmentVariable(name) {
|
|
7901
|
-
try {
|
|
7902
|
-
if (typeof process !== "undefined") return process.env?.[name];
|
|
7903
|
-
else if (isDeno()) return Deno?.env.get(name);
|
|
7904
|
-
else return void 0;
|
|
7905
|
-
} catch {
|
|
7906
|
-
return void 0;
|
|
7907
|
-
}
|
|
7908
|
-
}
|
|
7909
|
-
|
|
7910
|
-
// node_modules/@langchain/core/dist/callbacks/base.js
|
|
7911
|
-
init_esm_node();
|
|
7912
|
-
var base_exports = {};
|
|
7913
|
-
__export(base_exports, {
|
|
7914
|
-
BaseCallbackHandler: () => BaseCallbackHandler,
|
|
7915
|
-
callbackHandlerPrefersStreaming: () => callbackHandlerPrefersStreaming,
|
|
7916
|
-
isBaseCallbackHandler: () => isBaseCallbackHandler
|
|
7917
|
-
});
|
|
7918
|
-
var BaseCallbackHandlerMethodsClass = class {
|
|
7919
|
-
};
|
|
7920
|
-
function callbackHandlerPrefersStreaming(x) {
|
|
7921
|
-
return "lc_prefer_streaming" in x && x.lc_prefer_streaming;
|
|
7922
|
-
}
|
|
7923
|
-
var BaseCallbackHandler = class extends BaseCallbackHandlerMethodsClass {
|
|
7924
|
-
constructor(input) {
|
|
7925
|
-
super();
|
|
7926
|
-
__publicField(this, "lc_serializable", false);
|
|
7927
|
-
__publicField(this, "lc_kwargs");
|
|
7928
|
-
__publicField(this, "ignoreLLM", false);
|
|
7929
|
-
__publicField(this, "ignoreChain", false);
|
|
7930
|
-
__publicField(this, "ignoreAgent", false);
|
|
7931
|
-
__publicField(this, "ignoreRetriever", false);
|
|
7932
|
-
__publicField(this, "ignoreCustomEvent", false);
|
|
7933
|
-
__publicField(this, "raiseError", false);
|
|
7934
|
-
__publicField(this, "awaitHandlers", getEnvironmentVariable("LANGCHAIN_CALLBACKS_BACKGROUND") === "false");
|
|
7935
|
-
this.lc_kwargs = input || {};
|
|
7936
|
-
if (input) {
|
|
7937
|
-
this.ignoreLLM = input.ignoreLLM ?? this.ignoreLLM;
|
|
7938
|
-
this.ignoreChain = input.ignoreChain ?? this.ignoreChain;
|
|
7939
|
-
this.ignoreAgent = input.ignoreAgent ?? this.ignoreAgent;
|
|
7940
|
-
this.ignoreRetriever = input.ignoreRetriever ?? this.ignoreRetriever;
|
|
7941
|
-
this.ignoreCustomEvent = input.ignoreCustomEvent ?? this.ignoreCustomEvent;
|
|
7942
|
-
this.raiseError = input.raiseError ?? this.raiseError;
|
|
7943
|
-
this.awaitHandlers = this.raiseError || (input._awaitHandler ?? this.awaitHandlers);
|
|
7944
|
-
}
|
|
7945
|
-
}
|
|
7946
|
-
get lc_namespace() {
|
|
7947
|
-
return [
|
|
7948
|
-
"langchain_core",
|
|
7949
|
-
"callbacks",
|
|
7950
|
-
this.name
|
|
7951
|
-
];
|
|
7952
|
-
}
|
|
7953
|
-
get lc_secrets() {
|
|
7954
|
-
return void 0;
|
|
7955
|
-
}
|
|
7956
|
-
get lc_attributes() {
|
|
7957
|
-
return void 0;
|
|
7958
|
-
}
|
|
7959
|
-
get lc_aliases() {
|
|
7960
|
-
return void 0;
|
|
7961
|
-
}
|
|
7962
|
-
get lc_serializable_keys() {
|
|
7963
|
-
return void 0;
|
|
7964
|
-
}
|
|
7965
|
-
/**
|
|
7966
|
-
* The name of the serializable. Override to provide an alias or
|
|
7967
|
-
* to preserve the serialized module name in minified environments.
|
|
7968
|
-
*
|
|
7969
|
-
* Implemented as a static method to support loading logic.
|
|
7970
|
-
*/
|
|
7971
|
-
static lc_name() {
|
|
7972
|
-
return this.name;
|
|
7973
|
-
}
|
|
7974
|
-
/**
|
|
7975
|
-
* The final serialized identifier for the module.
|
|
7976
|
-
*/
|
|
7977
|
-
get lc_id() {
|
|
7978
|
-
return [...this.lc_namespace, get_lc_unique_name(this.constructor)];
|
|
7979
|
-
}
|
|
7980
|
-
copy() {
|
|
7981
|
-
return new this.constructor(this);
|
|
7982
|
-
}
|
|
7983
|
-
toJSON() {
|
|
7984
|
-
return Serializable.prototype.toJSON.call(this);
|
|
7985
|
-
}
|
|
7986
|
-
toJSONNotImplemented() {
|
|
7987
|
-
return Serializable.prototype.toJSONNotImplemented.call(this);
|
|
7988
|
-
}
|
|
7989
|
-
static fromMethods(methods) {
|
|
7990
|
-
class Handler extends BaseCallbackHandler {
|
|
7991
|
-
constructor() {
|
|
7992
|
-
super();
|
|
7993
|
-
__publicField(this, "name", v7_default());
|
|
7994
|
-
Object.assign(this, methods);
|
|
7995
|
-
}
|
|
7996
|
-
}
|
|
7997
|
-
return new Handler();
|
|
7998
|
-
}
|
|
7999
|
-
};
|
|
8000
|
-
var isBaseCallbackHandler = (x) => {
|
|
8001
|
-
const callbackHandler = x;
|
|
8002
|
-
return callbackHandler !== void 0 && typeof callbackHandler.copy === "function" && typeof callbackHandler.name === "string" && typeof callbackHandler.awaitHandlers === "boolean";
|
|
8003
|
-
};
|
|
8004
|
-
|
|
8005
7680
|
// src/instrumentation/langgraph/utils.ts
|
|
8006
7681
|
var NetraLanggraphAttributes = {
|
|
8007
7682
|
spanType: "netra.span.type",
|
|
@@ -10244,6 +9919,7 @@ function setUsageAttributes3(span2, usage) {
|
|
|
10244
9919
|
if (inputDetails.cache_write_tokens !== void 0) {
|
|
10245
9920
|
span2.setAttribute(SpanAttributes2.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS, Number(inputDetails.cache_write_tokens));
|
|
10246
9921
|
}
|
|
9922
|
+
setCacheWriteTtlAttributes(span2, inputDetails);
|
|
10247
9923
|
}
|
|
10248
9924
|
const outputDetails = usage.output_tokens_details ?? usage.completion_tokens_details;
|
|
10249
9925
|
if (outputDetails) {
|
|
@@ -10296,6 +9972,7 @@ function setResponseObjectUsageAttributes(span2, usage) {
|
|
|
10296
9972
|
if (usage.input_tokens_details?.cache_write_tokens !== void 0) {
|
|
10297
9973
|
span2.setAttribute(SpanAttributes2.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS, usage.input_tokens_details.cache_write_tokens);
|
|
10298
9974
|
}
|
|
9975
|
+
setCacheWriteTtlAttributes(span2, usage.input_tokens_details);
|
|
10299
9976
|
if (usage.output_tokens_details?.reasoning_tokens !== void 0) {
|
|
10300
9977
|
span2.setAttribute(SpanAttributes2.LLM_USAGE_REASONING_TOKENS, usage.output_tokens_details.reasoning_tokens);
|
|
10301
9978
|
}
|
|
@@ -11774,7 +11451,7 @@ function patchTraceloopLangchainCallbackHandler() {
|
|
|
11774
11451
|
} catch (e) {
|
|
11775
11452
|
Logger.debug("require() for traceloop langchain failed, falling back to import().");
|
|
11776
11453
|
}
|
|
11777
|
-
import('./dist-
|
|
11454
|
+
import('./dist-4UBY6Q6Z.js').then((mod) => {
|
|
11778
11455
|
applyPatch(mod, "import");
|
|
11779
11456
|
}).catch(() => {
|
|
11780
11457
|
});
|