This guide will help you set up and run the AI Math assistant locally. The framework leverages self-healing tool-calling mechanisms to ensure accurate results.
Make sure you have the following installed:
- Node.js (latest version recommended)
npx(comes with Node.js)
Create a .env file in the root directory of your project and add your OpenAI and Langbase API keys. You can access your Langbase API key from here.
Example .env file:
OPENAI_API_KEY=your_openai_api_key_here
LANGBASE_API_KEY=your_langbase_api_key_here
To run the AI agent pipe locally, you need to start the BaseAI server. Use the following command in your terminal:
npx baseai@latest devAfter starting the BaseAI server, execute the index.ts file to run the AI Agent Pipe. Use the following command:
npx tsx index.tsIn your terminal, you’ll be prompted to:
Enter your query:
For example, you can type:
What is 120 cm in feet?
The AI agent will process the query. If the LLM produces an inaccurate result, the BaseAI framework’s self-healing mechanism will detect and correct the error, ensuring you receive the correct answer.
If you encounter any issues:
- Verify your Node.js version.
- Check if
npxandtsxare installed correctly. - Refer to the BaseAI documentation for advanced debugging.