Nandha Bot's Channel
1.47K subscribers
101 photos
50 videos
15 files
171 links
đŸ—Ŗī¸ Discussion Group - @NandhaSupport
đŸ“ĸ Network Channel - @NandhaNetwork
🛒 Market Shop - @NandhaMarket

✨ Owner: @Nandha

â„šī¸ GitHub Account:
https://github.com/nandhaxd

â„šī¸ GitHub Organization: https://github.com/Nandhabots
Download Telegram
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
👍2