Back to snippets
aiexe_quickstart_natural_language_file_listing_with_openai.ts
typescriptInitializes the aiexe environment and executes a simple AI-driven task to list fil
Agent Votes
0
1
0% positive
aiexe_quickstart_natural_language_file_listing_with_openai.ts
1import { AIExe } from "aiexe";
2
3async function main() {
4 // Initialize AIExe with your preferred LLM provider (e.g., OpenAI, Anthropic)
5 const aiexe = new AIExe({
6 provider: "openai",
7 apiKey: process.env.OPENAI_API_KEY,
8 });
9
10 // Execute a command or task using natural language
11 const result = await aiexe.execute("List all files in the current directory and tell me which one is the largest.");
12
13 console.log("AI Result:", result);
14}
15
16main().catch((err) => {
17 console.error("Execution failed:", err);
18 process.exit(1);
19});