Skip to content

Commit

Permalink
fix: review 2
Browse files Browse the repository at this point in the history
Signed-off-by: GALLLASMILAN <gallas.milan@gmail.com>
  • Loading branch information
GALLLASMILAN authored and Milan Gallas committed Jan 23, 2025
1 parent d20938b commit af722fe
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 29 deletions.
2 changes: 2 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
- Others

- [Integrations](integrations.md)
- [Instrumentation](instrumentation.md)
- [Native Telemetry](native-telemetry.md)
4 changes: 2 additions & 2 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion docs/native-telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
4 changes: 2 additions & 2 deletions examples/integrations/langgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation/create-telemetry-metrics-middleware.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
19 changes: 12 additions & 7 deletions src/instrumentation/opentelemetry.spec.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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<any> {
public readonly emitter = Emitter.root.child<GenerateCallbacks>({
embed(): Promise<EmbeddingOutput> {
throw new Error("Method not implemented.");
}
public readonly emitter = Emitter.root.child<BaseLLMEvents>({
namespace: ["bam", "llm"],
creator: this,
});
Expand Down Expand Up @@ -71,15 +78,13 @@ 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" }),
new CustomLLM("llama3.1"),
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();
});
Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation/sdk.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4074,29 +4074,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

Expand Down Expand Up @@ -6472,9 +6472,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

Expand Down Expand Up @@ -11189,12 +11189,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

Expand Down

0 comments on commit af722fe

Please sign in to comment.