dauid64's picture
atualizando o contexto e arrumando problema de nao passar
96e824e
raw
history blame contribute delete
573 Bytes
import os
from openai import Client
from utils.file import File
def send_message(oa_client: Client, context, question, conversation_chat):
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
)