diff --git a/CHANGELOG.md b/CHANGELOG.md index 744ffc50..9306b631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.11.4](https://github.com/traceloop/openllmetry-js/compare/v0.11.3...v0.11.4) (2024-11-13) + +### Bug Fixes + +- **langchain:** return exports in langchain runnables module patch ([#470](https://github.com/traceloop/openllmetry-js/issues/470)) ([23fdb28](https://github.com/traceloop/openllmetry-js/commit/23fdb28ab5d7d70a963559b26aae31dde8347082)) +- **vertex-ai:** missing system prompt ([#473](https://github.com/traceloop/openllmetry-js/issues/473)) ([663e438](https://github.com/traceloop/openllmetry-js/commit/663e438c5bce18b8fa20c16b7f6d53355bb7b7f9)) + ## [0.11.3](https://github.com/traceloop/openllmetry-js/compare/v0.11.2...v0.11.3) (2024-10-16) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 4a9996bf..4d5d5ee0 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "0.11.3", + "version": "0.11.4", "packages": ["packages/*"], "useNx": true } diff --git a/package-lock.json b/package-lock.json index bab50026..b1fd6a55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7364,9 +7364,10 @@ } }, "node_modules/@google-cloud/aiplatform": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/@google-cloud/aiplatform/-/aiplatform-3.14.0.tgz", - "integrity": "sha512-Ajfbgj4YMn1xmHHwDSxgMxDB5LV3uXSd2KOwD5kvaaMkden2kJPhIhDNFyjYpeytrY+dFnGX+LlKm/Xv5H92Rg==", + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/@google-cloud/aiplatform/-/aiplatform-3.32.0.tgz", + "integrity": "sha512-Ujvvpp5YWGRV2PzeJnZQfIkWiKtivVMxAsAmeWGOoMKfKzrUPqMc6ZL8kAc+ZuPjw3pZELjKzET0oylPrQGF2A==", + "license": "Apache-2.0", "dependencies": { "google-gax": "^4.0.3", "protobuf.js": "^1.1.2" @@ -7376,9 +7377,10 @@ } }, "node_modules/@google-cloud/vertexai": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@google-cloud/vertexai/-/vertexai-1.2.0.tgz", - "integrity": "sha512-EH0dnoMRIBQzJEEOUWN03eWPSdLBFdsZA/am3eU+qYrnNyY9okUueOajZd79U48KwgFbqoFrCA9yHQ30DgfD8Q==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@google-cloud/vertexai/-/vertexai-1.9.0.tgz", + "integrity": "sha512-8brlcJwFXI4fPuBtsDNQqCdWZmz8gV9jeEKOU0vc5H2SjehCQpXK/NwuSEr916zbhlBHtg/sU37qQQdgvh5BRA==", + "license": "Apache-2.0", "dependencies": { "google-auth-library": "^9.1.0" }, @@ -27977,7 +27979,7 @@ }, "packages/instrumentation-langchain": { "name": "@traceloop/instrumentation-langchain", - "version": "0.11.1", + "version": "0.11.4", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -29325,7 +29327,7 @@ }, "packages/instrumentation-vertexai": { "name": "@traceloop/instrumentation-vertexai", - "version": "0.11.1", + "version": "0.11.4", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -29349,8 +29351,8 @@ "@anthropic-ai/sdk": "^0.27.1", "@aws-sdk/client-bedrock-runtime": "^3.499.0", "@azure/openai": "^1.0.0-beta.11", - "@google-cloud/aiplatform": "^3.10.0", - "@google-cloud/vertexai": "^1.2.0", + "@google-cloud/aiplatform": "^3.32.0", + "@google-cloud/vertexai": "^1.9.0", "@langchain/community": "^0.2.31", "@pinecone-database/pinecone": "^2.0.1", "@traceloop/node-server-sdk": "*", @@ -30361,7 +30363,7 @@ }, "packages/traceloop-sdk": { "name": "@traceloop/node-server-sdk", - "version": "0.11.3", + "version": "0.11.4", "license": "Apache-2.0", "dependencies": { "@opentelemetry/exporter-trace-otlp-proto": "^0.53.0", @@ -30372,12 +30374,12 @@ "@traceloop/instrumentation-bedrock": "^0.11.1", "@traceloop/instrumentation-chromadb": "^0.11.3", "@traceloop/instrumentation-cohere": "^0.11.1", - "@traceloop/instrumentation-langchain": "^0.11.1", + "@traceloop/instrumentation-langchain": "^0.11.4", "@traceloop/instrumentation-llamaindex": "^0.11.1", "@traceloop/instrumentation-openai": "^0.11.3", "@traceloop/instrumentation-pinecone": "^0.11.1", "@traceloop/instrumentation-qdrant": "^0.11.1", - "@traceloop/instrumentation-vertexai": "^0.11.1", + "@traceloop/instrumentation-vertexai": "^0.11.4", "@types/nunjucks": "^3.2.5", "cross-fetch": "^4.0.0", "fetch-retry": "^5.0.6", diff --git a/packages/instrumentation-langchain/CHANGELOG.md b/packages/instrumentation-langchain/CHANGELOG.md index b8648ebf..55410524 100644 --- a/packages/instrumentation-langchain/CHANGELOG.md +++ b/packages/instrumentation-langchain/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.11.4](https://github.com/traceloop/openllmetry-js/compare/v0.11.3...v0.11.4) (2024-11-13) + +### Bug Fixes + +- **langchain:** return exports in langchain runnables module patch ([#470](https://github.com/traceloop/openllmetry-js/issues/470)) ([23fdb28](https://github.com/traceloop/openllmetry-js/commit/23fdb28ab5d7d70a963559b26aae31dde8347082)) + ## [0.11.1](https://github.com/traceloop/openllmetry-js/compare/v0.11.0...v0.11.1) (2024-08-31) ### Bug Fixes diff --git a/packages/instrumentation-langchain/package.json b/packages/instrumentation-langchain/package.json index 90dcfc1d..fcfd0860 100644 --- a/packages/instrumentation-langchain/package.json +++ b/packages/instrumentation-langchain/package.json @@ -1,6 +1,6 @@ { "name": "@traceloop/instrumentation-langchain", - "version": "0.11.1", + "version": "0.11.4", "description": "OpenTelemetry instrumentation for LangchainJS", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/packages/instrumentation-langchain/src/instrumentation.ts b/packages/instrumentation-langchain/src/instrumentation.ts index 313b07b0..aeeda54d 100644 --- a/packages/instrumentation-langchain/src/instrumentation.ts +++ b/packages/instrumentation-langchain/src/instrumentation.ts @@ -190,6 +190,7 @@ export class LangChainInstrumentation extends InstrumentationBase { "invoke", taskWrapper(() => this.tracer, this._shouldSendPrompts()), ); + return moduleExports; } private unpatchChainModule( diff --git a/packages/instrumentation-vertexai/CHANGELOG.md b/packages/instrumentation-vertexai/CHANGELOG.md index 7aea4a8b..4f371b85 100644 --- a/packages/instrumentation-vertexai/CHANGELOG.md +++ b/packages/instrumentation-vertexai/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.11.4](https://github.com/traceloop/openllmetry-js/compare/v0.11.3...v0.11.4) (2024-11-13) + +### Bug Fixes + +- **vertex-ai:** missing system prompt ([#473](https://github.com/traceloop/openllmetry-js/issues/473)) ([663e438](https://github.com/traceloop/openllmetry-js/commit/663e438c5bce18b8fa20c16b7f6d53355bb7b7f9)) + ## [0.11.1](https://github.com/traceloop/openllmetry-js/compare/v0.11.0...v0.11.1) (2024-08-31) ### Bug Fixes diff --git a/packages/instrumentation-vertexai/package.json b/packages/instrumentation-vertexai/package.json index 12498fdd..2267edc2 100644 --- a/packages/instrumentation-vertexai/package.json +++ b/packages/instrumentation-vertexai/package.json @@ -1,6 +1,6 @@ { "name": "@traceloop/instrumentation-vertexai", - "version": "0.11.1", + "version": "0.11.4", "description": "Google's VertexAI Instrumentation", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/packages/instrumentation-vertexai/src/vertexai-instrumentation.ts b/packages/instrumentation-vertexai/src/vertexai-instrumentation.ts index 2bdfea83..00a5bf40 100644 --- a/packages/instrumentation-vertexai/src/vertexai-instrumentation.ts +++ b/packages/instrumentation-vertexai/src/vertexai-instrumentation.ts @@ -157,10 +157,22 @@ export class VertexAIInstrumentation extends InstrumentationBase { } if (this._shouldSendPrompts() && "contents" in params) { - attributes[`${SpanAttributes.LLM_PROMPTS}.0.role`] = - params.contents[0].role ?? "user"; - attributes[`${SpanAttributes.LLM_PROMPTS}.0.content`] = - this._formatPartsData(params.contents[0].parts); + let i = 0; + + if (instance["systemInstruction"]) { + attributes[`${SpanAttributes.LLM_PROMPTS}.${i}.role`] = "system"; + attributes[`${SpanAttributes.LLM_PROMPTS}.${i}.content`] = + this._formatPartsData(instance["systemInstruction"].parts); + + i++; + } + + params.contents.forEach((content, j) => { + attributes[`${SpanAttributes.LLM_PROMPTS}.${i + j}.role`] = + content.role ?? "user"; + attributes[`${SpanAttributes.LLM_PROMPTS}.${i + j}.content`] = + this._formatPartsData(content.parts); + }); } } catch (e) { this._diag.debug(e); diff --git a/packages/sample-app/package.json b/packages/sample-app/package.json index 738cc19d..9222f8c0 100644 --- a/packages/sample-app/package.json +++ b/packages/sample-app/package.json @@ -36,8 +36,8 @@ "@anthropic-ai/sdk": "^0.27.1", "@aws-sdk/client-bedrock-runtime": "^3.499.0", "@azure/openai": "^1.0.0-beta.11", - "@google-cloud/aiplatform": "^3.10.0", - "@google-cloud/vertexai": "^1.2.0", + "@google-cloud/aiplatform": "^3.32.0", + "@google-cloud/vertexai": "^1.9.0", "@langchain/community": "^0.2.31", "@pinecone-database/pinecone": "^2.0.1", "@traceloop/node-server-sdk": "*", diff --git a/packages/sample-app/src/vertexai/gemini.ts b/packages/sample-app/src/vertexai/gemini.ts index b5b2afe5..f88c9dff 100644 --- a/packages/sample-app/src/vertexai/gemini.ts +++ b/packages/sample-app/src/vertexai/gemini.ts @@ -20,6 +20,10 @@ async function createNonStreamingContent() { // Instantiate the model const generativeModel = vertexAI.getGenerativeModel({ model: "gemini-1.5-flash", + systemInstruction: { + role: "system", + parts: [{ text: "You are a helpful assistant" }], + }, }); const request = { @@ -53,6 +57,10 @@ async function createStreamingContent() { // Instantiate the model const generativeModel = vertexAI.getGenerativeModel({ model: "gemini-1.5-flash", + systemInstruction: { + role: "system", + parts: [{ text: "You are a helpful assistant" }], + }, }); const request = { diff --git a/packages/traceloop-sdk/CHANGELOG.md b/packages/traceloop-sdk/CHANGELOG.md index d240a958..56e61218 100644 --- a/packages/traceloop-sdk/CHANGELOG.md +++ b/packages/traceloop-sdk/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.11.4](https://github.com/traceloop/openllmetry-js/compare/v0.11.3...v0.11.4) (2024-11-13) + +**Note:** Version bump only for package @traceloop/node-server-sdk + ## [0.11.3](https://github.com/traceloop/openllmetry-js/compare/v0.11.2...v0.11.3) (2024-10-16) **Note:** Version bump only for package @traceloop/node-server-sdk diff --git a/packages/traceloop-sdk/package.json b/packages/traceloop-sdk/package.json index 1e3a6b9e..6f38ef82 100644 --- a/packages/traceloop-sdk/package.json +++ b/packages/traceloop-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@traceloop/node-server-sdk", - "version": "0.11.3", + "version": "0.11.4", "description": "Traceloop Software Development Kit (SDK) for Node.js", "main": "dist/index.js", "module": "dist/index.mjs", @@ -43,12 +43,12 @@ "@traceloop/instrumentation-bedrock": "^0.11.1", "@traceloop/instrumentation-chromadb": "^0.11.3", "@traceloop/instrumentation-cohere": "^0.11.1", - "@traceloop/instrumentation-langchain": "^0.11.1", + "@traceloop/instrumentation-langchain": "^0.11.4", "@traceloop/instrumentation-llamaindex": "^0.11.1", "@traceloop/instrumentation-openai": "^0.11.3", "@traceloop/instrumentation-pinecone": "^0.11.1", "@traceloop/instrumentation-qdrant": "^0.11.1", - "@traceloop/instrumentation-vertexai": "^0.11.1", + "@traceloop/instrumentation-vertexai": "^0.11.4", "@types/nunjucks": "^3.2.5", "cross-fetch": "^4.0.0", "fetch-retry": "^5.0.6",