Spaces:
Sleeping
Sleeping
some updates
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ def launch_bot():
|
|
| 17 |
|
| 18 |
def reset():
|
| 19 |
st.session_state.messages = [{"role": "assistant", "content": "Please make your opening statement.", "avatar": '🦖'}]
|
|
|
|
| 20 |
|
| 21 |
if 'cfg' not in st.session_state:
|
| 22 |
cfg = OmegaConf.create({
|
|
@@ -42,7 +43,7 @@ def launch_bot():
|
|
| 42 |
st.markdown(f"## Welcome to Debate Bot.\n\n\n")
|
| 43 |
|
| 44 |
role_options = ['in opposition to', 'in support of']
|
| 45 |
-
cfg.human_role = st.selectbox('
|
| 46 |
cfg.bot_role = role_options[1] if cfg.human_role == role_options[0] else role_options[0]
|
| 47 |
if st.session_state.current_human_role != cfg.human_role:
|
| 48 |
st.session_state.current_human_role = cfg.human_role
|
|
|
|
| 17 |
|
| 18 |
def reset():
|
| 19 |
st.session_state.messages = [{"role": "assistant", "content": "Please make your opening statement.", "avatar": '🦖'}]
|
| 20 |
+
st.session_state.vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_id, cfg.prompt_name)
|
| 21 |
|
| 22 |
if 'cfg' not in st.session_state:
|
| 23 |
cfg = OmegaConf.create({
|
|
|
|
| 43 |
st.markdown(f"## Welcome to Debate Bot.\n\n\n")
|
| 44 |
|
| 45 |
role_options = ['in opposition to', 'in support of']
|
| 46 |
+
cfg.human_role = st.selectbox('You (the human) are:', role_options)
|
| 47 |
cfg.bot_role = role_options[1] if cfg.human_role == role_options[0] else role_options[0]
|
| 48 |
if st.session_state.current_human_role != cfg.human_role:
|
| 49 |
st.session_state.current_human_role = cfg.human_role
|
query.py
CHANGED
|
@@ -32,7 +32,7 @@ class VectaraQuery():
|
|
| 32 |
Follow these INSTRUCTIONS carefully:
|
| 33 |
1. Provide a thoughtful and convincing reply.
|
| 34 |
2. Do not base your response on information or knowledge that is not in the search results.
|
| 35 |
-
3. Respond
|
| 36 |
4. Limit your responses to not more than 2 paragraphs."
|
| 37 |
}},
|
| 38 |
{{
|
|
@@ -45,10 +45,10 @@ class VectaraQuery():
|
|
| 45 |
}},
|
| 46 |
{{
|
| 47 |
"role": "user",
|
| 48 |
-
"content": "Provide a convincing
|
| 49 |
Consider the search results as relevant information with which to form your response, but do not mention the results in your response.
|
| 50 |
-
|
| 51 |
-
|
| 52 |
}}
|
| 53 |
]
|
| 54 |
'''
|
|
@@ -56,7 +56,7 @@ class VectaraQuery():
|
|
| 56 |
return {
|
| 57 |
'query': [
|
| 58 |
{
|
| 59 |
-
'query': f"
|
| 60 |
'start': 0,
|
| 61 |
'numResults': 50,
|
| 62 |
'corpusKey': corpora_key_list,
|
|
|
|
| 32 |
Follow these INSTRUCTIONS carefully:
|
| 33 |
1. Provide a thoughtful and convincing reply.
|
| 34 |
2. Do not base your response on information or knowledge that is not in the search results.
|
| 35 |
+
3. Respond with respect to your opponent.
|
| 36 |
4. Limit your responses to not more than 2 paragraphs."
|
| 37 |
}},
|
| 38 |
{{
|
|
|
|
| 45 |
}},
|
| 46 |
{{
|
| 47 |
"role": "user",
|
| 48 |
+
"content": "Provide a convincing response {role} {topic}, to the question '$esc.java(${{vectaraQuery}})'.
|
| 49 |
Consider the search results as relevant information with which to form your response, but do not mention the results in your response.
|
| 50 |
+
Consider the last argument from your opponent: '{user_response}'.
|
| 51 |
+
Use the {style} debate style to make your argument."
|
| 52 |
}}
|
| 53 |
]
|
| 54 |
'''
|
|
|
|
| 56 |
return {
|
| 57 |
'query': [
|
| 58 |
{
|
| 59 |
+
'query': f"What is a good argument {role} {topic}",
|
| 60 |
'start': 0,
|
| 61 |
'numResults': 50,
|
| 62 |
'corpusKey': corpora_key_list,
|