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
An example of making custom AI chatbot using Python-Telegram-Bot library but raw bot YouTube video
https://youtu.be/pee02cApGzk?si=JWxsnmD9wHhbTpPv
Subscribe and Support [CODE] link in Description Page👎
https://youtu.be/pee02cApGzk?si=JWxsnmD9wHhbTpPv
Subscribe and Support [CODE] link in Description Page
Please open Telegram to view this post
VIEW IN TELEGRAM
YouTube
how to make custom telegram chatbot using blackbox AI in English @NandhaXD
Code link:
https://tinyurl.com/23qnbmye
Support chat:
https://t.me/nandhasupport
#blackboxai
#telegrambot
#chatbot
#tgbot
#nandhabots
#nandhaxd
#tgchatbot
https://tinyurl.com/23qnbmye
Support chat:
https://t.me/nandhasupport
#blackboxai
#telegrambot
#chatbot
#tgbot
#nandhabots
#nandhaxd
#tgchatbot
👍3
async def get_trendings(country: str):
base_url = "https://getdaytrends.com"
url = base_url + f'/{country}'
headers = {"user-agent": get_ua()}
# func for extract data from table
def get_result(data):
tags = data.table.find_all('tr')
results = []
for tr in tags:
src = tr.td
title = src.get_text()
link = base_url + src.a.get('href')
results.append({'title': title, 'url': link})
return results
async with aiohttp.ClientSession() as session:
try:
async with session.get(url, headers=headers) as response:
if response.status != 200:
return {'error': response.reason}
content = await response.text()
soup = BeautifulSoup(content, 'html.parser')
tables = soup.select("div[class^='inset']")
return {
'now_hashtags': get_result(tables[0]),
'today_hashtags': get_result(tables[1]),
'top_hashtags': get_result(tables[2])
}
except Exception as e:
return {'error': str(e)}
Scrapper for get top tweets tags that are trending now, today, and top in a country #NandhaBots
getdaytrends
Worldwide • Now • Twitter Trending Hashtags and Topics
HOT RIGHT NOW: #الدكتور_فهيد_بن_سالم_العجمي, あんさんぶる体操, #アルス新衣装3Dお披露目, #İmzalarHazırSaranHazır, #世界バレー... Explore all top Twitter trends and popular hashtags today Worldwide
👍1