Spaces:
Sleeping
Sleeping
File size: 573 Bytes
853a071 96e824e 853a071 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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
)
|