diff --git a/.github/component_owners.yml b/.github/component_owners.yml
index a1f6c7d532..c5cbd89431 100644
--- a/.github/component_owners.yml
+++ b/.github/component_owners.yml
@@ -117,6 +117,9 @@ components:
# Unmaintained
packages/instrumentation-koa: []
# Unmaintained
+ packages/instrumentation-langchain:
+ - yiyuan-he
+ - mxiamxia
packages/instrumentation-memcached: []
# Unmaintained
packages/instrumentation-mongodb:
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d5594fa4c5..3b125c7f64 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -46,6 +46,7 @@
"packages/instrumentation-ioredis": "0.56.0",
"packages/instrumentation-knex": "0.53.1",
"packages/instrumentation-koa": "0.57.0",
+ "packages/instrumentation-langchain": "0.1.0",
"packages/instrumentation-memcached": "0.52.0",
"packages/instrumentation-mongodb": "0.61.0",
"packages/instrumentation-mysql": "0.54.0",
diff --git a/package-lock.json b/package-lock.json
index 458ce3b64a..6e16b8d997 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6552,6 +6552,72 @@
"node": ">= 20"
}
},
+ "node_modules/@langchain/openai": {
+ "version": "0.6.16",
+ "resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-0.6.16.tgz",
+ "integrity": "sha512-v9INBOjE0w6ZrUE7kP9UkRyNsV7daH7aPeSOsPEJ35044UI3udPHwNduQ8VmaOUsD26OvSdg1b1GDhrqWLMaRw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "js-tiktoken": "^1.0.12",
+ "openai": "5.12.2",
+ "zod": "^3.25.32"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@langchain/core": ">=0.3.68 <0.4.0"
+ }
+ },
+ "node_modules/@langchain/openai/node_modules/openai": {
+ "version": "5.12.2",
+ "resolved": "https://registry.npmjs.org/openai/-/openai-5.12.2.tgz",
+ "integrity": "sha512-xqzHHQch5Tws5PcKR2xsZGX9xtch+JQFz5zb14dGqlshmmDAFBFEWmeIpf7wVqWV+w7Emj7jRgkNJakyKE0tYQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "openai": "bin/cli"
+ },
+ "peerDependencies": {
+ "ws": "^8.18.0",
+ "zod": "^3.23.8"
+ },
+ "peerDependenciesMeta": {
+ "ws": {
+ "optional": true
+ },
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@langchain/openai/node_modules/zod": {
+ "version": "3.25.76",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/@langchain/textsplitters": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@langchain/textsplitters/-/textsplitters-0.1.0.tgz",
+ "integrity": "sha512-djI4uw9rlkAb5iMhtLED+xJebDdAG935AdP4eRTB02R7OB/act55Bj9wsskhZsvuyQRpO4O1wQOp85s6T6GWmw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "js-tiktoken": "^1.0.12"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@langchain/core": ">=0.2.21 <0.4.0"
+ }
+ },
"node_modules/@lerna/create": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@lerna/create/-/create-9.0.3.tgz",
@@ -10173,6 +10239,10 @@
"resolved": "packages/instrumentation-koa",
"link": true
},
+ "node_modules/@opentelemetry/instrumentation-langchain": {
+ "resolved": "packages/instrumentation-langchain",
+ "link": true
+ },
"node_modules/@opentelemetry/instrumentation-long-task": {
"resolved": "packages/instrumentation-long-task",
"link": true
@@ -12880,6 +12950,13 @@
"@types/node": "*"
}
},
+ "node_modules/@types/retry": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/scheduler": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
@@ -13096,6 +13173,146 @@
"node": ">= 4"
}
},
+ "node_modules/@typescript-eslint/experimental-utils": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.1.tgz",
+ "integrity": "sha512-fbodVnjIDU4JpeXWRDsG5IfIjYBxEvs8EBO8W1+YVdtrc2B9ppfof5sZhVEDOtgTfFHnYQJDI8+qdqLYO4ceww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/json-schema": "^7.0.9",
+ "@typescript-eslint/scope-manager": "5.8.1",
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/typescript-estree": "5.8.1",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.1.tgz",
+ "integrity": "sha512-DGxJkNyYruFH3NIZc3PwrzwOQAg7vvgsHsHCILOLvUpupgkwDZdNq/cXU3BjF4LNrCsVg0qxEyWasys5AiJ85Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/visitor-keys": "5.8.1"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/@typescript-eslint/types": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.1.tgz",
+ "integrity": "sha512-L/FlWCCgnjKOLefdok90/pqInkomLnAcF9UAzNr+DSqMC3IffzumHTQTrINXhP1gVp9zlHiYYjvozVZDPleLcA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.1.tgz",
+ "integrity": "sha512-26lQ8l8tTbG7ri7xEcCFT9ijU5Fk+sx/KRRyyzCv7MQ+rZZlqiDPtMKWLC8P7o+dtCnby4c+OlxuX1tp8WfafQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/visitor-keys": "5.8.1",
+ "debug": "^4.3.2",
+ "globby": "^11.0.4",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.5",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.1.tgz",
+ "integrity": "sha512-SWgiWIwocK6NralrJarPZlWdr0hZnj5GXHIgfdm8hNkyKvpeQuFyLP6YjSIe9kf3YBIfU6OHSZLYkQ+smZwtNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "eslint-visitor-keys": "^3.0.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/eslint-scope": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
+ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^4.1.1"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/experimental-utils/node_modules/estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
"node_modules/@typescript-eslint/parser": {
"version": "8.41.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.41.0.tgz",
@@ -16647,6 +16864,16 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/console-table-printer": {
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/console-table-printer/-/console-table-printer-2.15.0.tgz",
+ "integrity": "sha512-SrhBq4hYVjLCkBVOWaTzceJalvn5K1Zq5aQA6wXC/cYjI3frKWNPEMK3sZsJfNNQApvCQmgBcc13ZKmFj8qExw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "simple-wcswidth": "^1.1.2"
+ }
+ },
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -18634,6 +18861,35 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/eslint-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz",
+ "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^2.0.0"
+ },
+ "engines": {
+ "node": "^10.0.0 || ^12.0.0 || >= 14.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ },
+ "peerDependencies": {
+ "eslint": ">=5"
+ }
+ },
+ "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
+ "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/eslint-visitor-keys": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
@@ -19996,7 +20252,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
- "dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -20023,6 +20278,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/functions-have-names": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
@@ -20825,7 +21087,6 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
@@ -21699,7 +21960,6 @@
"version": "2.16.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
"integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
- "dev": true,
"license": "MIT",
"dependencies": {
"hasown": "^2.0.2"
@@ -22775,6 +23035,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/js-tiktoken": {
+ "version": "1.0.21",
+ "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.21.tgz",
+ "integrity": "sha512-biOj/6M5qdgx5TKjDnFT1ymSpM5tbd3ylwDtrQvFQSu0Z7bBYko2dF+W/aUkXUPuk6IVpRxk/3Q2sHOzGlS36g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "base64-js": "^1.5.1"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -22957,6 +23227,16 @@
],
"license": "MIT"
},
+ "node_modules/jsonpointer": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz",
+ "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
@@ -23876,68 +24156,264 @@
"dev": true,
"license": "MIT"
},
- "node_modules/lerna": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/lerna/-/lerna-9.0.3.tgz",
- "integrity": "sha512-wCsJWKX8FaGJoWX2K5gL5q7ReqQNxNsS92AW5glBe/JzWEtoM/jgXXGrEzQzORMb8rTXYFjUjpn60et+i8XugA==",
+ "node_modules/langchain": {
+ "version": "0.3.36",
+ "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.3.36.tgz",
+ "integrity": "sha512-PqC19KChFF0QlTtYDFgfEbIg+SCnCXox29G8tY62QWfj9bOW7ew2kgWmPw5qoHLOTKOdQPvXET20/1Pdq8vAtQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@lerna/create": "9.0.3",
- "@npmcli/arborist": "9.1.6",
- "@npmcli/package-json": "7.0.2",
- "@npmcli/run-script": "10.0.2",
- "@nx/devkit": ">=21.5.2 < 23.0.0",
- "@octokit/plugin-enterprise-rest": "6.0.1",
- "@octokit/rest": "20.1.2",
- "aproba": "2.0.0",
- "byte-size": "8.1.1",
- "chalk": "4.1.0",
- "cmd-shim": "6.0.3",
- "color-support": "1.1.3",
- "columnify": "1.6.0",
- "console-control-strings": "^1.1.0",
- "conventional-changelog-angular": "7.0.0",
- "conventional-changelog-core": "5.0.1",
- "conventional-recommended-bump": "7.0.1",
- "cosmiconfig": "9.0.0",
- "dedent": "1.5.3",
- "envinfo": "7.13.0",
- "execa": "5.0.0",
- "fs-extra": "^11.2.0",
- "get-port": "5.1.1",
- "get-stream": "6.0.0",
- "git-url-parse": "14.0.0",
- "glob-parent": "6.0.2",
- "has-unicode": "2.0.1",
- "import-local": "3.1.0",
- "ini": "^1.3.8",
- "init-package-json": "8.2.2",
- "inquirer": "12.9.6",
- "is-ci": "3.0.1",
- "is-stream": "2.0.0",
- "jest-diff": ">=30.0.0 < 31",
- "js-yaml": "4.1.1",
- "libnpmaccess": "10.0.3",
- "libnpmpublish": "11.1.2",
- "load-json-file": "6.2.0",
- "make-dir": "4.0.0",
- "make-fetch-happen": "15.0.2",
- "minimatch": "3.0.5",
- "multimatch": "5.0.0",
- "npm-package-arg": "13.0.1",
- "npm-packlist": "10.0.3",
- "npm-registry-fetch": "19.1.0",
- "nx": ">=21.5.3 < 23.0.0",
- "p-map": "4.0.0",
- "p-map-series": "2.1.0",
- "p-pipe": "3.1.0",
- "p-queue": "6.6.2",
- "p-reduce": "2.1.0",
- "p-waterfall": "2.1.1",
- "pacote": "21.0.1",
- "pify": "5.0.0",
- "read-cmd-shim": "4.0.0",
+ "@langchain/openai": ">=0.1.0 <0.7.0",
+ "@langchain/textsplitters": ">=0.0.0 <0.2.0",
+ "js-tiktoken": "^1.0.12",
+ "js-yaml": "^4.1.0",
+ "jsonpointer": "^5.0.1",
+ "langsmith": "^0.3.67",
+ "openapi-types": "^12.1.3",
+ "p-retry": "4",
+ "uuid": "^10.0.0",
+ "yaml": "^2.2.1",
+ "zod": "^3.25.32"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@langchain/anthropic": "*",
+ "@langchain/aws": "*",
+ "@langchain/cerebras": "*",
+ "@langchain/cohere": "*",
+ "@langchain/core": ">=0.3.58 <0.4.0",
+ "@langchain/deepseek": "*",
+ "@langchain/google-genai": "*",
+ "@langchain/google-vertexai": "*",
+ "@langchain/google-vertexai-web": "*",
+ "@langchain/groq": "*",
+ "@langchain/mistralai": "*",
+ "@langchain/ollama": "*",
+ "@langchain/xai": "*",
+ "axios": "*",
+ "cheerio": "*",
+ "handlebars": "^4.7.8",
+ "peggy": "^3.0.2",
+ "typeorm": "*"
+ },
+ "peerDependenciesMeta": {
+ "@langchain/anthropic": {
+ "optional": true
+ },
+ "@langchain/aws": {
+ "optional": true
+ },
+ "@langchain/cerebras": {
+ "optional": true
+ },
+ "@langchain/cohere": {
+ "optional": true
+ },
+ "@langchain/deepseek": {
+ "optional": true
+ },
+ "@langchain/google-genai": {
+ "optional": true
+ },
+ "@langchain/google-vertexai": {
+ "optional": true
+ },
+ "@langchain/google-vertexai-web": {
+ "optional": true
+ },
+ "@langchain/groq": {
+ "optional": true
+ },
+ "@langchain/mistralai": {
+ "optional": true
+ },
+ "@langchain/ollama": {
+ "optional": true
+ },
+ "@langchain/xai": {
+ "optional": true
+ },
+ "axios": {
+ "optional": true
+ },
+ "cheerio": {
+ "optional": true
+ },
+ "handlebars": {
+ "optional": true
+ },
+ "peggy": {
+ "optional": true
+ },
+ "typeorm": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/langchain/node_modules/js-yaml": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/langchain/node_modules/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/langchain/node_modules/yaml": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
+ "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ }
+ },
+ "node_modules/langchain/node_modules/zod": {
+ "version": "3.25.76",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/langsmith": {
+ "version": "0.3.81",
+ "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.3.81.tgz",
+ "integrity": "sha512-NFmp7TDrrbCE6TIfHqutN9xhdgvx0EOhULVo8bDW+ib5idprwjMTvmS0S1n9uVFwjN03zU2zVEWViXnwy5XPrw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/uuid": "^10.0.0",
+ "chalk": "^4.1.2",
+ "console-table-printer": "^2.12.1",
+ "p-queue": "^6.6.2",
+ "p-retry": "4",
+ "semver": "^7.6.3",
+ "uuid": "^10.0.0"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "*",
+ "@opentelemetry/exporter-trace-otlp-proto": "*",
+ "@opentelemetry/sdk-trace-base": "*",
+ "openai": "*"
+ },
+ "peerDependenciesMeta": {
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@opentelemetry/exporter-trace-otlp-proto": {
+ "optional": true
+ },
+ "@opentelemetry/sdk-trace-base": {
+ "optional": true
+ },
+ "openai": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/langsmith/node_modules/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/lerna": {
+ "version": "9.0.3",
+ "resolved": "https://registry.npmjs.org/lerna/-/lerna-9.0.3.tgz",
+ "integrity": "sha512-wCsJWKX8FaGJoWX2K5gL5q7ReqQNxNsS92AW5glBe/JzWEtoM/jgXXGrEzQzORMb8rTXYFjUjpn60et+i8XugA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@lerna/create": "9.0.3",
+ "@npmcli/arborist": "9.1.6",
+ "@npmcli/package-json": "7.0.2",
+ "@npmcli/run-script": "10.0.2",
+ "@nx/devkit": ">=21.5.2 < 23.0.0",
+ "@octokit/plugin-enterprise-rest": "6.0.1",
+ "@octokit/rest": "20.1.2",
+ "aproba": "2.0.0",
+ "byte-size": "8.1.1",
+ "chalk": "4.1.0",
+ "cmd-shim": "6.0.3",
+ "color-support": "1.1.3",
+ "columnify": "1.6.0",
+ "console-control-strings": "^1.1.0",
+ "conventional-changelog-angular": "7.0.0",
+ "conventional-changelog-core": "5.0.1",
+ "conventional-recommended-bump": "7.0.1",
+ "cosmiconfig": "9.0.0",
+ "dedent": "1.5.3",
+ "envinfo": "7.13.0",
+ "execa": "5.0.0",
+ "fs-extra": "^11.2.0",
+ "get-port": "5.1.1",
+ "get-stream": "6.0.0",
+ "git-url-parse": "14.0.0",
+ "glob-parent": "6.0.2",
+ "has-unicode": "2.0.1",
+ "import-local": "3.1.0",
+ "ini": "^1.3.8",
+ "init-package-json": "8.2.2",
+ "inquirer": "12.9.6",
+ "is-ci": "3.0.1",
+ "is-stream": "2.0.0",
+ "jest-diff": ">=30.0.0 < 31",
+ "js-yaml": "4.1.1",
+ "libnpmaccess": "10.0.3",
+ "libnpmpublish": "11.1.2",
+ "load-json-file": "6.2.0",
+ "make-dir": "4.0.0",
+ "make-fetch-happen": "15.0.2",
+ "minimatch": "3.0.5",
+ "multimatch": "5.0.0",
+ "npm-package-arg": "13.0.1",
+ "npm-packlist": "10.0.3",
+ "npm-registry-fetch": "19.1.0",
+ "nx": ">=21.5.3 < 23.0.0",
+ "p-map": "4.0.0",
+ "p-map-series": "2.1.0",
+ "p-pipe": "3.1.0",
+ "p-queue": "6.6.2",
+ "p-reduce": "2.1.0",
+ "p-waterfall": "2.1.1",
+ "pacote": "21.0.1",
+ "pify": "5.0.0",
+ "read-cmd-shim": "4.0.0",
"resolve-from": "5.0.0",
"rimraf": "^4.4.1",
"semver": "7.7.2",
@@ -29232,6 +29708,13 @@
}
}
},
+ "node_modules/openapi-types": {
+ "version": "12.1.3",
+ "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
+ "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/opentracing": {
"version": "0.14.7",
"resolved": "https://registry.npmjs.org/opentracing/-/opentracing-0.14.7.tgz",
@@ -29442,6 +29925,30 @@
"node": ">=8"
}
},
+ "node_modules/p-retry": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
+ "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/retry": "0.12.0",
+ "retry": "^0.13.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-retry/node_modules/retry": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+ "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
"node_modules/p-timeout": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz",
@@ -29980,7 +30487,6 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
- "dev": true,
"license": "MIT"
},
"node_modules/path-scurry": {
@@ -31516,6 +32022,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/regexpp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
+ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ }
+ },
"node_modules/regexpu-core": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz",
@@ -31627,7 +32146,6 @@
"version": "1.22.11",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz",
"integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"is-core-module": "^2.16.1",
@@ -32871,6 +33389,13 @@
"integrity": "sha512-uEv/AFO0ADI7d99OHDmh1QfYzQk/izT1vCmu/riQfh7qjBVUUgRT87E5s5h7CxWCA/+YoZerykpEthzVrW3LIw==",
"dev": true
},
+ "node_modules/simple-wcswidth": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/simple-wcswidth/-/simple-wcswidth-1.1.2.tgz",
+ "integrity": "sha512-j7piyCjAeTDSjzTSQ7DokZtMNwNlEAyxqSZeCS+CXH7fJ4jx3FuJ/mTW3mE+6JLs4VJBbcll0Kjn+KXI5t21Iw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/sinon": {
"version": "15.2.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.2.0.tgz",
@@ -34325,7 +34850,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -35454,6 +35978,29 @@
"node": ">=0.6.x"
}
},
+ "node_modules/tsutils": {
+ "version": "3.21.0",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz",
+ "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^1.8.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ },
+ "peerDependencies": {
+ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
+ }
+ },
+ "node_modules/tsutils/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true,
+ "license": "0BSD"
+ },
"node_modules/tuf-js": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-4.0.0.tgz",
@@ -38343,6 +38890,363 @@
"node": ">= 0.6"
}
},
+ "packages/instrumentation-langchain": {
+ "name": "@opentelemetry/instrumentation-langchain",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@opentelemetry/instrumentation": "^0.205.0"
+ },
+ "devDependencies": {
+ "@opentelemetry/api": "^1.3.0",
+ "@opentelemetry/contrib-test-utils": "^0.55.0",
+ "@opentelemetry/sdk-logs": "^0.208.0",
+ "@opentelemetry/sdk-trace-base": "^2.0.0",
+ "@opentelemetry/sdk-trace-node": "^2.0.0",
+ "@types/node": "18.18.14",
+ "@typescript-eslint/eslint-plugin": "5.8.1",
+ "@typescript-eslint/parser": "5.8.1",
+ "cross-env": "7.0.3",
+ "expect": "29.2.0",
+ "langchain": "^0.3.0",
+ "nock": "^14.0.0",
+ "nyc": "17.1.0",
+ "rimraf": "5.0.10",
+ "sinon": "15.2.0",
+ "test-all-versions": "6.1.0",
+ "typescript": "5.0.4"
+ },
+ "engines": {
+ "node": "^18.19.0 || >=20.6.0"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "^1.3.0"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@opentelemetry/api-logs": {
+ "version": "0.205.0",
+ "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.205.0.tgz",
+ "integrity": "sha512-wBlPk1nFB37Hsm+3Qy73yQSobVn28F4isnWIBvKpd5IUH/eat8bwcL02H9yzmHyyPmukeccSl2mbN5sDQZYnPg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@opentelemetry/api": "^1.3.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@opentelemetry/instrumentation": {
+ "version": "0.205.0",
+ "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.205.0.tgz",
+ "integrity": "sha512-cgvm7tvQdu9Qo7VurJP84wJ7ZV9F6WqDDGZpUc6rUEXwjV7/bXWs0kaYp9v+1Vh1+3TZCD3i6j/lUBcPhu8NhA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@opentelemetry/api-logs": "0.205.0",
+ "import-in-the-middle": "^1.8.1",
+ "require-in-the-middle": "^7.1.1"
+ },
+ "engines": {
+ "node": "^18.19.0 || >=20.6.0"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "^1.3.0"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@types/node": {
+ "version": "18.18.14",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz",
+ "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/eslint-plugin": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.1.tgz",
+ "integrity": "sha512-wTZ5oEKrKj/8/366qTM366zqhIKAp6NCMweoRONtfuC07OAU9nVI2GZZdqQ1qD30WAAtcPdkH+npDwtRFdp4Rw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/experimental-utils": "5.8.1",
+ "@typescript-eslint/scope-manager": "5.8.1",
+ "debug": "^4.3.2",
+ "functional-red-black-tree": "^1.0.1",
+ "ignore": "^5.1.8",
+ "regexpp": "^3.2.0",
+ "semver": "^7.3.5",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/parser": "^5.0.0",
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/parser": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.1.tgz",
+ "integrity": "sha512-K1giKHAjHuyB421SoXMXFHHVI4NdNY603uKw92++D3qyxSeYvC10CBJ/GE5Thpo4WTUvu1mmJI2/FFkz38F2Gw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/scope-manager": "5.8.1",
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/typescript-estree": "5.8.1",
+ "debug": "^4.3.2"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.1.tgz",
+ "integrity": "sha512-DGxJkNyYruFH3NIZc3PwrzwOQAg7vvgsHsHCILOLvUpupgkwDZdNq/cXU3BjF4LNrCsVg0qxEyWasys5AiJ85Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/visitor-keys": "5.8.1"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/types": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.1.tgz",
+ "integrity": "sha512-L/FlWCCgnjKOLefdok90/pqInkomLnAcF9UAzNr+DSqMC3IffzumHTQTrINXhP1gVp9zlHiYYjvozVZDPleLcA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.1.tgz",
+ "integrity": "sha512-26lQ8l8tTbG7ri7xEcCFT9ijU5Fk+sx/KRRyyzCv7MQ+rZZlqiDPtMKWLC8P7o+dtCnby4c+OlxuX1tp8WfafQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "@typescript-eslint/visitor-keys": "5.8.1",
+ "debug": "^4.3.2",
+ "globby": "^11.0.4",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.5",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.1.tgz",
+ "integrity": "sha512-SWgiWIwocK6NralrJarPZlWdr0hZnj5GXHIgfdm8hNkyKvpeQuFyLP6YjSIe9kf3YBIfU6OHSZLYkQ+smZwtNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.8.1",
+ "eslint-visitor-keys": "^3.0.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/cli-spinners": {
+ "version": "2.9.2",
+ "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",
+ "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/cross-env": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
+ "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "^7.0.1"
+ },
+ "bin": {
+ "cross-env": "src/bin/cross-env.js",
+ "cross-env-shell": "src/bin/cross-env-shell.js"
+ },
+ "engines": {
+ "node": ">=10.14",
+ "npm": ">=6",
+ "yarn": ">=1"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/expect": {
+ "version": "29.2.0",
+ "resolved": "https://registry.npmjs.org/expect/-/expect-29.2.0.tgz",
+ "integrity": "sha512-03ClF3GWwUqd9Grgkr9ZSdaCJGMRA69PQ8jT7o+Bx100VlGiAFf9/8oIm9Qve7ZVJhuJxFftqFhviZJRxxNfvg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/expect-utils": "^29.2.0",
+ "jest-get-type": "^29.2.0",
+ "jest-matcher-utils": "^29.2.0",
+ "jest-message-util": "^29.2.0",
+ "jest-util": "^29.2.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/import-in-the-middle": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.15.0.tgz",
+ "integrity": "sha512-bpQy+CrsRmYmoPMAE/0G33iwRqwW4ouqdRg8jgbH3aKuCtOc8lxgmYXg2dMM92CRiGP660EtBcymH/eVUpCSaA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "acorn": "^8.14.0",
+ "acorn-import-attributes": "^1.9.5",
+ "cjs-module-lexer": "^1.2.2",
+ "module-details-from-path": "^1.0.3"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/js-yaml": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/npm-package-versions": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/npm-package-versions/-/npm-package-versions-1.0.1.tgz",
+ "integrity": "sha512-iEiETp11ZuiWKAlLRBaUD3zKjZTzAco3xrkCbIJaxs+iu2+zIbaKXdVpzmsjyDCe0r7IpDW55iAyVHzktTg5DA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "packages/instrumentation-langchain/node_modules/require-in-the-middle": {
+ "version": "7.5.2",
+ "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-7.5.2.tgz",
+ "integrity": "sha512-gAZ+kLqBdHarXB64XpAe2VCjB7rIRv+mU8tfRWziHRJ5umKsIHN2tLLv6EtMw7WCdP19S0ERVMldNvxYCHnhSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.3.5",
+ "module-details-from-path": "^1.0.3",
+ "resolve": "^1.22.8"
+ },
+ "engines": {
+ "node": ">=8.6.0"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/test-all-versions": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/test-all-versions/-/test-all-versions-6.1.0.tgz",
+ "integrity": "sha512-yHToQ8ydEEFLu7ockssvozXofpUn6KDU5l+XpblsDuOtZz+KZL8TsdUvoUEpBDa/p7lzubI62LFjh1fB8yWeiQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "after-all-results": "^2.0.0",
+ "ansi-diff-stream": "^1.2.1",
+ "cli-spinners": "^2.9.2",
+ "deepmerge": "^4.3.1",
+ "import-fresh": "^3.3.0",
+ "is-ci": "^3.0.1",
+ "js-yaml": "^4.1.0",
+ "log-symbols": "^4.1.0",
+ "minimist": "^1.2.8",
+ "npm-package-versions": "^1.0.1",
+ "once": "^1.4.0",
+ "parse-env-string": "^1.0.1",
+ "resolve": "^1.22.8",
+ "semver": "^7.5.4",
+ "spawn-npm-install": "^1.2.0",
+ "which": "^2.0.2"
+ },
+ "bin": {
+ "tav": "index.js"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "packages/instrumentation-langchain/node_modules/undici-types": {
+ "version": "5.26.5",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
+ "dev": true,
+ "license": "MIT"
+ },
"packages/instrumentation-long-task": {
"name": "@opentelemetry/instrumentation-long-task",
"version": "0.53.0",
diff --git a/packages/instrumentation-langchain/.tav.yml b/packages/instrumentation-langchain/.tav.yml
new file mode 100644
index 0000000000..7930b0588f
--- /dev/null
+++ b/packages/instrumentation-langchain/.tav.yml
@@ -0,0 +1,5 @@
+langchain:
+ versions:
+ include: '>=0.1.0'
+ mode: max-5
+ commands: npm test
diff --git a/packages/instrumentation-langchain/CHANGELOG.md b/packages/instrumentation-langchain/CHANGELOG.md
new file mode 100644
index 0000000000..df24a4ba01
--- /dev/null
+++ b/packages/instrumentation-langchain/CHANGELOG.md
@@ -0,0 +1,7 @@
+# Changelog
+
+## 0.1.0
+
+### Added
+
+- Initial skeleton for LangChain.js instrumentation [#3132](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/3132)
diff --git a/packages/instrumentation-langchain/LICENSE b/packages/instrumentation-langchain/LICENSE
new file mode 100644
index 0000000000..261eeb9e9f
--- /dev/null
+++ b/packages/instrumentation-langchain/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/instrumentation-langchain/README.md b/packages/instrumentation-langchain/README.md
new file mode 100644
index 0000000000..e6fefc816f
--- /dev/null
+++ b/packages/instrumentation-langchain/README.md
@@ -0,0 +1,65 @@
+# OpenTelemetry LangChain Instrumentation for Node.js
+
+[![NPM Published Version][npm-img]][npm-url]
+[![Apache License][license-image]][license-image]
+
+This module provides automatic instrumentation for the [`langchain`](https://www.npmjs.com/package/langchain) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package.
+
+Compatible with OpenTelemetry JS API and SDK `1.0+`.
+
+## Installation
+
+```bash
+npm install --save @opentelemetry/instrumentation-langchain
+```
+
+## Supported Versions
+
+- [`langchain`](https://www.npmjs.com/package/langchain) versions >= `0.1.0`
+
+## Usage
+
+```js
+const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
+const { LangChainInstrumentation } = require('@opentelemetry/instrumentation-langchain');
+const { registerInstrumentations } = require('@opentelemetry/instrumentation');
+
+const provider = new NodeTracerProvider();
+provider.register();
+
+registerInstrumentations({
+ instrumentations: [
+ new LangChainInstrumentation({
+ // Configuration options
+ captureMessageContent: false, // Set to true to capture prompt/completion content
+ }),
+ // other instrumentations
+ ],
+});
+```
+
+## Configuration Options
+
+| Option | Type | Default | Description |
+|-------------------------|-----------|---------|----------------------------------------|
+| `captureMessageContent` | `boolean` | `false` | Capture prompt and completion content. |
+
+## Semantic Conventions
+
+This package implements Semantic Convention [Version 1.38.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/README.md).
+
+## Useful links
+
+- For more information on OpenTelemetry, visit:
+- For more about OpenTelemetry JavaScript:
+- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
+
+## License
+
+Apache 2.0 - See [LICENSE][license-url] for more information.
+
+[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
+[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
+[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
+[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-langchain
+[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-langchain.svg
diff --git a/packages/instrumentation-langchain/package.json b/packages/instrumentation-langchain/package.json
new file mode 100644
index 0000000000..77f1c3ed13
--- /dev/null
+++ b/packages/instrumentation-langchain/package.json
@@ -0,0 +1,72 @@
+{
+ "name": "@opentelemetry/instrumentation-langchain",
+ "version": "0.1.0",
+ "description": "OpenTelemetry instrumentation for the `langchain` LangChain.js library",
+ "main": "build/src/index.js",
+ "types": "build/src/index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/open-telemetry/opentelemetry-js-contrib.git",
+ "directory": "packages/instrumentation-langchain"
+ },
+ "scripts": {
+ "clean": "rimraf build/*",
+ "compile": "tsc -p .",
+ "lint": "eslint . --ext=ts,js,mjs",
+ "lint:fix": "eslint . --ext=ts,js,mjs --fix",
+ "lint:readme": "node ../../scripts/lint-readme.js",
+ "prepublishOnly": "npm run compile",
+ "tdd": "npm run test -- --watch-extensions ts --watch",
+ "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
+ "test-all-versions": "tav",
+ "version:update": "node ../../scripts/version-update.js",
+ "watch": "tsc -w"
+ },
+ "keywords": [
+ "instrumentation",
+ "opentelemetry",
+ "observability",
+ "langchain",
+ "llm",
+ "genai"
+ ],
+ "author": "OpenTelemetry Authors",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.19.0 || >=20.6.0"
+ },
+ "files": [
+ "build/src/**/*.js",
+ "build/src/**/*.js.map",
+ "build/src/**/*.d.ts"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "^1.3.0"
+ },
+ "devDependencies": {
+ "@opentelemetry/api": "^1.3.0",
+ "@opentelemetry/contrib-test-utils": "^0.55.0",
+ "@opentelemetry/sdk-logs": "^0.208.0",
+ "@opentelemetry/sdk-trace-base": "^2.0.0",
+ "@opentelemetry/sdk-trace-node": "^2.0.0",
+ "@types/node": "18.18.14",
+ "@typescript-eslint/eslint-plugin": "5.8.1",
+ "@typescript-eslint/parser": "5.8.1",
+ "cross-env": "7.0.3",
+ "expect": "29.2.0",
+ "langchain": "^0.3.0",
+ "nock": "^14.0.0",
+ "nyc": "17.1.0",
+ "rimraf": "5.0.10",
+ "sinon": "15.2.0",
+ "test-all-versions": "6.1.0",
+ "typescript": "5.0.4"
+ },
+ "dependencies": {
+ "@opentelemetry/instrumentation": "^0.205.0"
+ },
+ "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-langchain#readme"
+}
diff --git a/packages/instrumentation-langchain/src/index.ts b/packages/instrumentation-langchain/src/index.ts
new file mode 100644
index 0000000000..e00052f4a2
--- /dev/null
+++ b/packages/instrumentation-langchain/src/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export { LangChainInstrumentation } from './instrumentation';
+export type { LangChainInstrumentationConfig } from './types';
diff --git a/packages/instrumentation-langchain/src/instrumentation.ts b/packages/instrumentation-langchain/src/instrumentation.ts
new file mode 100644
index 0000000000..4de90c494b
--- /dev/null
+++ b/packages/instrumentation-langchain/src/instrumentation.ts
@@ -0,0 +1,69 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {
+ InstrumentationBase,
+ InstrumentationNodeModuleDefinition,
+} from '@opentelemetry/instrumentation';
+/** @knipignore */
+import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
+import { LangChainInstrumentationConfig } from './types';
+
+export class LangChainInstrumentation extends InstrumentationBase {
+ constructor(config: LangChainInstrumentationConfig = {}) {
+ super(PACKAGE_NAME, PACKAGE_VERSION, config);
+ }
+
+ // Override InstrumentationAbstract.setConfig so we can normalize config.
+ override setConfig(config: LangChainInstrumentationConfig = {}) {
+ const { captureMessageContent, ...validConfig } = config;
+ (validConfig as LangChainInstrumentationConfig).captureMessageContent =
+ !!captureMessageContent;
+ super.setConfig(validConfig);
+ }
+
+ protected init() {
+ return [
+ new InstrumentationNodeModuleDefinition(
+ 'langchain',
+ ['>=0.1.0'],
+ /* istanbul ignore next */
+ modExports => {
+ this._diag.debug('Applying LangChain instrumentation');
+ // TODO: Add instrumentation patches here
+ return modExports;
+ },
+ /* istanbul ignore next */
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ modExports => {
+ this._diag.debug('Removing LangChain instrumentation');
+ // TODO: Add unwrap calls here, e.g.:
+ // this._unwrap(modExports.SomeClass.prototype, 'someMethod');
+ }
+ ),
+ ];
+ }
+
+ // This is a 'protected' method on class `InstrumentationAbstract`.
+ override _updateMetricInstruments() {
+ // TODO: Create metric instruments here if needed
+ // Example:
+ // this._genaiClientOperationDuration = this.meter.createHistogram(
+ // METRIC_GEN_AI_CLIENT_OPERATION_DURATION,
+ // { description: 'GenAI operation duration', unit: 's' }
+ // );
+ }
+}
diff --git a/packages/instrumentation-langchain/src/types.ts b/packages/instrumentation-langchain/src/types.ts
new file mode 100644
index 0000000000..ec47b882ea
--- /dev/null
+++ b/packages/instrumentation-langchain/src/types.ts
@@ -0,0 +1,25 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { InstrumentationConfig } from '@opentelemetry/instrumentation';
+
+export interface LangChainInstrumentationConfig extends InstrumentationConfig {
+ /**
+ * Set to true to enable capture of content data, such as prompt and
+ * completion content, tool call function arguments, etc. By default, this is
+ * `false` to avoid possible exposure of sensitive data.
+ */
+ captureMessageContent?: boolean;
+}
diff --git a/packages/instrumentation-langchain/test/instrumentation.test.ts b/packages/instrumentation-langchain/test/instrumentation.test.ts
new file mode 100644
index 0000000000..acdece6202
--- /dev/null
+++ b/packages/instrumentation-langchain/test/instrumentation.test.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { LangChainInstrumentation } from '../src';
+import { expect } from 'expect';
+
+describe('LangChainInstrumentation', () => {
+ let instrumentation: LangChainInstrumentation;
+
+ beforeEach(() => {
+ instrumentation = new LangChainInstrumentation();
+ });
+
+ afterEach(() => {
+ instrumentation.disable();
+ });
+
+ describe('constructor', () => {
+ it('should create an instance', () => {
+ expect(instrumentation).toBeInstanceOf(LangChainInstrumentation);
+ });
+
+ it('should have correct instrumentationName', () => {
+ expect(instrumentation.instrumentationName).toBe(
+ '@opentelemetry/instrumentation-langchain'
+ );
+ });
+ });
+
+ describe('setConfig', () => {
+ it('should normalize captureMessageContent config', () => {
+ const instr = new LangChainInstrumentation({
+ captureMessageContent: true,
+ });
+ const config = instr.getConfig();
+ expect(config.captureMessageContent).toBe(true);
+ instr.disable();
+ });
+
+ it('should default captureMessageContent to false', () => {
+ const config = instrumentation.getConfig();
+ expect(config.captureMessageContent).toBe(false);
+ });
+ });
+});
diff --git a/packages/instrumentation-langchain/test/load-instrumentation.ts b/packages/instrumentation-langchain/test/load-instrumentation.ts
new file mode 100644
index 0000000000..12eba7873f
--- /dev/null
+++ b/packages/instrumentation-langchain/test/load-instrumentation.ts
@@ -0,0 +1,28 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This file is used to load the instrumentation before running tests.
+ * It ensures that the instrumentation is loaded and registered before any
+ * other modules are imported.
+ */
+
+import { LangChainInstrumentation } from '../src';
+import { registerInstrumentations } from '@opentelemetry/instrumentation';
+
+registerInstrumentations({
+ instrumentations: [new LangChainInstrumentation()],
+});
diff --git a/packages/instrumentation-langchain/tsconfig.json b/packages/instrumentation-langchain/tsconfig.json
new file mode 100644
index 0000000000..4078877ce6
--- /dev/null
+++ b/packages/instrumentation-langchain/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../tsconfig.base",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ]
+}
diff --git a/release-please-config.json b/release-please-config.json
index 14cbc77446..5c5e27006f 100644
--- a/release-please-config.json
+++ b/release-please-config.json
@@ -53,6 +53,9 @@
"packages/instrumentation-ioredis": {},
"packages/instrumentation-knex": {},
"packages/instrumentation-koa": {},
+ "packages/instrumentation-langchain": {
+ "skip-github-release": true
+ },
"packages/instrumentation-memcached": {},
"packages/instrumentation-mongodb": {},
"packages/instrumentation-mysql": {},