Pecximenes's picture
Adding v1 of rag-agent
853a071
raw
history blame
629 Bytes
import os
from openai import Client
from utils.file import File
def send_message(oa_client: Client, context, question, conversation_chat):
if len(conversation_chat) == 0:
system_message = File("prompts/system.md")
conversation_chat.append({
"role": "system",
"content": system_message
})
conversation_chat.append({
"role": "user",
"content": f"Context: {context}\nQuestion: {question}"
})
return oa_client.chat.completions.create(
model=os.environ.get("OPENAI_MODEL_CHAT"),
messages=conversation_chat,
stream=True
)