```python
from groq import Groq

client = Groq()

completion = client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[
        {
            "role": "user",
            "content": "Write a Python function to calculate the factorial of a number."
        },
        {
            "role": "assistant",
            "content": "```python"
        }
    ],
    stream=True,
    stop="```",
)

for chunk in completion:
    print(chunk.choices[0].delta.content or "", end="")
```

---

## Prefilling: Example1 (js)