Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ openai.api_model2 = os.environ.get("OPENAI_API_MODEL2")
|
|
15 |
BASE_SYSTEM_MESSAGE = """"""
|
16 |
|
17 |
|
18 |
-
def make_prediction(prompt,
|
19 |
completion = openai.Completion.create(
|
20 |
model=model,
|
21 |
api_key=api_key,
|
@@ -52,7 +52,7 @@ def user_double(message, history1, history2):
|
|
52 |
history2.append([message, ""])
|
53 |
return "", history1, history2
|
54 |
|
55 |
-
def chat(
|
56 |
history = history or []
|
57 |
|
58 |
messages = BASE_SYSTEM_MESSAGE + system_message.strip() + "\n" + \
|
@@ -65,7 +65,9 @@ def chat(model, history, system_message, max_tokens, temperature, top_p, top_k,
|
|
65 |
|
66 |
prediction = make_prediction(
|
67 |
messages,
|
68 |
-
|
|
|
|
|
69 |
max_tokens=max_tokens,
|
70 |
temperature=temperature,
|
71 |
top_p=top_p,
|
|
|
15 |
BASE_SYSTEM_MESSAGE = """"""
|
16 |
|
17 |
|
18 |
+
def make_prediction(prompt, api_model, api_key, api_base, max_tokens=None, temperature=None, top_p=None, top_k=None, repetition_penalty=None):
|
19 |
completion = openai.Completion.create(
|
20 |
model=model,
|
21 |
api_key=api_key,
|
|
|
52 |
history2.append([message, ""])
|
53 |
return "", history1, history2
|
54 |
|
55 |
+
def chat(api_model, history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty, api_key, api_base):
|
56 |
history = history or []
|
57 |
|
58 |
messages = BASE_SYSTEM_MESSAGE + system_message.strip() + "\n" + \
|
|
|
65 |
|
66 |
prediction = make_prediction(
|
67 |
messages,
|
68 |
+
api_model,
|
69 |
+
api_key,
|
70 |
+
api_base,
|
71 |
max_tokens=max_tokens,
|
72 |
temperature=temperature,
|
73 |
top_p=top_p,
|