import Groq from "groq-sdk";

const groq = new Groq({ apiKey: process.env.GROQ_API_KEY });

const response = await groq.chat.completions.create({
  messages: [
    {
      role: "user",
      content: "Calculate the square root of 101 and show me the Python code you used",
    },
  ],
  model: "groq/compound-mini",
});

// Final output
console.log(response.choices[0].message.content);

// Reasoning + internal tool calls
console.log(response.choices[0].message.reasoning);

// Code execution tool calls
console.log(response.choices[0].message.executed_tools?.[0]);

---

## Code Execution: Calculation (py)