Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,8 @@ print(os.environ)
|
|
8 |
openai.api_base = os.environ.get("OPENAI_API_BASE")
|
9 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
10 |
|
|
|
|
|
11 |
def make_prediction(prompt, max_tokens=None, temperature=None, top_p=None, top_k=None, repetition_penalty=None):
|
12 |
completion = openai.Completion.create(model="Open-Orca/OpenOrcaxOpenChat-Preview2-13B", prompt=prompt, max_tokens=max_tokens, temperature=temperature, top_p=top_p, top_k=top_k, repetition_penalty=repetition_penalty, stream=True)
|
13 |
for chunk in completion:
|
@@ -36,7 +38,7 @@ def user(message, history):
|
|
36 |
def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
37 |
history = history or []
|
38 |
|
39 |
-
messages = system_message.strip() + "\n" + \
|
40 |
"\n".join(["\n".join(["User: "+item[0]+"<|end_of_turn|>", "Assistant: "+item[1]+"<|end_of_turn|>"])
|
41 |
for item in history])
|
42 |
# strip the last `<|end_of_turn|>` from the messages
|
|
|
8 |
openai.api_base = os.environ.get("OPENAI_API_BASE")
|
9 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
10 |
|
11 |
+
BASE_SYSTEM_MESSAGE = """You are an AI Assistant developed by OpenOrca & OpenChat whose team members include Guan Wang "One", Bleys Goodson, "Entropi", Wing Lian "Casues", Eugene Pentland "neverendingtoast", Austin Cook "AutoMeta", Chanvichet Vong "Nanobit" and "Teknium". """
|
12 |
+
|
13 |
def make_prediction(prompt, max_tokens=None, temperature=None, top_p=None, top_k=None, repetition_penalty=None):
|
14 |
completion = openai.Completion.create(model="Open-Orca/OpenOrcaxOpenChat-Preview2-13B", prompt=prompt, max_tokens=max_tokens, temperature=temperature, top_p=top_p, top_k=top_k, repetition_penalty=repetition_penalty, stream=True)
|
15 |
for chunk in completion:
|
|
|
38 |
def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
39 |
history = history or []
|
40 |
|
41 |
+
messages = BASE_SYSTEM_MESSAGE + system_message.strip() + "\n" + \
|
42 |
"\n".join(["\n".join(["User: "+item[0]+"<|end_of_turn|>", "Assistant: "+item[1]+"<|end_of_turn|>"])
|
43 |
for item in history])
|
44 |
# strip the last `<|end_of_turn|>` from the messages
|