Spaces:
Runtime error
Runtime error
import telebot | |
import os | |
import llama_huggingface | |
import prompts | |
from dotenv import load_dotenv | |
load_dotenv() | |
TELEGRAM_BOT_TOKEN=os.getenv('TELEGRAM_BOT_TOKEN') | |
bot = telebot.TeleBot(TELEGRAM_BOT_TOKEN) | |
chat_model='' | |
def init_telegram(model,repo_id): | |
global chat_model | |
if model=='LLAMA': | |
chat_model=llama_huggingface.init_llama_chatmodel(repo_id=repo_id) | |
def get_telegram_bot(): | |
global bot | |
return bot | |
def send_welcome(message): | |
prompt=prompts.compose_prompt( | |
system_message='You are an AI', | |
human_message=message.text | |
) | |
reply=chat_model.invoke(prompt) | |
bot.reply_to(message,reply.content) | |