@brizz/sdk 0.1.11 → 0.1.12
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 +68 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +68 -5
- package/dist/index.js.map +1 -1
- package/dist/preload.cjs +70 -5
- package/dist/preload.cjs.map +1 -1
- package/dist/preload.js +68 -3
- package/dist/preload.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -62,7 +62,6 @@ var import_instrumentation_anthropic = require("@traceloop/instrumentation-anthr
|
|
|
62
62
|
var import_instrumentation_bedrock = require("@traceloop/instrumentation-bedrock");
|
|
63
63
|
var import_instrumentation_chromadb = require("@traceloop/instrumentation-chromadb");
|
|
64
64
|
var import_instrumentation_cohere = require("@traceloop/instrumentation-cohere");
|
|
65
|
-
var import_instrumentation_langchain = require("@traceloop/instrumentation-langchain");
|
|
66
65
|
var import_instrumentation_llamaindex = require("@traceloop/instrumentation-llamaindex");
|
|
67
66
|
var import_instrumentation_openai = require("@traceloop/instrumentation-openai");
|
|
68
67
|
var import_instrumentation_pinecone = require("@traceloop/instrumentation-pinecone");
|
|
@@ -238,7 +237,6 @@ function loadGenAIInstrumentations() {
|
|
|
238
237
|
{ class: import_instrumentation_vertexai.VertexAIInstrumentation, name: "Vertex AI" },
|
|
239
238
|
{ class: import_instrumentation_bedrock.BedrockInstrumentation, name: "Bedrock" },
|
|
240
239
|
{ class: import_instrumentation_pinecone.PineconeInstrumentation, name: "Pinecone" },
|
|
241
|
-
{ class: import_instrumentation_langchain.LangChainInstrumentation, name: "LangChain" },
|
|
242
240
|
{ class: import_instrumentation_llamaindex.LlamaIndexInstrumentation, name: "LlamaIndex" },
|
|
243
241
|
{ class: import_instrumentation_chromadb.ChromaDBInstrumentation, name: "ChromaDB" },
|
|
244
242
|
{ class: import_instrumentation_qdrant.QdrantInstrumentation, name: "Qdrant" },
|
|
@@ -370,11 +368,11 @@ var BRIZZ_SDK_LANGUAGE = "brizz.sdk.language";
|
|
|
370
368
|
var SDK_LANGUAGE = "typescript";
|
|
371
369
|
|
|
372
370
|
// src/internal/instrumentation/registry.ts
|
|
371
|
+
var import_openinference_instrumentation_langchain = require("@arizeai/openinference-instrumentation-langchain");
|
|
373
372
|
var import_instrumentation_anthropic2 = require("@traceloop/instrumentation-anthropic");
|
|
374
373
|
var import_instrumentation_bedrock2 = require("@traceloop/instrumentation-bedrock");
|
|
375
374
|
var import_instrumentation_chromadb2 = require("@traceloop/instrumentation-chromadb");
|
|
376
375
|
var import_instrumentation_cohere2 = require("@traceloop/instrumentation-cohere");
|
|
377
|
-
var import_instrumentation_langchain2 = require("@traceloop/instrumentation-langchain");
|
|
378
376
|
var import_instrumentation_llamaindex2 = require("@traceloop/instrumentation-llamaindex");
|
|
379
377
|
var import_instrumentation_openai2 = require("@traceloop/instrumentation-openai");
|
|
380
378
|
var import_instrumentation_pinecone2 = require("@traceloop/instrumentation-pinecone");
|
|
@@ -448,7 +446,6 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
448
446
|
},
|
|
449
447
|
{ class: import_instrumentation_bedrock2.BedrockInstrumentation, name: "Bedrock", module: this.manualModules?.bedrock },
|
|
450
448
|
{ class: import_instrumentation_pinecone2.PineconeInstrumentation, name: "Pinecone", module: this.manualModules?.pinecone },
|
|
451
|
-
{ class: import_instrumentation_langchain2.LangChainInstrumentation, name: "LangChain", module: this.manualModules?.langchain },
|
|
452
449
|
{
|
|
453
450
|
class: import_instrumentation_llamaindex2.LlamaIndexInstrumentation,
|
|
454
451
|
name: "LlamaIndex",
|
|
@@ -471,9 +468,65 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
471
468
|
}
|
|
472
469
|
}
|
|
473
470
|
}
|
|
471
|
+
if (this.manualModules?.langchain?.callbackManagerModule) {
|
|
472
|
+
try {
|
|
473
|
+
const lcInst = new import_openinference_instrumentation_langchain.LangChainInstrumentation();
|
|
474
|
+
lcInst.manuallyInstrument(this.manualModules.langchain.callbackManagerModule);
|
|
475
|
+
instrumentations.push(lcInst);
|
|
476
|
+
logger.debug("Manual instrumentation enabled for LangChain");
|
|
477
|
+
} catch (error) {
|
|
478
|
+
logger.error(`Failed to load LangChain instrumentation: ${String(error)}`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
474
481
|
}
|
|
475
482
|
};
|
|
476
483
|
|
|
484
|
+
// src/internal/instrumentation/langchain-instrumentation.ts
|
|
485
|
+
var import_node_module = require("module");
|
|
486
|
+
var import_node_url = require("url");
|
|
487
|
+
var import_openinference_instrumentation_langchain2 = require("@arizeai/openinference-instrumentation-langchain");
|
|
488
|
+
var initialized = false;
|
|
489
|
+
async function importCallbackManager() {
|
|
490
|
+
try {
|
|
491
|
+
return await import("@langchain/core/callbacks/manager");
|
|
492
|
+
} catch {
|
|
493
|
+
}
|
|
494
|
+
const resolvers = [
|
|
495
|
+
() => (0, import_node_module.createRequire)((0, import_node_url.pathToFileURL)(process.cwd() + "/package.json").href),
|
|
496
|
+
() => {
|
|
497
|
+
const main = process.argv[1];
|
|
498
|
+
if (!main) {
|
|
499
|
+
throw new Error("no main");
|
|
500
|
+
}
|
|
501
|
+
return (0, import_node_module.createRequire)((0, import_node_url.pathToFileURL)(main).href);
|
|
502
|
+
}
|
|
503
|
+
];
|
|
504
|
+
for (const getRequire of resolvers) {
|
|
505
|
+
try {
|
|
506
|
+
const req = getRequire();
|
|
507
|
+
const cjsPath = req.resolve("@langchain/core/callbacks/manager");
|
|
508
|
+
const esmPath = cjsPath.replace(/\.cjs$/, ".js");
|
|
509
|
+
return await import((0, import_node_url.pathToFileURL)(esmPath).href);
|
|
510
|
+
} catch {
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
async function setupLangChainInstrumentation() {
|
|
516
|
+
if (initialized) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const callbackManagerModule = await importCallbackManager();
|
|
520
|
+
if (!callbackManagerModule) {
|
|
521
|
+
logger.debug("@langchain/core not found \u2014 skipping LangChain instrumentation");
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const instrumentation = new import_openinference_instrumentation_langchain2.LangChainInstrumentation();
|
|
525
|
+
instrumentation.manuallyInstrument(callbackManagerModule);
|
|
526
|
+
initialized = true;
|
|
527
|
+
logger.info("LangChain instrumentation enabled (OpenInference)");
|
|
528
|
+
}
|
|
529
|
+
|
|
477
530
|
// src/internal/log/logging.ts
|
|
478
531
|
var import_api_logs = require("@opentelemetry/api-logs");
|
|
479
532
|
var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
|
|
@@ -482,7 +535,7 @@ var import_sdk_logs2 = require("@opentelemetry/sdk-logs");
|
|
|
482
535
|
|
|
483
536
|
// src/internal/version.ts
|
|
484
537
|
function getSDKVersion() {
|
|
485
|
-
return "0.1.
|
|
538
|
+
return "0.1.12";
|
|
486
539
|
}
|
|
487
540
|
|
|
488
541
|
// src/internal/log/processors/log-processor.ts
|
|
@@ -1860,6 +1913,7 @@ var _Brizz = class __Brizz {
|
|
|
1860
1913
|
const resolvedConfig = resolveConfig(options);
|
|
1861
1914
|
this.initializeModules(resolvedConfig);
|
|
1862
1915
|
this.setupInstrumentation(options);
|
|
1916
|
+
this.initLangChainInstrumentation();
|
|
1863
1917
|
this.createAndStartNodeSDK(options, resolvedConfig);
|
|
1864
1918
|
this._initialized = true;
|
|
1865
1919
|
logger.info("Brizz SDK initialization completed successfully", {
|
|
@@ -1870,6 +1924,15 @@ var _Brizz = class __Brizz {
|
|
|
1870
1924
|
throw new Error(`Failed to initialize SDK: ${String(error)}`, { cause: error });
|
|
1871
1925
|
}
|
|
1872
1926
|
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Async LangChain instrumentation setup (fire-and-forget).
|
|
1929
|
+
* @private
|
|
1930
|
+
*/
|
|
1931
|
+
initLangChainInstrumentation() {
|
|
1932
|
+
setupLangChainInstrumentation().catch((error) => {
|
|
1933
|
+
logger.debug(`LangChain instrumentation skipped: ${String(error)}`);
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1873
1936
|
/**
|
|
1874
1937
|
* Set up instrumentation registry and configure manual modules.
|
|
1875
1938
|
* @private
|