mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
🔧 chore(requirements.txt): comment out py-cord and add pycord from GitHub repository to use the latest version
🔧 chore(ChatProcess.py): import fetch_messages_history function from Chat module to use it in Chat class 🔧 chore(ChatProcess.py): import moderate and ModerationError from utils.misc module to use them in Chat class 🔧 chore(Chat.py): add fetch_messages_history function to fetch message history from a channel 🔧 chore(Chat.py): add formatContext function to format the context for the bot to use 🔧 chore(Chat.py): raise an exception if no openai api key is set 🔧 chore(Chat.py): add logic to filter and format messages for the context 🔧 chore(Chat.py): fix typo in the import statement for ModerationError 🔧 chore(Chat.py): fix typo in the import statement for moderate 🔧 chore(Chat.py): fix typo in the import statement for fetch_messages_history 🔧 chore(prompts.py): create prompts dictionary and read chat and text prompts from files for each character 🔧 chore(prompts.py): create createPrompt function to create a prompt from the messages list 🔧 chore(prompts.py): create createTextPrompt function to create a text prompt from the messages list 🔧 chore(prompts.py): create createChatPrompt function to create a chat prompt from the messages list 🔧 chore(requesters/llama.py): create llama function as a placeholder 🔧 chore(requesters/llama2.py): create llama2 function as a placeholder 🔧 chore(requesters/openaiChat.py): import openai_caller from utils.openaicaller module 🔧 chore(requesters/openaiChat.py): create openaiChat function as a placeholder 🔧 chore(requesters/openaiText.py): create openaiText function as a placeholder 🔧 chore(requesters/request.py): import openaiChat, openaiText, llama, and llama2 functions from respective modules 🔧 chore(requesters/request.py): create request function to handle different models and make requests
This commit is contained in:
18
src/chatUtils/requesters/request.py
Normal file
18
src/chatUtils/requesters/request.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import discord
|
||||
from src.chatUtils.requesters.openaiChat import openaiChat
|
||||
from src.chatUtils.requesters.openaiText import openaiText
|
||||
from src.chatUtils.requesters.llama import llama
|
||||
from src.chatUtils.requesters.llama2 import llama2
|
||||
|
||||
|
||||
async def request(
|
||||
model: str, prompt: list[dict] | str, message: discord.message, openai_api_key: str
|
||||
):
|
||||
if model == "gpt-3.5-turbo":
|
||||
return await openaiChat(messages=prompt, openai_api_key=openai_api_key)
|
||||
elif model == "text-davinci-003":
|
||||
return await openaiText(prompt=prompt, openai_api_key=openai_api_key)
|
||||
elif model == "text-llama":
|
||||
return await llama(prompt=prompt)
|
||||
elif model == "text-llama-2":
|
||||
return await llama2(prompt=prompt)
|
||||
Reference in New Issue
Block a user