@lmnr-ai/lmnr 0.4.16 → 0.4.17

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/cli.js CHANGED
@@ -36,7 +36,7 @@ var require_package = __commonJS({
36
36
  "package.json"(exports2, module2) {
37
37
  module2.exports = {
38
38
  name: "@lmnr-ai/lmnr",
39
- version: "0.4.16",
39
+ version: "0.4.17",
40
40
  description: "TypeScript SDK for Laminar AI",
41
41
  main: "dist/index.js",
42
42
  types: "dist/index.d.ts",
@@ -114,7 +114,6 @@ var require_package = __commonJS({
114
114
  argparse: ">=2.0",
115
115
  "cli-progress": ">=3.12",
116
116
  esbuild: ">=0.23",
117
- "posthog-node": ">=4.0",
118
117
  uuid: ">=10.0.0"
119
118
  }
120
119
  };
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@lmnr-ai/lmnr\",\n \"version\": \"0.4.16\",\n \"description\": \"TypeScript SDK for Laminar AI\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"scripts\": {\n \"build\": \"tsup src/index.ts src/cli.ts --format esm,cjs --dts\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"bin\": {\n \"lmnr\": \"./dist/cli.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/lmnr-ai/lmnr-ts.git\"\n },\n \"keywords\": [\n \"laminar\",\n \"lmnr\",\n \"sdk\",\n \"lmnr.ai\"\n ],\n \"author\": \"founders@lmnr.ai\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/lmnr-ai/lmnr-ts/issues\"\n },\n \"homepage\": \"https://github.com/lmnr-ai/lmnr-ts#README\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.27.3\",\n \"@aws-sdk/client-bedrock-runtime\": \"^3.679.0\",\n \"@azure/openai\": \"1.0.0-beta.13\",\n \"@google-cloud/aiplatform\": \"^3.29.0\",\n \"@google-cloud/vertexai\": \"^1.7.0\",\n \"@langchain/core\": \"^0.3.2\",\n \"@pinecone-database/pinecone\": \"^3.0.3\",\n \"@qdrant/js-client-rest\": \"^1.11.0\",\n \"@types/argparse\": \"^2.0.16\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^22.5.5\",\n \"@types/semver\": \"^7.5.8\",\n \"@types/uuid\": \"^10.0.0\",\n \"bufferutil\": \"^4.0.8\",\n \"chromadb\": \"^1.9.2\",\n \"cohere-ai\": \"^7.14.0\",\n \"langchain\": \"^0.3.2\",\n \"llamaindex\": \"^0.7.10\",\n \"openai\": \"^4.62.1\",\n \"runnables\": \"link:@langchain/core/runnables\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.2\",\n \"vectorstores\": \"link:@langchain/core/vectorstores\"\n },\n \"dependencies\": {\n \"@grpc/grpc-js\": \"^1.11.3\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^1.26.0\",\n \"@opentelemetry/exporter-trace-otlp-grpc\": \"^0.53.0\",\n \"@opentelemetry/exporter-trace-otlp-proto\": \"^0.53.0\",\n \"@opentelemetry/instrumentation\": \"^0.53.0\",\n \"@opentelemetry/sdk-node\": \"^0.53.0\",\n \"@opentelemetry/sdk-trace-base\": \"^1.26.0\",\n \"@opentelemetry/sdk-trace-node\": \"^1.26.0\",\n \"@opentelemetry/semantic-conventions\": \"^1.27.0\",\n \"@traceloop/ai-semantic-conventions\": \"^0.11.0\",\n \"@traceloop/instrumentation-anthropic\": \"^0.11.1\",\n \"@traceloop/instrumentation-azure\": \"^0.11.1\",\n \"@traceloop/instrumentation-bedrock\": \"^0.11.1\",\n \"@traceloop/instrumentation-chromadb\": \"^0.11.3\",\n \"@traceloop/instrumentation-cohere\": \"^0.11.1\",\n \"@traceloop/instrumentation-langchain\": \"^0.11.1\",\n \"@traceloop/instrumentation-llamaindex\": \"^0.11.1\",\n \"@traceloop/instrumentation-openai\": \"^0.11.3\",\n \"@traceloop/instrumentation-pinecone\": \"^0.11.1\",\n \"@traceloop/instrumentation-qdrant\": \"^0.11.1\",\n \"@traceloop/instrumentation-vertexai\": \"^0.11.1\",\n \"argparse\": \">=2.0\",\n \"cli-progress\": \">=3.12\",\n \"esbuild\": \">=0.23\",\n \"posthog-node\": \">=4.0\",\n \"uuid\": \">=10.0.0\"\n }\n}","#!/usr/bin/env node\n\nimport { ArgumentParser } from \"argparse\";\nimport * as esbuild from \"esbuild\";\n\nconst pjson = require('../package.json');\n\nexport function loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}) {\n // TODO: Figure out how to remove all ts-ignores\n // TODO: Cleanup by setting the original values of _evaluation and _set_global_evaluation back\n // @ts-ignore\n globalThis._evaluation = undefined; // @ts-ignore\n globalThis._set_global_evaluation = true; // @ts-ignore\n\n // it needs \"require\" to be passed in\n new Function(\"require\", moduleText)(require);\n\n // Return the modified _evals global variable\n // @ts-ignore\n return globalThis._evaluation;\n}\n\nasync function cli() {\n const [, , ...args] = process.argv;\n\n // Use argparse, which is the port of the python library\n const parser = new ArgumentParser({\n prog: \"lmnr\",\n description: \"CLI for Laminar\",\n });\n\n parser.add_argument(\"-v\", \"--version\", { action: \"version\", version: pjson.version });\n\n const subparsers = parser.add_subparsers({\n title: \"subcommands\",\n dest: \"subcommand\",\n });\n\n const parser_eval = subparsers.add_parser(\"eval\", {\n description: \"Run an evaluation\",\n });\n\n parser_eval.add_argument(\"file\", {\n help: \"A file containing the evaluation to run\",\n });\n\n parser_eval.set_defaults({\n func: async (args: any) => {\n // TODO: Add various optimizations, e.g. minify, pure, tree shaking, etc.\n const buildOptions = {\n entryPoints: [args.file],\n outfile: \"tmp_out.js\",\n write: false, // will be loaded in memory as a temp file\n platform: \"node\" as esbuild.Platform,\n bundle: true,\n external: [\"node_modules/*\"],\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n console.error(\"Error when building: No output files found\");\n process.exit(1);\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluation = loadModule({\n filename: args.file,\n moduleText: outputFileText,\n });\n\n // @ts-ignore\n await evaluation.run();\n }\n });\n\n const parsed = parser.parse_args(args);\n await parsed.func(parsed);\n}\n\ncli();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,MAAQ;AAAA,MACR,OAAS;AAAA,MACT,SAAW;AAAA,QACT,OAAS;AAAA,QACT,MAAQ;AAAA,MACV;AAAA,MACA,KAAO;AAAA,QACL,MAAQ;AAAA,MACV;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAU;AAAA,MACV,SAAW;AAAA,MACX,MAAQ;AAAA,QACN,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,MACZ,iBAAmB;AAAA,QACjB,qBAAqB;AAAA,QACrB,mCAAmC;AAAA,QACnC,iBAAiB;AAAA,QACjB,4BAA4B;AAAA,QAC5B,0BAA0B;AAAA,QAC1B,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,QAC/B,0BAA0B;AAAA,QAC1B,mBAAmB;AAAA,QACnB,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,YAAc;AAAA,QACd,UAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAa;AAAA,QACb,YAAc;AAAA,QACd,QAAU;AAAA,QACV,WAAa;AAAA,QACb,MAAQ;AAAA,QACR,YAAc;AAAA,QACd,cAAgB;AAAA,MAClB;AAAA,MACA,cAAgB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AQ;AAAA,IAC7B,MAAM;AAAA,EACV,CAAC;AAED,cAAY,aAAa;AAAA,IACrB,MAAM,OAAOC,UAAc;AAEvB,YAAM,eAAe;AAAA,QACnB,aAAa,CAACA,MAAK,IAAI;AAAA,QACvB,SAAS;AAAA,QACT,OAAO;AAAA;AAAA,QACP,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU,CAAC,gBAAgB;AAAA,MAC7B;AAEA,YAAM,SAAS,MAAc,cAAM,YAAY;AAE/C,UAAI,CAAC,OAAO,aAAa;AACrB,gBAAQ,MAAM,4CAA4C;AAC1D,gBAAQ,KAAK,CAAC;AAAA,MAClB;AAEA,YAAM,iBAAiB,OAAO,YAAY,CAAC,EAAE;AAE7C,YAAM,aAAa,WAAW;AAAA,QAC5B,UAAUA,MAAK;AAAA,QACf,YAAY;AAAA,MACd,CAAC;AAGD,YAAM,WAAW,IAAI;AAAA,IACzB;AAAA,EACJ,CAAC;AAED,QAAM,SAAS,OAAO,WAAW,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC5B;AAEA,IAAI;","names":["exports","module","args"]}
1
+ {"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@lmnr-ai/lmnr\",\n \"version\": \"0.4.17\",\n \"description\": \"TypeScript SDK for Laminar AI\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"scripts\": {\n \"build\": \"tsup src/index.ts src/cli.ts --format esm,cjs --dts\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"bin\": {\n \"lmnr\": \"./dist/cli.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/lmnr-ai/lmnr-ts.git\"\n },\n \"keywords\": [\n \"laminar\",\n \"lmnr\",\n \"sdk\",\n \"lmnr.ai\"\n ],\n \"author\": \"founders@lmnr.ai\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/lmnr-ai/lmnr-ts/issues\"\n },\n \"homepage\": \"https://github.com/lmnr-ai/lmnr-ts#README\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.27.3\",\n \"@aws-sdk/client-bedrock-runtime\": \"^3.679.0\",\n \"@azure/openai\": \"1.0.0-beta.13\",\n \"@google-cloud/aiplatform\": \"^3.29.0\",\n \"@google-cloud/vertexai\": \"^1.7.0\",\n \"@langchain/core\": \"^0.3.2\",\n \"@pinecone-database/pinecone\": \"^3.0.3\",\n \"@qdrant/js-client-rest\": \"^1.11.0\",\n \"@types/argparse\": \"^2.0.16\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^22.5.5\",\n \"@types/semver\": \"^7.5.8\",\n \"@types/uuid\": \"^10.0.0\",\n \"bufferutil\": \"^4.0.8\",\n \"chromadb\": \"^1.9.2\",\n \"cohere-ai\": \"^7.14.0\",\n \"langchain\": \"^0.3.2\",\n \"llamaindex\": \"^0.7.10\",\n \"openai\": \"^4.62.1\",\n \"runnables\": \"link:@langchain/core/runnables\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.2\",\n \"vectorstores\": \"link:@langchain/core/vectorstores\"\n },\n \"dependencies\": {\n \"@grpc/grpc-js\": \"^1.11.3\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^1.26.0\",\n \"@opentelemetry/exporter-trace-otlp-grpc\": \"^0.53.0\",\n \"@opentelemetry/exporter-trace-otlp-proto\": \"^0.53.0\",\n \"@opentelemetry/instrumentation\": \"^0.53.0\",\n \"@opentelemetry/sdk-node\": \"^0.53.0\",\n \"@opentelemetry/sdk-trace-base\": \"^1.26.0\",\n \"@opentelemetry/sdk-trace-node\": \"^1.26.0\",\n \"@opentelemetry/semantic-conventions\": \"^1.27.0\",\n \"@traceloop/ai-semantic-conventions\": \"^0.11.0\",\n \"@traceloop/instrumentation-anthropic\": \"^0.11.1\",\n \"@traceloop/instrumentation-azure\": \"^0.11.1\",\n \"@traceloop/instrumentation-bedrock\": \"^0.11.1\",\n \"@traceloop/instrumentation-chromadb\": \"^0.11.3\",\n \"@traceloop/instrumentation-cohere\": \"^0.11.1\",\n \"@traceloop/instrumentation-langchain\": \"^0.11.1\",\n \"@traceloop/instrumentation-llamaindex\": \"^0.11.1\",\n \"@traceloop/instrumentation-openai\": \"^0.11.3\",\n \"@traceloop/instrumentation-pinecone\": \"^0.11.1\",\n \"@traceloop/instrumentation-qdrant\": \"^0.11.1\",\n \"@traceloop/instrumentation-vertexai\": \"^0.11.1\",\n \"argparse\": \">=2.0\",\n \"cli-progress\": \">=3.12\",\n \"esbuild\": \">=0.23\",\n \"uuid\": \">=10.0.0\"\n }\n}\n","#!/usr/bin/env node\n\nimport { ArgumentParser } from \"argparse\";\nimport * as esbuild from \"esbuild\";\n\nconst pjson = require('../package.json');\n\nexport function loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}) {\n // TODO: Figure out how to remove all ts-ignores\n // TODO: Cleanup by setting the original values of _evaluation and _set_global_evaluation back\n // @ts-ignore\n globalThis._evaluation = undefined; // @ts-ignore\n globalThis._set_global_evaluation = true; // @ts-ignore\n\n // it needs \"require\" to be passed in\n new Function(\"require\", moduleText)(require);\n\n // Return the modified _evals global variable\n // @ts-ignore\n return globalThis._evaluation;\n}\n\nasync function cli() {\n const [, , ...args] = process.argv;\n\n // Use argparse, which is the port of the python library\n const parser = new ArgumentParser({\n prog: \"lmnr\",\n description: \"CLI for Laminar\",\n });\n\n parser.add_argument(\"-v\", \"--version\", { action: \"version\", version: pjson.version });\n\n const subparsers = parser.add_subparsers({\n title: \"subcommands\",\n dest: \"subcommand\",\n });\n\n const parser_eval = subparsers.add_parser(\"eval\", {\n description: \"Run an evaluation\",\n });\n\n parser_eval.add_argument(\"file\", {\n help: \"A file containing the evaluation to run\",\n });\n\n parser_eval.set_defaults({\n func: async (args: any) => {\n // TODO: Add various optimizations, e.g. minify, pure, tree shaking, etc.\n const buildOptions = {\n entryPoints: [args.file],\n outfile: \"tmp_out.js\",\n write: false, // will be loaded in memory as a temp file\n platform: \"node\" as esbuild.Platform,\n bundle: true,\n external: [\"node_modules/*\"],\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n console.error(\"Error when building: No output files found\");\n process.exit(1);\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluation = loadModule({\n filename: args.file,\n moduleText: outputFileText,\n });\n\n // @ts-ignore\n await evaluation.run();\n }\n });\n\n const parsed = parser.parse_args(args);\n await parsed.func(parsed);\n}\n\ncli();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,MAAQ;AAAA,MACR,OAAS;AAAA,MACT,SAAW;AAAA,QACT,OAAS;AAAA,QACT,MAAQ;AAAA,MACV;AAAA,MACA,KAAO;AAAA,QACL,MAAQ;AAAA,MACV;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAU;AAAA,MACV,SAAW;AAAA,MACX,MAAQ;AAAA,QACN,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,MACZ,iBAAmB;AAAA,QACjB,qBAAqB;AAAA,QACrB,mCAAmC;AAAA,QACnC,iBAAiB;AAAA,QACjB,4BAA4B;AAAA,QAC5B,0BAA0B;AAAA,QAC1B,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,QAC/B,0BAA0B;AAAA,QAC1B,mBAAmB;AAAA,QACnB,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,YAAc;AAAA,QACd,UAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAa;AA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AAA,EACV,CAAC;AAED,QAAM,cAAc,WAAW,WAAW,QAAQ;AAAA,IAC9C,aAAa;AAAA,EACjB,CAAC;AAED,cAAY,aAAa,QAAQ;AAAA,IAC7B,MAAM;AAAA,EACV,CAAC;AAED,cAAY,aAAa;AAAA,IACrB,MAAM,OAAOC,UAAc;AAEvB,YAAM,eAAe;AAAA,QACnB,aAAa,CAACA,MAAK,IAAI;AAAA,QACvB,SAAS;AAAA,QACT,OAAO;AAAA;AAAA,QACP,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU,CAAC,gBAAgB;AAAA,MAC7B;AAEA,YAAM,SAAS,MAAc,cAAM,YAAY;AAE/C,UAAI,CAAC,OAAO,aAAa;AACrB,gBAAQ,MAAM,4CAA4C;AAC1D,gBAAQ,KAAK,CAAC;AAAA,MAClB;AAEA,YAAM,iBAAiB,OAAO,YAAY,CAAC,EAAE;AAE7C,YAAM,aAAa,WAAW;AAAA,QAC5B,UAAUA,MAAK;AAAA,QACf,YAAY;AAAA,MACd,CAAC;AAGD,YAAM,WAAW,IAAI;AAAA,IACzB;AAAA,EACJ,CAAC;AAED,QAAM,SAAS,OAAO,WAAW,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC5B;AAEA,IAAI;","names":["exports","module","args"]}
package/dist/cli.mjs CHANGED
@@ -15,7 +15,7 @@ var require_package = __commonJS({
15
15
  "package.json"(exports, module) {
16
16
  module.exports = {
17
17
  name: "@lmnr-ai/lmnr",
18
- version: "0.4.16",
18
+ version: "0.4.17",
19
19
  description: "TypeScript SDK for Laminar AI",
20
20
  main: "dist/index.js",
21
21
  types: "dist/index.d.ts",
@@ -93,7 +93,6 @@ var require_package = __commonJS({
93
93
  argparse: ">=2.0",
94
94
  "cli-progress": ">=3.12",
95
95
  esbuild: ">=0.23",
96
- "posthog-node": ">=4.0",
97
96
  uuid: ">=10.0.0"
98
97
  }
99
98
  };
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@lmnr-ai/lmnr\",\n \"version\": \"0.4.16\",\n \"description\": \"TypeScript SDK for Laminar AI\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"scripts\": {\n \"build\": \"tsup src/index.ts src/cli.ts --format esm,cjs --dts\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"bin\": {\n \"lmnr\": \"./dist/cli.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/lmnr-ai/lmnr-ts.git\"\n },\n \"keywords\": [\n \"laminar\",\n \"lmnr\",\n \"sdk\",\n \"lmnr.ai\"\n ],\n \"author\": \"founders@lmnr.ai\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/lmnr-ai/lmnr-ts/issues\"\n },\n \"homepage\": \"https://github.com/lmnr-ai/lmnr-ts#README\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.27.3\",\n \"@aws-sdk/client-bedrock-runtime\": \"^3.679.0\",\n \"@azure/openai\": \"1.0.0-beta.13\",\n \"@google-cloud/aiplatform\": \"^3.29.0\",\n \"@google-cloud/vertexai\": \"^1.7.0\",\n \"@langchain/core\": \"^0.3.2\",\n \"@pinecone-database/pinecone\": \"^3.0.3\",\n \"@qdrant/js-client-rest\": \"^1.11.0\",\n \"@types/argparse\": \"^2.0.16\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^22.5.5\",\n \"@types/semver\": \"^7.5.8\",\n \"@types/uuid\": \"^10.0.0\",\n \"bufferutil\": \"^4.0.8\",\n \"chromadb\": \"^1.9.2\",\n \"cohere-ai\": \"^7.14.0\",\n \"langchain\": \"^0.3.2\",\n \"llamaindex\": \"^0.7.10\",\n \"openai\": \"^4.62.1\",\n \"runnables\": \"link:@langchain/core/runnables\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.2\",\n \"vectorstores\": \"link:@langchain/core/vectorstores\"\n },\n \"dependencies\": {\n \"@grpc/grpc-js\": \"^1.11.3\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^1.26.0\",\n \"@opentelemetry/exporter-trace-otlp-grpc\": \"^0.53.0\",\n \"@opentelemetry/exporter-trace-otlp-proto\": \"^0.53.0\",\n \"@opentelemetry/instrumentation\": \"^0.53.0\",\n \"@opentelemetry/sdk-node\": \"^0.53.0\",\n \"@opentelemetry/sdk-trace-base\": \"^1.26.0\",\n \"@opentelemetry/sdk-trace-node\": \"^1.26.0\",\n \"@opentelemetry/semantic-conventions\": \"^1.27.0\",\n \"@traceloop/ai-semantic-conventions\": \"^0.11.0\",\n \"@traceloop/instrumentation-anthropic\": \"^0.11.1\",\n \"@traceloop/instrumentation-azure\": \"^0.11.1\",\n \"@traceloop/instrumentation-bedrock\": \"^0.11.1\",\n \"@traceloop/instrumentation-chromadb\": \"^0.11.3\",\n \"@traceloop/instrumentation-cohere\": \"^0.11.1\",\n \"@traceloop/instrumentation-langchain\": \"^0.11.1\",\n \"@traceloop/instrumentation-llamaindex\": \"^0.11.1\",\n \"@traceloop/instrumentation-openai\": \"^0.11.3\",\n \"@traceloop/instrumentation-pinecone\": \"^0.11.1\",\n \"@traceloop/instrumentation-qdrant\": \"^0.11.1\",\n \"@traceloop/instrumentation-vertexai\": \"^0.11.1\",\n \"argparse\": \">=2.0\",\n \"cli-progress\": \">=3.12\",\n \"esbuild\": \">=0.23\",\n \"posthog-node\": \">=4.0\",\n \"uuid\": \">=10.0.0\"\n }\n}","#!/usr/bin/env node\n\nimport { ArgumentParser } from \"argparse\";\nimport * as esbuild from \"esbuild\";\n\nconst pjson = require('../package.json');\n\nexport function loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}) {\n // TODO: Figure out how to remove all ts-ignores\n // TODO: Cleanup by setting the original values of _evaluation and _set_global_evaluation back\n // @ts-ignore\n globalThis._evaluation = undefined; // @ts-ignore\n globalThis._set_global_evaluation = true; // @ts-ignore\n\n // it needs \"require\" to be passed in\n new Function(\"require\", moduleText)(require);\n\n // Return the modified _evals global variable\n // @ts-ignore\n return globalThis._evaluation;\n}\n\nasync function cli() {\n const [, , ...args] = process.argv;\n\n // Use argparse, which is the port of the python library\n const parser = new ArgumentParser({\n prog: \"lmnr\",\n description: \"CLI for Laminar\",\n });\n\n parser.add_argument(\"-v\", \"--version\", { action: \"version\", version: pjson.version });\n\n const subparsers = parser.add_subparsers({\n title: \"subcommands\",\n dest: \"subcommand\",\n });\n\n const parser_eval = subparsers.add_parser(\"eval\", {\n description: \"Run an evaluation\",\n });\n\n parser_eval.add_argument(\"file\", {\n help: \"A file containing the evaluation to run\",\n });\n\n parser_eval.set_defaults({\n func: async (args: any) => {\n // TODO: Add various optimizations, e.g. minify, pure, tree shaking, etc.\n const buildOptions = {\n entryPoints: [args.file],\n outfile: \"tmp_out.js\",\n write: false, // will be loaded in memory as a temp file\n platform: \"node\" as esbuild.Platform,\n bundle: true,\n external: [\"node_modules/*\"],\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n console.error(\"Error when building: No output files found\");\n process.exit(1);\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluation = loadModule({\n filename: args.file,\n moduleText: outputFileText,\n });\n\n // @ts-ignore\n await evaluation.run();\n }\n });\n\n const parsed = parser.parse_args(args);\n await parsed.func(parsed);\n}\n\ncli();\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,MAAQ;AAAA,MACR,OAAS;AAAA,MACT,SAAW;AAAA,QACT,OAAS;AAAA,QACT,MAAQ;AAAA,MACV;AAAA,MACA,KAAO;AAAA,QACL,MAAQ;AAAA,MACV;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,QACV;AAAA,Q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AO,KAAK,MAAM;AAC5B;AAEA,IAAI;","names":["args"]}
1
+ {"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@lmnr-ai/lmnr\",\n \"version\": \"0.4.17\",\n \"description\": \"TypeScript SDK for Laminar AI\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"scripts\": {\n \"build\": \"tsup src/index.ts src/cli.ts --format esm,cjs --dts\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"bin\": {\n \"lmnr\": \"./dist/cli.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/lmnr-ai/lmnr-ts.git\"\n },\n \"keywords\": [\n \"laminar\",\n \"lmnr\",\n \"sdk\",\n \"lmnr.ai\"\n ],\n \"author\": \"founders@lmnr.ai\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/lmnr-ai/lmnr-ts/issues\"\n },\n \"homepage\": \"https://github.com/lmnr-ai/lmnr-ts#README\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.27.3\",\n \"@aws-sdk/client-bedrock-runtime\": \"^3.679.0\",\n \"@azure/openai\": \"1.0.0-beta.13\",\n \"@google-cloud/aiplatform\": \"^3.29.0\",\n \"@google-cloud/vertexai\": \"^1.7.0\",\n \"@langchain/core\": \"^0.3.2\",\n \"@pinecone-database/pinecone\": \"^3.0.3\",\n \"@qdrant/js-client-rest\": \"^1.11.0\",\n \"@types/argparse\": \"^2.0.16\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^22.5.5\",\n \"@types/semver\": \"^7.5.8\",\n \"@types/uuid\": \"^10.0.0\",\n \"bufferutil\": \"^4.0.8\",\n \"chromadb\": \"^1.9.2\",\n \"cohere-ai\": \"^7.14.0\",\n \"langchain\": \"^0.3.2\",\n \"llamaindex\": \"^0.7.10\",\n \"openai\": \"^4.62.1\",\n \"runnables\": \"link:@langchain/core/runnables\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.2\",\n \"vectorstores\": \"link:@langchain/core/vectorstores\"\n },\n \"dependencies\": {\n \"@grpc/grpc-js\": \"^1.11.3\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^1.26.0\",\n \"@opentelemetry/exporter-trace-otlp-grpc\": \"^0.53.0\",\n \"@opentelemetry/exporter-trace-otlp-proto\": \"^0.53.0\",\n \"@opentelemetry/instrumentation\": \"^0.53.0\",\n \"@opentelemetry/sdk-node\": \"^0.53.0\",\n \"@opentelemetry/sdk-trace-base\": \"^1.26.0\",\n \"@opentelemetry/sdk-trace-node\": \"^1.26.0\",\n \"@opentelemetry/semantic-conventions\": \"^1.27.0\",\n \"@traceloop/ai-semantic-conventions\": \"^0.11.0\",\n \"@traceloop/instrumentation-anthropic\": \"^0.11.1\",\n \"@traceloop/instrumentation-azure\": \"^0.11.1\",\n \"@traceloop/instrumentation-bedrock\": \"^0.11.1\",\n \"@traceloop/instrumentation-chromadb\": \"^0.11.3\",\n \"@traceloop/instrumentation-cohere\": \"^0.11.1\",\n \"@traceloop/instrumentation-langchain\": \"^0.11.1\",\n \"@traceloop/instrumentation-llamaindex\": \"^0.11.1\",\n \"@traceloop/instrumentation-openai\": \"^0.11.3\",\n \"@traceloop/instrumentation-pinecone\": \"^0.11.1\",\n \"@traceloop/instrumentation-qdrant\": \"^0.11.1\",\n \"@traceloop/instrumentation-vertexai\": \"^0.11.1\",\n \"argparse\": \">=2.0\",\n \"cli-progress\": \">=3.12\",\n \"esbuild\": \">=0.23\",\n \"uuid\": \">=10.0.0\"\n }\n}\n","#!/usr/bin/env node\n\nimport { ArgumentParser } from \"argparse\";\nimport * as esbuild from \"esbuild\";\n\nconst pjson = require('../package.json');\n\nexport function loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}) {\n // TODO: Figure out how to remove all ts-ignores\n // TODO: Cleanup by setting the original values of _evaluation and _set_global_evaluation back\n // @ts-ignore\n globalThis._evaluation = undefined; // @ts-ignore\n globalThis._set_global_evaluation = true; // @ts-ignore\n\n // it needs \"require\" to be passed in\n new Function(\"require\", moduleText)(require);\n\n // Return the modified _evals global variable\n // @ts-ignore\n return globalThis._evaluation;\n}\n\nasync function cli() {\n const [, , ...args] = process.argv;\n\n // Use argparse, which is the port of the python library\n const parser = new ArgumentParser({\n prog: \"lmnr\",\n description: \"CLI for Laminar\",\n });\n\n parser.add_argument(\"-v\", \"--version\", { action: \"version\", version: pjson.version });\n\n const subparsers = parser.add_subparsers({\n title: \"subcommands\",\n dest: \"subcommand\",\n });\n\n const parser_eval = subparsers.add_parser(\"eval\", {\n description: \"Run an evaluation\",\n });\n\n parser_eval.add_argument(\"file\", {\n help: \"A file containing the evaluation to run\",\n });\n\n parser_eval.set_defaults({\n func: async (args: any) => {\n // TODO: Add various optimizations, e.g. minify, pure, tree shaking, etc.\n const buildOptions = {\n entryPoints: [args.file],\n outfile: \"tmp_out.js\",\n write: false, // will be loaded in memory as a temp file\n platform: \"node\" as esbuild.Platform,\n bundle: true,\n external: [\"node_modules/*\"],\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n console.error(\"Error when building: No output files found\");\n process.exit(1);\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluation = loadModule({\n filename: args.file,\n moduleText: outputFileText,\n });\n\n // @ts-ignore\n await evaluation.run();\n }\n });\n\n const parsed = parser.parse_args(args);\n await parsed.func(parsed);\n}\n\ncli();\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,MAAQ;AAAA,MACR,OAAS;AAAA,MACT,SAAW;AAAA,QACT,OAAS;AAAA,QACT,MAAQ;AAAA,MACV;AAAA,MACA,KAAO;AAAA,QACL,MAAQ;AAAA,MACV;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AA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,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC5B;AAEA,IAAI;","names":["args"]}
package/dist/index.js CHANGED
@@ -77,75 +77,10 @@ var getTracer = () => {
77
77
  return import_api.trace.getTracer(TRACER_NAME);
78
78
  };
79
79
  var getSpanPath = (entityContext) => {
80
- const path2 = entityContext.getValue(SPAN_PATH_KEY);
81
- return path2 ? `${path2}` : void 0;
80
+ const path = entityContext.getValue(SPAN_PATH_KEY);
81
+ return path ? `${path}` : void 0;
82
82
  };
83
83
 
84
- // src/sdk/telemetry/telemetry.ts
85
- var os = __toESM(require("os"));
86
- var fs = __toESM(require("fs"));
87
- var path = __toESM(require("path"));
88
- var import_uuid = require("uuid");
89
- var _Telemetry = class _Telemetry {
90
- static getInstance() {
91
- if (!_Telemetry.instance) {
92
- _Telemetry.instance = new _Telemetry();
93
- }
94
- return _Telemetry.instance;
95
- }
96
- constructor() {
97
- this.telemetryEnabled = false;
98
- }
99
- getAnonId() {
100
- if (this.anonId) {
101
- return this.anonId;
102
- }
103
- try {
104
- if (!fs.existsSync(_Telemetry.ANON_ID_PATH)) {
105
- fs.mkdirSync(path.dirname(_Telemetry.ANON_ID_PATH), { recursive: true });
106
- const anonIdFile = fs.openSync(_Telemetry.ANON_ID_PATH, "w");
107
- this.anonId = (0, import_uuid.v4)();
108
- fs.writeSync(anonIdFile, this.anonId);
109
- fs.closeSync(anonIdFile);
110
- } else {
111
- const anonIdFile = fs.openSync(_Telemetry.ANON_ID_PATH, "r");
112
- this.anonId = fs.readFileSync(anonIdFile, "utf8");
113
- fs.closeSync(anonIdFile);
114
- }
115
- return this.anonId;
116
- } catch (e) {
117
- return _Telemetry.UNKNOWN_ANON_ID;
118
- }
119
- }
120
- getContext() {
121
- return {
122
- sdk: "typescript",
123
- sdk_version: "<null>"
124
- };
125
- }
126
- capture(event, properties) {
127
- if (this.telemetryEnabled && this.posthog) {
128
- this.posthog.capture({
129
- distinctId: this.getAnonId(),
130
- event,
131
- properties: {
132
- ...properties,
133
- ...this.getContext()
134
- }
135
- });
136
- this.posthog.flush();
137
- }
138
- }
139
- logException(error) {
140
- if (this.telemetryEnabled) {
141
- this.capture("error", { error: error.message, stack: error.stack || "" });
142
- }
143
- }
144
- };
145
- _Telemetry.ANON_ID_PATH = `${os.homedir()}/.cache/lmnr/telemetry_anon_id`;
146
- _Telemetry.UNKNOWN_ANON_ID = "UNKNOWN";
147
- var Telemetry = _Telemetry;
148
-
149
84
  // src/sdk/tracing/index.ts
150
85
  var import_sdk_trace_node = require("@opentelemetry/sdk-trace-node");
151
86
  var import_instrumentation = require("@opentelemetry/instrumentation");
@@ -167,6 +102,7 @@ var SPAN_INPUT = "lmnr.span.input";
167
102
  var SPAN_OUTPUT = "lmnr.span.output";
168
103
  var SPAN_TYPE = "lmnr.span.type";
169
104
  var SPAN_PATH = "lmnr.span.path";
105
+ var SPAN_INSTRUMENTATION_SOURCE = "lmnr.span.instrumentation_source";
170
106
  var ASSOCIATION_PROPERTIES = "lmnr.association.properties";
171
107
  var SESSION_ID = "lmnr.association.properties.session_id";
172
108
  var USER_ID = "lmnr.association.properties.user_id";
@@ -211,129 +147,107 @@ var chromadbInstrumentation;
211
147
  var qdrantInstrumentation;
212
148
  var instrumentations = [];
213
149
  var initInstrumentations = () => {
214
- const exceptionLogger = (e) => Telemetry.getInstance().logException(e);
215
150
  const enrichTokens = (process.env.TRACELOOP_ENRICH_TOKENS || "true").toLowerCase() === "true";
216
151
  openAIInstrumentation = new import_instrumentation_openai.OpenAIInstrumentation({
217
- enrichTokens,
218
- exceptionLogger
152
+ enrichTokens
219
153
  });
220
154
  instrumentations.push(openAIInstrumentation);
221
- anthropicInstrumentation = new import_instrumentation_anthropic.AnthropicInstrumentation({ exceptionLogger });
155
+ anthropicInstrumentation = new import_instrumentation_anthropic.AnthropicInstrumentation();
222
156
  instrumentations.push(anthropicInstrumentation);
223
- azureOpenAIInstrumentation = new import_instrumentation_azure.AzureOpenAIInstrumentation({
224
- exceptionLogger
225
- });
157
+ azureOpenAIInstrumentation = new import_instrumentation_azure.AzureOpenAIInstrumentation();
226
158
  instrumentations.push(azureOpenAIInstrumentation);
227
- cohereInstrumentation = new import_instrumentation_cohere.CohereInstrumentation({ exceptionLogger });
159
+ cohereInstrumentation = new import_instrumentation_cohere.CohereInstrumentation();
228
160
  instrumentations.push(cohereInstrumentation);
229
- vertexaiInstrumentation = new import_instrumentation_vertexai.VertexAIInstrumentation({
230
- exceptionLogger
231
- });
161
+ vertexaiInstrumentation = new import_instrumentation_vertexai.VertexAIInstrumentation();
232
162
  instrumentations.push(vertexaiInstrumentation);
233
- aiplatformInstrumentation = new import_instrumentation_vertexai.AIPlatformInstrumentation({
234
- exceptionLogger
235
- });
163
+ aiplatformInstrumentation = new import_instrumentation_vertexai.AIPlatformInstrumentation();
236
164
  instrumentations.push(aiplatformInstrumentation);
237
- bedrockInstrumentation = new import_instrumentation_bedrock.BedrockInstrumentation({ exceptionLogger });
165
+ bedrockInstrumentation = new import_instrumentation_bedrock.BedrockInstrumentation();
238
166
  instrumentations.push(bedrockInstrumentation);
239
- pineconeInstrumentation = new import_instrumentation_pinecone.PineconeInstrumentation({ exceptionLogger });
167
+ pineconeInstrumentation = new import_instrumentation_pinecone.PineconeInstrumentation();
240
168
  instrumentations.push(pineconeInstrumentation);
241
- langchainInstrumentation = new import_instrumentation_langchain.LangChainInstrumentation({ exceptionLogger });
169
+ langchainInstrumentation = new import_instrumentation_langchain.LangChainInstrumentation();
242
170
  instrumentations.push(langchainInstrumentation);
243
- llamaIndexInstrumentation = new import_instrumentation_llamaindex.LlamaIndexInstrumentation({
244
- exceptionLogger
245
- });
171
+ llamaIndexInstrumentation = new import_instrumentation_llamaindex.LlamaIndexInstrumentation();
246
172
  instrumentations.push(llamaIndexInstrumentation);
247
- chromadbInstrumentation = new import_instrumentation_chromadb.ChromaDBInstrumentation({ exceptionLogger });
173
+ chromadbInstrumentation = new import_instrumentation_chromadb.ChromaDBInstrumentation();
248
174
  instrumentations.push(chromadbInstrumentation);
249
- qdrantInstrumentation = new import_instrumentation_qdrant.QdrantInstrumentation({ exceptionLogger });
175
+ qdrantInstrumentation = new import_instrumentation_qdrant.QdrantInstrumentation();
250
176
  instrumentations.push(qdrantInstrumentation);
251
177
  };
252
178
  var manuallyInitInstrumentations = (instrumentModules) => {
253
- const exceptionLogger = (e) => Telemetry.getInstance().logException(e);
254
179
  const enrichTokens = (process.env.TRACELOOP_ENRICH_TOKENS || "true").toLowerCase() === "true";
255
180
  instrumentations.length = 0;
256
181
  if (instrumentModules == null ? void 0 : instrumentModules.openAI) {
257
182
  openAIInstrumentation = new import_instrumentation_openai.OpenAIInstrumentation({
258
- enrichTokens,
259
- exceptionLogger
183
+ enrichTokens
260
184
  });
261
185
  instrumentations.push(openAIInstrumentation);
262
186
  openAIInstrumentation.manuallyInstrument(instrumentModules.openAI);
263
187
  }
264
188
  if (instrumentModules == null ? void 0 : instrumentModules.anthropic) {
265
- anthropicInstrumentation = new import_instrumentation_anthropic.AnthropicInstrumentation({
266
- exceptionLogger
267
- });
189
+ anthropicInstrumentation = new import_instrumentation_anthropic.AnthropicInstrumentation();
268
190
  instrumentations.push(anthropicInstrumentation);
269
191
  anthropicInstrumentation.manuallyInstrument(instrumentModules.anthropic);
270
192
  }
271
193
  if (instrumentModules == null ? void 0 : instrumentModules.azureOpenAI) {
272
- const instrumentation = new import_instrumentation_azure.AzureOpenAIInstrumentation({ exceptionLogger });
194
+ const instrumentation = new import_instrumentation_azure.AzureOpenAIInstrumentation();
273
195
  instrumentations.push(instrumentation);
274
196
  azureOpenAIInstrumentation = instrumentation;
275
197
  instrumentation.manuallyInstrument(instrumentModules.azureOpenAI);
276
198
  }
277
199
  if (instrumentModules == null ? void 0 : instrumentModules.cohere) {
278
- cohereInstrumentation = new import_instrumentation_cohere.CohereInstrumentation({ exceptionLogger });
200
+ cohereInstrumentation = new import_instrumentation_cohere.CohereInstrumentation();
279
201
  instrumentations.push(cohereInstrumentation);
280
202
  cohereInstrumentation.manuallyInstrument(instrumentModules.cohere);
281
203
  }
282
204
  if (instrumentModules == null ? void 0 : instrumentModules.google_vertexai) {
283
- vertexaiInstrumentation = new import_instrumentation_vertexai.VertexAIInstrumentation({
284
- exceptionLogger
285
- });
205
+ vertexaiInstrumentation = new import_instrumentation_vertexai.VertexAIInstrumentation();
286
206
  instrumentations.push(vertexaiInstrumentation);
287
207
  vertexaiInstrumentation.manuallyInstrument(
288
208
  instrumentModules.google_vertexai
289
209
  );
290
210
  }
291
211
  if (instrumentModules == null ? void 0 : instrumentModules.google_aiplatform) {
292
- aiplatformInstrumentation = new import_instrumentation_vertexai.AIPlatformInstrumentation({
293
- exceptionLogger
294
- });
212
+ aiplatformInstrumentation = new import_instrumentation_vertexai.AIPlatformInstrumentation();
295
213
  instrumentations.push(aiplatformInstrumentation);
296
214
  aiplatformInstrumentation.manuallyInstrument(
297
215
  instrumentModules.google_aiplatform
298
216
  );
299
217
  }
300
218
  if (instrumentModules == null ? void 0 : instrumentModules.bedrock) {
301
- bedrockInstrumentation = new import_instrumentation_bedrock.BedrockInstrumentation({ exceptionLogger });
219
+ bedrockInstrumentation = new import_instrumentation_bedrock.BedrockInstrumentation();
302
220
  instrumentations.push(bedrockInstrumentation);
303
221
  bedrockInstrumentation.manuallyInstrument(instrumentModules.bedrock);
304
222
  }
305
223
  if (instrumentModules == null ? void 0 : instrumentModules.pinecone) {
306
- const instrumentation = new import_instrumentation_pinecone.PineconeInstrumentation({ exceptionLogger });
224
+ const instrumentation = new import_instrumentation_pinecone.PineconeInstrumentation();
307
225
  instrumentations.push(instrumentation);
308
226
  instrumentation.manuallyInstrument(instrumentModules.pinecone);
309
227
  }
310
228
  if (instrumentModules == null ? void 0 : instrumentModules.langchain) {
311
- langchainInstrumentation = new import_instrumentation_langchain.LangChainInstrumentation({
312
- exceptionLogger
313
- });
229
+ langchainInstrumentation = new import_instrumentation_langchain.LangChainInstrumentation();
314
230
  instrumentations.push(langchainInstrumentation);
315
231
  langchainInstrumentation.manuallyInstrument(instrumentModules.langchain);
316
232
  }
317
233
  if (instrumentModules == null ? void 0 : instrumentModules.llamaIndex) {
318
- llamaIndexInstrumentation = new import_instrumentation_llamaindex.LlamaIndexInstrumentation({
319
- exceptionLogger
320
- });
234
+ llamaIndexInstrumentation = new import_instrumentation_llamaindex.LlamaIndexInstrumentation();
321
235
  instrumentations.push(llamaIndexInstrumentation);
322
236
  llamaIndexInstrumentation.manuallyInstrument(instrumentModules.llamaIndex);
323
237
  }
324
238
  if (instrumentModules == null ? void 0 : instrumentModules.chromadb) {
325
- chromadbInstrumentation = new import_instrumentation_chromadb.ChromaDBInstrumentation({ exceptionLogger });
239
+ chromadbInstrumentation = new import_instrumentation_chromadb.ChromaDBInstrumentation();
326
240
  instrumentations.push(chromadbInstrumentation);
327
241
  chromadbInstrumentation.manuallyInstrument(instrumentModules.chromadb);
328
242
  }
329
243
  if (instrumentModules == null ? void 0 : instrumentModules.qdrant) {
330
- qdrantInstrumentation = new import_instrumentation_qdrant.QdrantInstrumentation({ exceptionLogger });
244
+ qdrantInstrumentation = new import_instrumentation_qdrant.QdrantInstrumentation();
331
245
  instrumentations.push(qdrantInstrumentation);
332
246
  qdrantInstrumentation.manuallyInstrument(instrumentModules.qdrant);
333
247
  }
334
248
  };
335
249
  var startTracing = (options) => {
336
- var _a, _b;
250
+ var _a;
337
251
  if (options.instrumentModules !== void 0) {
338
252
  manuallyInitInstrumentations(options.instrumentModules);
339
253
  } else {
@@ -376,6 +290,7 @@ var startTracing = (options) => {
376
290
  if (spanPath) {
377
291
  span.setAttribute(SPAN_PATH, spanPath);
378
292
  }
293
+ span.setAttribute(SPAN_INSTRUMENTATION_SOURCE, "javascript");
379
294
  const associationProperties = import_api2.context.active().getValue(ASSOCIATION_PROPERTIES_KEY);
380
295
  if (associationProperties) {
381
296
  for (const [key, value] of Object.entries(associationProperties)) {
@@ -387,17 +302,6 @@ var startTracing = (options) => {
387
302
  }
388
303
  }
389
304
  };
390
- if (options.exporter) {
391
- Telemetry.getInstance().capture("tracer:init", {
392
- exporter: "custom",
393
- processor: options.disableBatch ? "simple" : "batch"
394
- });
395
- } else {
396
- Telemetry.getInstance().capture("tracer:init", {
397
- exporter: (_b = options.baseUrl) != null ? _b : "",
398
- processor: options.disableBatch ? "simple" : "batch"
399
- });
400
- }
401
305
  const provider = new import_sdk_trace_node.NodeTracerProvider();
402
306
  provider.addSpanProcessor(_spanProcessor);
403
307
  provider.register();
@@ -574,12 +478,12 @@ function serialize(input) {
574
478
  }
575
479
 
576
480
  // src/utils.ts
577
- var import_uuid2 = require("uuid");
481
+ var import_uuid = require("uuid");
578
482
  var newUUID = () => {
579
483
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
580
484
  return crypto.randomUUID();
581
485
  } else {
582
- return (0, import_uuid2.v4)();
486
+ return (0, import_uuid.v4)();
583
487
  }
584
488
  };
585
489
  var otelSpanIdToUUID = (spanId) => {