Spaces:
Sleeping
Sleeping
Commit
·
7d328db
1
Parent(s):
b74edd6
Role as separate field
Browse files
app.py
CHANGED
@@ -12,13 +12,14 @@ model_choices = [
|
|
12 |
"google",
|
13 |
"anthropic",
|
14 |
]
|
|
|
15 |
|
16 |
|
17 |
key = os.environ['OPENAI_API_KEY']
|
18 |
config = {
|
19 |
"key": key,
|
20 |
"model": "gpt-3.5-turbo",
|
21 |
-
"role":
|
22 |
"context_depth": 3,
|
23 |
"max_tokens": 256,
|
24 |
}
|
@@ -32,7 +33,7 @@ with open(key_path, "w") as json_file:
|
|
32 |
|
33 |
config = {
|
34 |
"key_path": key_path,
|
35 |
-
"role":
|
36 |
"context_depth": 3,
|
37 |
"max_tokens": 256,
|
38 |
}
|
@@ -43,7 +44,7 @@ config = {
|
|
43 |
"key": key_anthropic,
|
44 |
"openai_key": key,
|
45 |
"model": "claude-2",
|
46 |
-
"role":
|
47 |
"context_depth": 3,
|
48 |
"max_tokens": 256,
|
49 |
}
|
@@ -66,7 +67,7 @@ def ask(message, history, persona, model_name):
|
|
66 |
|
67 |
demo = gr.ChatInterface(ask,
|
68 |
additional_inputs=[
|
69 |
-
gr.Textbox(
|
70 |
gr.Dropdown(choices=model_choices, value=model_choices[0], label="Model")
|
71 |
]
|
72 |
)
|
|
|
12 |
"google",
|
13 |
"anthropic",
|
14 |
]
|
15 |
+
role = "You are trying to give a short answer in less than 40 words."
|
16 |
|
17 |
|
18 |
key = os.environ['OPENAI_API_KEY']
|
19 |
config = {
|
20 |
"key": key,
|
21 |
"model": "gpt-3.5-turbo",
|
22 |
+
"role": role,
|
23 |
"context_depth": 3,
|
24 |
"max_tokens": 256,
|
25 |
}
|
|
|
33 |
|
34 |
config = {
|
35 |
"key_path": key_path,
|
36 |
+
"role": role,
|
37 |
"context_depth": 3,
|
38 |
"max_tokens": 256,
|
39 |
}
|
|
|
44 |
"key": key_anthropic,
|
45 |
"openai_key": key,
|
46 |
"model": "claude-2",
|
47 |
+
"role": role,
|
48 |
"context_depth": 3,
|
49 |
"max_tokens": 256,
|
50 |
}
|
|
|
67 |
|
68 |
demo = gr.ChatInterface(ask,
|
69 |
additional_inputs=[
|
70 |
+
gr.Textbox(role, label="Persona"),
|
71 |
gr.Dropdown(choices=model_choices, value=model_choices[0], label="Model")
|
72 |
]
|
73 |
)
|