GROQ_API_KEY = ""
â¤ī¸ Get your Groq Api key from
https://www.groq.com/
from groq import Groq # ( pip install groq )
async def get_groq_response(user_prompt, system_prompt):
try:
client = Groq(api_key=GROQ_API_KEY)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "system",
"content": system_prompt,
},
{
"role": "user",
"content": user_prompt,
}
],
model="llama3-8b-8192",
)
return chat_completion.choices[0].message.content
except Exception as e:
print(f"Getting error in Groq response: {e}")
return "Error getting Groq response."
Info: Using groq as your custom AI bot assistant
#NandhaBots #Groq #AI
Please open Telegram to view this post
VIEW IN TELEGRAM
Groq
Groq is fast inference for AI builders
The LPUâĸ Inference Engine by Groq is a hardware and software platform that delivers exceptional compute speed, quality, and energy efficiency. Groq provides cloud and on-prem solutions at scale for AI applications.
đ2