import { OpenAI } from "langchain";
import { initializeAgentExecutor } from "langchain/agents";
import { SerpAPI, Calculator } from "langchain/tools";
export const run = async () => {
const model = new OpenAI({ temperature: 0 });
const tools = [new SerpAPI(), new Calculator()];
const executor = await initializeAgentExecutor(
tools,
model,
"zero-shot-react-description"
);
console.log("Loaded agent.");
const input = `What are the total number of countries in Africa raised to the power of 3?`;
console.log(`Executing with input "${input}"...`);
const result = await executor.call({ input });
console.log(`Got output ${result.output}`);
};