This is a Node.js project with TypeScript that implements an AI agent capable of using various tools to answer questions and perform tasks.
- Google Search Tool
- AI-powered Chat LLM (Large Language Model)
- ReAct Agent for complex problem-solving
- JavaScript Code Runner Tool
- Playground for testing and experimentation
- Node.js (version 20.3.0 or higher)
- npm (comes with Node.js)
-
Clone the repository:
git clone https://github.com/yourusername/my-typescript-project.git cd my-typescript-project -
Install dependencies:
npm install -
Set up environment variables: Create a
.envfile in the root directory and add the following:AI21_API_KEY=your_ai21_api_key_here SEARCH_API_KEY=your_serpapi_key_here
The project includes several scripts that can be run using npm:
- Google Search:
npm run dev:googleSearch - Chat LLM:
npm run dev:chatLLM - Run Agent:
npm run dev:runAgent - Playground:
npm run dev:playground - Playground with Agent:
npm run dev:playgroundWithAgent
Example:
npm run dev:runAgent
- Build the project:
npm run build - Run in development mode:
npm run dev - Lint the code:
npm run lint - Format the code:
npm run format - Run tests:
npm run test
src/: Source code directoryindex.ts: Main entry pointAgent.ts: ReAct agent implementationChatLLM.ts: Chat LLM interfaceGoogleSearchTool.ts: Google Search tool implementationCodeRunner.ts: JavaScript code runner tooltypes/: TypeScript type definitions
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.