diff --git a/docs/_sidebar.md b/docs/_sidebar.md index db1540a9..df2852b7 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -24,3 +24,5 @@ - Others - [Integrations](integrations.md) + - [Instrumentation](instrumentation.md) + - [Native Telemetry](native-telemetry.md) diff --git a/docs/integrations.md b/docs/integrations.md index 6a9598e7..df491a18 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -54,8 +54,8 @@ const workflow = new Workflow({ }, { signal: ctx.signal, recursionLimit: 5 }, ); - const answer = response.messages.at(-1).content; - return { next: Workflow.END, update: { answer } }; + const answer = response.messages.at(-1)?.content; + return { next: Workflow.END, update: { answer: answer?.toString() } }; }); const memory = new UnconstrainedMemory(); diff --git a/docs/native-telemetry.md b/docs/native-telemetry.md index c4584ecd..95077ecd 100644 --- a/docs/native-telemetry.md +++ b/docs/native-telemetry.md @@ -21,6 +21,6 @@ We value your privacy and ensure that **no sensitive data** is collected through We understand that not all users want to send telemetry data. You can easily disable this feature by setting an environment variable: -```bash +``` BEE_FRAMEWORK_INSTRUMENTATION_METRICS_ENABLED=false ``` diff --git a/examples/integrations/langgraph.ts b/examples/integrations/langgraph.ts index 0991f5d7..8e27b05b 100644 --- a/examples/integrations/langgraph.ts +++ b/examples/integrations/langgraph.ts @@ -45,8 +45,8 @@ const workflow = new Workflow({ }, { signal: ctx.signal, recursionLimit: 5 }, ); - const answer = response.messages.at(-1).content; - return { next: Workflow.END, update: { answer } }; + const answer = response.messages.at(-1)?.content; + return { next: Workflow.END, update: { answer: answer?.toString() } }; }); const memory = new UnconstrainedMemory(); diff --git a/package.json b/package.json index 2f50ef3f..89d98997 100644 --- a/package.json +++ b/package.json @@ -167,8 +167,6 @@ }, "dependencies": { "@ai-zen/node-fetch-event-source": "^2.1.4", - "@connectrpc/connect": "^1.6.1", - "@connectrpc/connect-node": "^1.6.1", "@opentelemetry/exporter-metrics-otlp-http": "^0.54.2", "@opentelemetry/sdk-node": "^0.54.2", "@opentelemetry/semantic-conventions": "^1.27.0", diff --git a/src/instrumentation/create-telemetry-metrics-middleware.ts b/src/instrumentation/create-telemetry-metrics-middleware.ts index 1a56c2f3..e5913937 100644 --- a/src/instrumentation/create-telemetry-metrics-middleware.ts +++ b/src/instrumentation/create-telemetry-metrics-middleware.ts @@ -1,5 +1,5 @@ /** - * Copyright 2024 IBM Corp. + * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/instrumentation/opentelemetry.spec.ts b/src/instrumentation/opentelemetry.spec.ts index cadcdbfe..033c252d 100644 --- a/src/instrumentation/opentelemetry.spec.ts +++ b/src/instrumentation/opentelemetry.spec.ts @@ -1,5 +1,5 @@ /** - * Copyright 2024 IBM Corp. + * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,19 +25,26 @@ import { DuckDuckGoSearchTool } from "@/tools/search/duckDuckGoSearch.js"; import { WebCrawlerTool } from "@/tools/web/webCrawler.js"; import { ArXivTool } from "@/tools/arxiv.js"; import { CalculatorTool } from "@/tools/calculator.js"; -import { LLMTool } from "@/tools/llm.js"; import { OllamaLLM } from "@/adapters/ollama/llm.js"; import { WatsonXLLM } from "@/adapters/watsonx/llm.js"; import { LLM } from "@/llms/llm.js"; import { Emitter } from "@/emitter/emitter.js"; -import { GenerateCallbacks, LLMMeta, BaseLLMTokenizeOutput, AsyncStream } from "@/llms/base.js"; +import { + BaseLLMEvents, + LLMMeta, + BaseLLMTokenizeOutput, + AsyncStream, + EmbeddingOutput, +} from "@/llms/base.js"; import { OllamaChatLLM } from "@/adapters/ollama/chat.js"; import { TokenMemory } from "@/memory/tokenMemory.js"; -import { GraniteBeeAgent } from "@/agents/granite/agent.js"; import { SlidingCache } from "@/cache/slidingCache.js"; export class CustomLLM extends LLM { - public readonly emitter = Emitter.root.child({ + embed(): Promise { + throw new Error("Method not implemented."); + } + public readonly emitter = Emitter.root.child({ namespace: ["bam", "llm"], creator: this, }); @@ -71,7 +78,6 @@ describe("opentelemetry", () => { new WebCrawlerTool(), new ArXivTool(), new CalculatorTool(), - new LLMTool({ llm: new OllamaLLM({ modelId: "llama3.1" }) }), // llm new OllamaLLM({ modelId: "llama3.1" }), new WatsonXLLM({ modelId: "llama3.1", apiKey: "xx" }), @@ -79,7 +85,6 @@ describe("opentelemetry", () => { new OllamaChatLLM({ modelId: "llama3.1" }), // agent new BeeAgent({ llm, memory, tools: [] }), - new GraniteBeeAgent({ llm, memory, tools: [] }), ])("Should return true for '%s'", (value) => { expect(isMeasurementedInstance(value)).toBeTruthy(); }); diff --git a/src/instrumentation/sdk.ts b/src/instrumentation/sdk.ts index 07f47098..68f471a7 100644 --- a/src/instrumentation/sdk.ts +++ b/src/instrumentation/sdk.ts @@ -1,5 +1,5 @@ /** - * Copyright 2024 IBM Corp. + * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/yarn.lock b/yarn.lock index 537e80da..51212bc0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -733,27 +733,6 @@ __metadata: languageName: node linkType: hard -"@connectrpc/connect-node@npm:^1.6.1": - version: 1.6.1 - resolution: "@connectrpc/connect-node@npm:1.6.1" - dependencies: - undici: "npm:^5.28.4" - peerDependencies: - "@bufbuild/protobuf": ^1.10.0 - "@connectrpc/connect": 1.6.1 - checksum: 10c0/9891bbbe5ec155d16141e378c120dd6d4c47e1517656d4676aca762d70426a9eb3d9ec92595a7cfc4f5cbe40ff5be572d0c3d9010058107854e7f62ee05fb46e - languageName: node - linkType: hard - -"@connectrpc/connect@npm:^1.6.1": - version: 1.6.1 - resolution: "@connectrpc/connect@npm:1.6.1" - peerDependencies: - "@bufbuild/protobuf": ^1.10.0 - checksum: 10c0/35c6fd3e33c3a1ff9dce230b059ecd7991ef0dc60c16fb898e5c46b930a01077ac0b34d53d6742cc8ed079f20f8eacc7c77a8620aeec9efaf68950494f387011 - languageName: node - linkType: hard - "@conventional-changelog/git-client@npm:^1.0.0": version: 1.0.1 resolution: "@conventional-changelog/git-client@npm:1.0.1" @@ -1404,13 +1383,6 @@ __metadata: languageName: node linkType: hard -"@fastify/busboy@npm:^2.0.0": - version: 2.1.1 - resolution: "@fastify/busboy@npm:2.1.1" - checksum: 10c0/6f8027a8cba7f8f7b736718b013f5a38c0476eea67034c94a0d3c375e2b114366ad4419e6a6fa7ffc2ef9c6d3e0435d76dd584a7a1cbac23962fda7650b579e3 - languageName: node - linkType: hard - "@gar/promisify@npm:^1.0.1": version: 1.1.3 resolution: "@gar/promisify@npm:1.1.3" @@ -4074,29 +4046,29 @@ __metadata: linkType: hard "@types/node@npm:*, @types/node@npm:>=13.7.0": - version: 22.10.7 - resolution: "@types/node@npm:22.10.7" + version: 22.10.9 + resolution: "@types/node@npm:22.10.9" dependencies: undici-types: "npm:~6.20.0" - checksum: 10c0/c941b4689dfc4044b64a5f601306cbcb0c7210be853ba378a5dd44137898c45accedd796ee002ad9407024cac7ecaf5049304951cb1d80ce3d7cebbbae56f20e + checksum: 10c0/ed2d7b2cf20ce520e04711eab48e9cd7d6a835d2859fbdc5d9a8c5e00a97c1f872a409f789783c473062b29beaf1cddf4b1c7ad03ae3fe433b072b7cf9fff741 languageName: node linkType: hard "@types/node@npm:^18.11.18": - version: 18.19.71 - resolution: "@types/node@npm:18.19.71" + version: 18.19.74 + resolution: "@types/node@npm:18.19.74" dependencies: undici-types: "npm:~5.26.4" - checksum: 10c0/9f9b4a1c4e2db2994ef36f165322b3bb807466e3f92751ed52a40af0212917bc6ecd12dc6775eb829176b71b26570bea9c6a0a2d9e3ae6b496721c71934244db + checksum: 10c0/365d9cc2af934965aa6a8471e24ae80add815c15dc094e42a320c57c1ea5416032f0b7ef6f23e32174c34811fbb8d89ea8eaa1396548610fbb8ba317b6e93fbf languageName: node linkType: hard "@types/node@npm:^20.13.0, @types/node@npm:^20.17.9": - version: 20.17.14 - resolution: "@types/node@npm:20.17.14" + version: 20.17.16 + resolution: "@types/node@npm:20.17.16" dependencies: undici-types: "npm:~6.19.2" - checksum: 10c0/2af0722989c677416dec4d9bc37e262a9724e090e5ce021a976e4ab12d4fa26aecbb00dddc8114d0fbf4a6552f12ace0ec98156247a20bf4d57809b7ce90ea5a + checksum: 10c0/50c589dd6a377238bc51b6fb5b8fc60ff6d688df0bde621d4a9fc59f480eb956cdf6d46052e1cb9536f150bc62e9194ddc733aa78b65e812155b4d3a32717de2 languageName: node linkType: hard @@ -4815,8 +4787,6 @@ __metadata: "@aws-sdk/client-bedrock-runtime": "npm:^3.706.0" "@commitlint/cli": "npm:^19.6.0" "@commitlint/config-conventional": "npm:^19.6.0" - "@connectrpc/connect": "npm:^1.6.1" - "@connectrpc/connect-node": "npm:^1.6.1" "@elastic/elasticsearch": "npm:^8.16.2" "@eslint/js": "npm:^9.16.0" "@eslint/markdown": "npm:^6.2.1" @@ -6472,9 +6442,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.5.73": - version: 1.5.84 - resolution: "electron-to-chromium@npm:1.5.84" - checksum: 10c0/8362d556360eba420ea3475a7878c8fa8507a42c4ebfbf44108f6acc4edbe30a1cde79e95613bdc9ae6e7d73bf1776347cf7f615c1a220f63e34a0fa029568e0 + version: 1.5.86 + resolution: "electron-to-chromium@npm:1.5.86" + checksum: 10c0/f0af8465d9390d21cb3ffec5ed6ce011b5026615f59ebc7a70bb0da806a27918888b2ec446432a5080da0e0bea4f3c6a3a4dcff24c9eb8e884813b0ccceedc59 languageName: node linkType: hard @@ -11189,12 +11159,12 @@ __metadata: linkType: hard "p-queue-compat@npm:^1.0.227": - version: 1.0.228 - resolution: "p-queue-compat@npm:1.0.228" + version: 1.0.229 + resolution: "p-queue-compat@npm:1.0.229" dependencies: eventemitter3: "npm:5.x" p-timeout-compat: "npm:^1.0.3" - checksum: 10c0/8f7f128e70c3dfe0a5646c49b9302a6cf0234cdb9340a75758271ff81ee0402b2919fa79fb5be18e776e517994d89bb6a968c3d2ac3781fdf819a4a57a6ebbd5 + checksum: 10c0/f9882127cf9a16a33e7b31142aeb73d6c6f1a11c6c7230eb2328bf8dc679dbb35f2b153cbfc49e19090d7c6226f6c2391ee0a93e3d8bd9ef1e88be63f7579f09 languageName: node linkType: hard @@ -13665,15 +13635,6 @@ __metadata: languageName: node linkType: hard -"undici@npm:^5.28.4": - version: 5.28.5 - resolution: "undici@npm:5.28.5" - dependencies: - "@fastify/busboy": "npm:^2.0.0" - checksum: 10c0/4dfaa13089fe4c0758f84ec0d34b257e58608e6be3aa540f493b9864b39e3fdcd0a1ace38e434fe79db55f833aa30bcfddd8d6cbe3e0982b0dcae8ec17b65e08 - languageName: node - linkType: hard - "undici@npm:^6.21.1": version: 6.21.1 resolution: "undici@npm:6.21.1"