Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from optillm.mcts import chat_with_mcts
|
|
8 |
from optillm.bon import best_of_n_sampling
|
9 |
from optillm.cot_reflection import cot_reflection
|
10 |
|
11 |
-
API_KEY = os.environ.get("
|
12 |
|
13 |
def respond(
|
14 |
message,
|
@@ -20,7 +20,7 @@ def respond(
|
|
20 |
temperature,
|
21 |
top_p,
|
22 |
):
|
23 |
-
client = OpenAI(api_key=API_KEY, base_url="https://
|
24 |
|
25 |
messages = [{"role": "system", "content": system_message}]
|
26 |
|
@@ -34,7 +34,7 @@ def respond(
|
|
34 |
|
35 |
# response = ""
|
36 |
|
37 |
-
final_response =
|
38 |
return final_response
|
39 |
|
40 |
# for message in client.chat_completion(
|
@@ -56,11 +56,12 @@ demo = gr.ChatInterface(
|
|
56 |
respond,
|
57 |
additional_inputs=[
|
58 |
gr.Dropdown(
|
59 |
-
["
|
60 |
-
|
|
|
61 |
),
|
62 |
gr.Dropdown(
|
63 |
-
["bon", "mcts", "moa"], value="moa", label="Approach", info="Choose the approach"
|
64 |
),
|
65 |
gr.Textbox(value="", label="System message"),
|
66 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
|
8 |
from optillm.bon import best_of_n_sampling
|
9 |
from optillm.cot_reflection import cot_reflection
|
10 |
|
11 |
+
API_KEY = os.environ.get("OPENROUTER_API_KEY")
|
12 |
|
13 |
def respond(
|
14 |
message,
|
|
|
20 |
temperature,
|
21 |
top_p,
|
22 |
):
|
23 |
+
client = OpenAI(api_key=API_KEY, base_url="https://openrouter.ai/api/v1")
|
24 |
|
25 |
messages = [{"role": "system", "content": system_message}]
|
26 |
|
|
|
34 |
|
35 |
# response = ""
|
36 |
|
37 |
+
final_response = mixture_of_agents(system_message, message, client, model)
|
38 |
return final_response
|
39 |
|
40 |
# for message in client.chat_completion(
|
|
|
56 |
respond,
|
57 |
additional_inputs=[
|
58 |
gr.Dropdown(
|
59 |
+
["nousresearch/hermes-3-llama-3.1-405b:free", "meta-llama/llama-3.1-8b-instruct:free", "qwen/qwen-2-7b-instruct:free",
|
60 |
+
"google/gemma-2-9b-it:free", "mistralai/mistral-7b-instruct:free", ],
|
61 |
+
value="nousresearch/hermes-3-llama-3.1-405b:free", label="Model", info="Choose the base model"
|
62 |
),
|
63 |
gr.Dropdown(
|
64 |
+
["bon", "mcts", "moa", "cot_reflection"], value="moa", label="Approach", info="Choose the approach"
|
65 |
),
|
66 |
gr.Textbox(value="", label="System message"),
|
67 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|