@lmnr-ai/lmnr 0.4.22 → 0.4.24

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/README.md CHANGED
@@ -172,3 +172,19 @@ Resulting in:
172
172
  runId: '05383a95-d316-4091-a64b-06c54d12982a'
173
173
  }
174
174
  ```
175
+
176
+ ## Semantic search
177
+
178
+ You can perform a semantic search on a dataset using the `semanticSearch` method.
179
+
180
+ ```typescript
181
+ import { Laminar } from '@lmnr-ai/lmnr';
182
+
183
+ const l = new Laminar('<YOUR_PROJECT_API_KEY>');
184
+ const result = await l.semanticSearch({
185
+ query: 'hello',
186
+ datasetId: 'my_dataset_id',
187
+ });
188
+ ```
189
+
190
+ [Read docs](https://docs.lmnr.ai/datasets/indexing#searching) to learn more about semantic search.
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.22",
39
+ version: "0.4.24",
40
40
  description: "TypeScript SDK for Laminar AI",
41
41
  main: "dist/index.js",
42
42
  types: "dist/index.d.ts",
@@ -78,14 +78,14 @@ var require_package = __commonJS({
78
78
  "@types/semver": "^7.5.8",
79
79
  "@types/uuid": "^10.0.0",
80
80
  bufferutil: "^4.0.8",
81
- chromadb: "^1.9.2",
81
+ chromadb: "^1.9.4",
82
82
  "cohere-ai": "^7.14.0",
83
83
  langchain: "^0.3.2",
84
84
  llamaindex: "^0.7.10",
85
85
  openai: "^4.62.1",
86
86
  runnables: "link:@langchain/core/runnables",
87
- tsup: "^8.3.0",
88
- typescript: "^5.6.2",
87
+ tsup: "^8.3.5",
88
+ typescript: "^5.7.2",
89
89
  vectorstores: "link:@langchain/core/vectorstores"
90
90
  },
91
91
  dependencies: {
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.22\",\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,QAC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,MAAM;AAC1B;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.24\",\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.4\",\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.5\",\n \"typescript\": \"^5.7.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,MAC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AM,WAAW,IAAI;AAAA,IACvB;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,WAAW,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC1B;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.22",
18
+ version: "0.4.24",
19
19
  description: "TypeScript SDK for Laminar AI",
20
20
  main: "dist/index.js",
21
21
  types: "dist/index.d.ts",
@@ -57,14 +57,14 @@ var require_package = __commonJS({
57
57
  "@types/semver": "^7.5.8",
58
58
  "@types/uuid": "^10.0.0",
59
59
  bufferutil: "^4.0.8",
60
- chromadb: "^1.9.2",
60
+ chromadb: "^1.9.4",
61
61
  "cohere-ai": "^7.14.0",
62
62
  langchain: "^0.3.2",
63
63
  llamaindex: "^0.7.10",
64
64
  openai: "^4.62.1",
65
65
  runnables: "link:@langchain/core/runnables",
66
- tsup: "^8.3.0",
67
- typescript: "^5.6.2",
66
+ tsup: "^8.3.5",
67
+ typescript: "^5.7.2",
68
68
  vectorstores: "link:@langchain/core/vectorstores"
69
69
  },
70
70
  dependencies: {
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.22\",\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;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;AAA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O,eAAe;AAAA,IACvC,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC;AAED,QAAM,cAAc,WAAW,WAAW,QAAQ;AAAA,IAChD,aAAa;AAAA,EACf,CAAC;AAED,cAAY,aAAa,QAAQ;AAAA,IAC/B,MAAM;AAAA,EACR,CAAC;AAED,cAAY,aAAa;AAAA,IACvB,MAAM,OAAOA,UAAc;AAEzB,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;AACvB,gBAAQ,MAAM,4CAA4C;AAC1D,gBAAQ,KAAK,CAAC;AAAA,MAChB;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,IACvB;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,WAAW,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC1B;AAEA,IAAI;","names":["args"]}
1
+ {"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@lmnr-ai/lmnr\",\n \"version\": \"0.4.24\",\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.4\",\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.5\",\n \"typescript\": \"^5.7.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;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,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QAAM,aAAa,OAAO,eAAe;AAAA,IACvC,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC;AAED,QAAM,cAAc,WAAW,WAAW,QAAQ;AAAA,IAChD,aAAa;AAAA,EACf,CAAC;AAED,cAAY,aAAa,QAAQ;AAAA,IAC/B,MAAM;AAAA,EACR,CAAC;AAED,cAAY,aAAa;AAAA,IACvB,MAAM,OAAOA,UAAc;AAEzB,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;AACvB,gBAAQ,MAAM,4CAA4C;AAC1D,gBAAQ,KAAK,CAAC;AAAA,MAChB;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,IACvB;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,WAAW,IAAI;AACrC,QAAM,OAAO,KAAK,MAAM;AAC1B;AAEA,IAAI;","names":["args"]}
package/dist/index.d.mts CHANGED
@@ -114,6 +114,12 @@ interface InitializeOptions {
114
114
  * Defaults to false.
115
115
  */
116
116
  silenceInitializationMessage?: boolean;
117
+ /**
118
+ * Whether to use an external tracer provider. Optional.
119
+ * Defaults to false. If true, the SDK will not initialize its own tracer provider.
120
+ * This is useful for advanced use cases where the user wants to manage the tracer provider themselves.
121
+ */
122
+ useExternalTracerProvider?: boolean;
117
123
  }
118
124
 
119
125
  declare global {
@@ -177,7 +183,7 @@ type EvaluatorFunctionReturn = number | Record<string, number>;
177
183
  * of string keys and number values. The latter is useful for evaluating
178
184
  * multiple criteria in one go instead of running multiple evaluators.
179
185
  */
180
- type EvaluatorFunction<O, T> = (output: O, target: T | undefined, ...args: any[]) => EvaluatorFunctionReturn | Promise<EvaluatorFunctionReturn>;
186
+ type EvaluatorFunction<O, T> = (output: O, target?: T, ...args: any[]) => EvaluatorFunctionReturn | Promise<EvaluatorFunctionReturn>;
181
187
  /**
182
188
  * HumanEvaluator is an object to register a human evaluator. For now, it only
183
189
  * holds the queue name.
@@ -318,6 +324,15 @@ type GetDatapointsResponse<D, T> = {
318
324
  totalCount: number;
319
325
  anyInProject: boolean;
320
326
  };
327
+ type SemanticSearchResult = {
328
+ datasetId: StringUUID;
329
+ data: Record<string, any>;
330
+ content: string;
331
+ score: number;
332
+ };
333
+ type SemanticSearchResponse = {
334
+ results: SemanticSearchResult[];
335
+ };
321
336
  /**
322
337
  * Trace types to categorize traces.
323
338
  * They are used as association properties passed to all spans in a trace.
@@ -346,6 +361,7 @@ interface LaminarInitializeProps {
346
361
  httpPort?: number;
347
362
  grpcPort?: number;
348
363
  instrumentModules?: InitializeOptions["instrumentModules"];
364
+ useExternalTracerProvider?: boolean;
349
365
  }
350
366
  declare class Laminar {
351
367
  private static baseHttpUrl;
@@ -374,6 +390,16 @@ declare class Laminar {
374
390
  * LLM calls (OpenAI, Anthropic, etc), Langchain, VectorDB calls (Pinecone, Qdrant, etc).
375
391
  * Pass an empty object {} to disable any kind of automatic instrumentation.
376
392
  * If you only want to auto-instrument specific modules, then pass them in the object.
393
+ * @param useExternalTracerProvider - [ADVANCED] Only use if you are using another
394
+ * node-based tracer provider. Defaults to false.
395
+ * If `true`, the SDK will not initialize its own tracer provider. Be very careful.
396
+ * If you set this to `true`, but the external provider does not extend/implement
397
+ * {@link BasicTracerProvider} or is not a {@link ProxyTracerProvider} that internally
398
+ * delegates to a {@link BasicTracerProvider}, the SDK will not function correctly.
399
+ * The only setting this has been tested with is `@opentelemetry/auto-instrumentations-node`.
400
+ * {@link https://opentelemetry.io/docs/zero-code/js/#configuring-the-module} - this
401
+ * initializes a {@link ProxyTracerProvider} internally which delegates to a
402
+ * {@link NodeTracerProvider}, which in turn, extends {@link BasicTracerProvider}.
377
403
  *
378
404
  * @example
379
405
  * import { Laminar as L } from '@lmnr-ai/lmnr';
@@ -390,7 +416,7 @@ declare class Laminar {
390
416
  *
391
417
  * @throws {Error} - If project API key is not set
392
418
  */
393
- static initialize({ projectApiKey, env, baseUrl, httpPort, grpcPort, instrumentModules }: LaminarInitializeProps): void;
419
+ static initialize({ projectApiKey, env, baseUrl, httpPort, grpcPort, instrumentModules, useExternalTracerProvider, }: LaminarInitializeProps): void;
394
420
  /**
395
421
  * Check if Laminar has been initialized. Utility to make sure other methods
396
422
  * are called after initialization.
@@ -425,6 +451,21 @@ declare class Laminar {
425
451
  * key or if the request fails.
426
452
  */
427
453
  static run({ pipeline, inputs, env, metadata, currentSpanId, currentTraceId, }: PipelineRunRequest): Promise<PipelineRunResponse>;
454
+ /**
455
+ * Perform a semantic search on a dataset.
456
+ *
457
+ * @param query - The query string to search with.
458
+ * @param datasetId - The ID of the dataset to search in.
459
+ * @param limit - The maximum number of results to return.
460
+ * @param threshold - The minimum score for the results to be returned.
461
+ * @returns Response object containing the search results in descending order of relevance.
462
+ */
463
+ static semanticSearch({ query, datasetId, limit, threshold, }: {
464
+ query: string;
465
+ datasetId: string;
466
+ limit?: number;
467
+ threshold?: number;
468
+ }): Promise<SemanticSearchResponse>;
428
469
  /**
429
470
  * Associates an event with the current span. If event with such name never
430
471
  * existed, Laminar will create a new event and infer its type from the value.
@@ -441,27 +482,6 @@ declare class Laminar {
441
482
  * If specified as an integer, it must be epoch nanoseconds.
442
483
  */
443
484
  static event(name: string, value?: AttributeValue, timestamp?: TimeInput): void;
444
- /**
445
- * DEPRECATED: use `withSession` and/or `withMetadata` instead.
446
- * Sets the session information for the current span and returns the
447
- * context to use for the following spans.
448
- *
449
- * @param sessionId - The session ID to associate with the context.
450
- * @param userId - The user ID to associate with the context.
451
- * @returns The updated context with the association properties.
452
- *
453
- * @example
454
- * import { context as contextApi } from '@opentelemetry/api';
455
- * import { Laminar } from '@lmnr-ai/laminar';
456
- * const context = Laminar.contextWithSession({ sessionId: "1234", userId: "5678" });
457
- * contextApi.with(context, () => {
458
- * // Your code here
459
- * });
460
- */
461
- static contextWithSession({ sessionId, userId }: {
462
- sessionId?: string;
463
- userId?: string;
464
- }): Context;
465
485
  /**
466
486
  * Sets the session information for the current span and returns the
467
487
  * context to use for the following spans. Returns the result of the
@@ -483,8 +503,8 @@ declare class Laminar {
483
503
  * the following spans. Returns the result of the function execution, so can
484
504
  * be used in an `await` statement.
485
505
  *
486
- * @param metadata - The metadata to associate with the context. Will be sent
487
- * as attributes, so must be serializable to JSON.
506
+ * @param metadata - The metadata to associate with the context. Set of string key
507
+ * string value pairs.
488
508
  * @param fn - Function to execute within the metadata context.
489
509
  * @returns The result of the function execution.
490
510
  *
@@ -499,7 +519,7 @@ declare class Laminar {
499
519
  * }
500
520
  * );
501
521
  */
502
- static withMetadata<T>(metadata: Record<string, any>, fn: () => T): T;
522
+ static withMetadata<T>(metadata: Record<string, string>, fn: () => T): T;
503
523
  /**
504
524
  * Set attributes for the current span. Useful for manual
505
525
  * instrumentation.
@@ -615,7 +635,8 @@ interface ObserveOptions {
615
635
  * functions and methods to create spans.
616
636
  *
617
637
  * @param name - Name of the span. Function name is used if not specified.
618
- * @param userId - User ID to associate with the span and the following context.
638
+ * @param userId - Deprecated. Use {@link Laminar.withMetadata} to set key-value pairs.
639
+ * User ID to associate with the span and the following context.
619
640
  * @param sessionId - Session ID to associate with the span and the following context.
620
641
  * @param traceType – Type of the trace. Unless it is within evaluation, it should be 'DEFAULT'.
621
642
  * @param spanType - Type of the span. 'DEFAULT' is used if not specified. If the type is 'LLM',
package/dist/index.d.ts CHANGED
@@ -114,6 +114,12 @@ interface InitializeOptions {
114
114
  * Defaults to false.
115
115
  */
116
116
  silenceInitializationMessage?: boolean;
117
+ /**
118
+ * Whether to use an external tracer provider. Optional.
119
+ * Defaults to false. If true, the SDK will not initialize its own tracer provider.
120
+ * This is useful for advanced use cases where the user wants to manage the tracer provider themselves.
121
+ */
122
+ useExternalTracerProvider?: boolean;
117
123
  }
118
124
 
119
125
  declare global {
@@ -177,7 +183,7 @@ type EvaluatorFunctionReturn = number | Record<string, number>;
177
183
  * of string keys and number values. The latter is useful for evaluating
178
184
  * multiple criteria in one go instead of running multiple evaluators.
179
185
  */
180
- type EvaluatorFunction<O, T> = (output: O, target: T | undefined, ...args: any[]) => EvaluatorFunctionReturn | Promise<EvaluatorFunctionReturn>;
186
+ type EvaluatorFunction<O, T> = (output: O, target?: T, ...args: any[]) => EvaluatorFunctionReturn | Promise<EvaluatorFunctionReturn>;
181
187
  /**
182
188
  * HumanEvaluator is an object to register a human evaluator. For now, it only
183
189
  * holds the queue name.
@@ -318,6 +324,15 @@ type GetDatapointsResponse<D, T> = {
318
324
  totalCount: number;
319
325
  anyInProject: boolean;
320
326
  };
327
+ type SemanticSearchResult = {
328
+ datasetId: StringUUID;
329
+ data: Record<string, any>;
330
+ content: string;
331
+ score: number;
332
+ };
333
+ type SemanticSearchResponse = {
334
+ results: SemanticSearchResult[];
335
+ };
321
336
  /**
322
337
  * Trace types to categorize traces.
323
338
  * They are used as association properties passed to all spans in a trace.
@@ -346,6 +361,7 @@ interface LaminarInitializeProps {
346
361
  httpPort?: number;
347
362
  grpcPort?: number;
348
363
  instrumentModules?: InitializeOptions["instrumentModules"];
364
+ useExternalTracerProvider?: boolean;
349
365
  }
350
366
  declare class Laminar {
351
367
  private static baseHttpUrl;
@@ -374,6 +390,16 @@ declare class Laminar {
374
390
  * LLM calls (OpenAI, Anthropic, etc), Langchain, VectorDB calls (Pinecone, Qdrant, etc).
375
391
  * Pass an empty object {} to disable any kind of automatic instrumentation.
376
392
  * If you only want to auto-instrument specific modules, then pass them in the object.
393
+ * @param useExternalTracerProvider - [ADVANCED] Only use if you are using another
394
+ * node-based tracer provider. Defaults to false.
395
+ * If `true`, the SDK will not initialize its own tracer provider. Be very careful.
396
+ * If you set this to `true`, but the external provider does not extend/implement
397
+ * {@link BasicTracerProvider} or is not a {@link ProxyTracerProvider} that internally
398
+ * delegates to a {@link BasicTracerProvider}, the SDK will not function correctly.
399
+ * The only setting this has been tested with is `@opentelemetry/auto-instrumentations-node`.
400
+ * {@link https://opentelemetry.io/docs/zero-code/js/#configuring-the-module} - this
401
+ * initializes a {@link ProxyTracerProvider} internally which delegates to a
402
+ * {@link NodeTracerProvider}, which in turn, extends {@link BasicTracerProvider}.
377
403
  *
378
404
  * @example
379
405
  * import { Laminar as L } from '@lmnr-ai/lmnr';
@@ -390,7 +416,7 @@ declare class Laminar {
390
416
  *
391
417
  * @throws {Error} - If project API key is not set
392
418
  */
393
- static initialize({ projectApiKey, env, baseUrl, httpPort, grpcPort, instrumentModules }: LaminarInitializeProps): void;
419
+ static initialize({ projectApiKey, env, baseUrl, httpPort, grpcPort, instrumentModules, useExternalTracerProvider, }: LaminarInitializeProps): void;
394
420
  /**
395
421
  * Check if Laminar has been initialized. Utility to make sure other methods
396
422
  * are called after initialization.
@@ -425,6 +451,21 @@ declare class Laminar {
425
451
  * key or if the request fails.
426
452
  */
427
453
  static run({ pipeline, inputs, env, metadata, currentSpanId, currentTraceId, }: PipelineRunRequest): Promise<PipelineRunResponse>;
454
+ /**
455
+ * Perform a semantic search on a dataset.
456
+ *
457
+ * @param query - The query string to search with.
458
+ * @param datasetId - The ID of the dataset to search in.
459
+ * @param limit - The maximum number of results to return.
460
+ * @param threshold - The minimum score for the results to be returned.
461
+ * @returns Response object containing the search results in descending order of relevance.
462
+ */
463
+ static semanticSearch({ query, datasetId, limit, threshold, }: {
464
+ query: string;
465
+ datasetId: string;
466
+ limit?: number;
467
+ threshold?: number;
468
+ }): Promise<SemanticSearchResponse>;
428
469
  /**
429
470
  * Associates an event with the current span. If event with such name never
430
471
  * existed, Laminar will create a new event and infer its type from the value.
@@ -441,27 +482,6 @@ declare class Laminar {
441
482
  * If specified as an integer, it must be epoch nanoseconds.
442
483
  */
443
484
  static event(name: string, value?: AttributeValue, timestamp?: TimeInput): void;
444
- /**
445
- * DEPRECATED: use `withSession` and/or `withMetadata` instead.
446
- * Sets the session information for the current span and returns the
447
- * context to use for the following spans.
448
- *
449
- * @param sessionId - The session ID to associate with the context.
450
- * @param userId - The user ID to associate with the context.
451
- * @returns The updated context with the association properties.
452
- *
453
- * @example
454
- * import { context as contextApi } from '@opentelemetry/api';
455
- * import { Laminar } from '@lmnr-ai/laminar';
456
- * const context = Laminar.contextWithSession({ sessionId: "1234", userId: "5678" });
457
- * contextApi.with(context, () => {
458
- * // Your code here
459
- * });
460
- */
461
- static contextWithSession({ sessionId, userId }: {
462
- sessionId?: string;
463
- userId?: string;
464
- }): Context;
465
485
  /**
466
486
  * Sets the session information for the current span and returns the
467
487
  * context to use for the following spans. Returns the result of the
@@ -483,8 +503,8 @@ declare class Laminar {
483
503
  * the following spans. Returns the result of the function execution, so can
484
504
  * be used in an `await` statement.
485
505
  *
486
- * @param metadata - The metadata to associate with the context. Will be sent
487
- * as attributes, so must be serializable to JSON.
506
+ * @param metadata - The metadata to associate with the context. Set of string key
507
+ * string value pairs.
488
508
  * @param fn - Function to execute within the metadata context.
489
509
  * @returns The result of the function execution.
490
510
  *
@@ -499,7 +519,7 @@ declare class Laminar {
499
519
  * }
500
520
  * );
501
521
  */
502
- static withMetadata<T>(metadata: Record<string, any>, fn: () => T): T;
522
+ static withMetadata<T>(metadata: Record<string, string>, fn: () => T): T;
503
523
  /**
504
524
  * Set attributes for the current span. Useful for manual
505
525
  * instrumentation.
@@ -615,7 +635,8 @@ interface ObserveOptions {
615
635
  * functions and methods to create spans.
616
636
  *
617
637
  * @param name - Name of the span. Function name is used if not specified.
618
- * @param userId - User ID to associate with the span and the following context.
638
+ * @param userId - Deprecated. Use {@link Laminar.withMetadata} to set key-value pairs.
639
+ * User ID to associate with the span and the following context.
619
640
  * @param sessionId - Session ID to associate with the span and the following context.
620
641
  * @param traceType – Type of the trace. Unless it is within evaluation, it should be 'DEFAULT'.
621
642
  * @param spanType - Type of the span. 'DEFAULT' is used if not specified. If the type is 'LLM',