diff --git a/README.md b/README.md index ff1bcf7..f16c1f9 100644 --- a/README.md +++ b/README.md @@ -32,20 +32,20 @@ yarn install ### Run an example agent with tools -We provide an example agent in `src/index.ts` that you can use to test tools. +We provide example agents for tool usage in `examples/agents/` that you can use to test tools. ```shell yarn start ``` -The example agent is configured to use a BAM or OpenAI hosted LLM, or a local Ollama LLM. +The `allToolsAgent` example agent is configured to use a BAM, Watsonx, OpenAI hosted LLM, or a local Ollama LLM. If you are using a hosted LLM make sure to create .env (from .env.template) and fill in the necessary API_KEY. > [!NOTE] > The Hello World example tool is not enabled by default. > [!TIP] -> Tools can be enabled/disabled in `src/index.ts` +> Tools can be enabled/disabled in `examples/agents/allToolsAgent.ts` ## Contribution guidelines diff --git a/src/index.ts b/examples/agents/allToolsAgent.ts similarity index 96% rename from src/index.ts rename to examples/agents/allToolsAgent.ts index 3ad242f..78802ee 100644 --- a/src/index.ts +++ b/examples/agents/allToolsAgent.ts @@ -17,7 +17,7 @@ import "dotenv/config.js"; import { BAMChatLLM } from "bee-agent-framework/adapters/bam/chat"; import { BeeAgent } from "bee-agent-framework/agents/bee/agent"; -import { createConsoleReader } from "./helpers/io.js"; +import { createConsoleReader } from "../helpers/io.js"; import { FrameworkError } from "bee-agent-framework/errors"; import { TokenMemory } from "bee-agent-framework/memory/tokenMemory"; import { Logger } from "bee-agent-framework/logger/logger"; @@ -41,8 +41,8 @@ import { WikipediaTool } from "bee-agent-framework/tools/search/wikipedia"; // contrib tools // import { HelloWorldTool } from "@/tools/helloWorld.js"; -import { OpenLibraryTool } from "@/tools/openLibrary.js"; -import { ImageDescriptionTool } from "@/tools/imageDescription.js"; +import { OpenLibraryTool } from "../../src/tools/openLibrary.js"; +import { ImageDescriptionTool } from "../../src/tools/imageDescription.js"; Logger.root.level = "silent"; // disable internal logs const logger = new Logger({ name: "app", level: "trace" }); @@ -159,5 +159,3 @@ async function runBeeAgent() { } void runBeeAgent(); - -export * from "./version.js"; diff --git a/src/helpers/io.ts b/examples/helpers/io.ts similarity index 100% rename from src/helpers/io.ts rename to examples/helpers/io.ts diff --git a/examples/tsconfig.json b/examples/tsconfig.json new file mode 100644 index 0000000..95d325d --- /dev/null +++ b/examples/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "baseUrl": "..", + "rootDir": "..", + "paths": { + "bee-community-tools/*": ["./src/*.js"], + "@/*": ["./src/*"] + } + }, + "references": [{ "path": "./src" }], + "exclude": ["../tests", "../**/*.test.ts"] +} diff --git a/package.json b/package.json index 7059f00..05c315e 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "scripts": { "clean": "rimraf dist", "build": "yarn clean && yarn ts:check && tsup", - "ts:check": "tsc --noEmit", - "start": "tsx src/index.ts", + "ts:check": "tsc --noEmit && tsc -p tsconfig.examples.json --noEmit", + "start": "tsx --tsconfig tsconfig.examples.json examples/agents/allToolsAgent.ts", "lint": "yarn eslint", "lint:fix": "yarn eslint --fix", "format": "yarn prettier --check .", diff --git a/tsconfig.examples.json b/tsconfig.examples.json new file mode 100644 index 0000000..4a70142 --- /dev/null +++ b/tsconfig.examples.json @@ -0,0 +1,3 @@ +{ + "extends": "./examples/tsconfig.json" +}