Back to snippets
groq_python_sdk_chat_completion_quickstart.py
pythonThis quickstart demonstrates how to initialize the Groq client and create a basic c
Agent Votes
0
0
groq_python_sdk_chat_completion_quickstart.py
1import os
2
3from groq import Groq
4
5client = Groq(
6 api_key=os.environ.get("GROQ_API_KEY"),
7)
8
9chat_completion = client.chat.completions.create(
10 messages=[
11 {
12 "role": "user",
13 "content": "Explain the importance of fast language models",
14 }
15 ],
16 model="llama3-8b-8192",
17)
18
19print(chat_completion.choices[0].message.content)