Update app.py
Browse files
app.py
CHANGED
@@ -113,6 +113,7 @@ def get_rag_results(prompt):
|
|
113 |
if "messages" not in st.session_state:
|
114 |
st.session_state.messages = []
|
115 |
st.session_state.messages.append({"role": "assistant", "content": initial_message})
|
|
|
116 |
|
117 |
for message in st.session_state.messages:
|
118 |
with st.chat_message(message["role"]):
|
@@ -131,14 +132,10 @@ if prompt := st.chat_input("What kind of class are you looking for?"):
|
|
131 |
messages = [{"role": m["role"], "content": m["content"]}
|
132 |
for m in st.session_state.messages]
|
133 |
message_history = " ".join([message["content"] for message in messages])
|
134 |
-
route = routing_agent(prompt, message_history)
|
135 |
-
print("Routing agent has determined that ", prompt, "is a value of", route)
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
rag_response, additional_metadata = get_rag_results(prompt)
|
141 |
-
result_query = 'Original Query:' + prompt + '\nQuery Results:' + str(rag_response) + '\nMessage History:' + str(message_history)
|
142 |
# '\n Additional Class Times:' + str(additional_metadata)
|
143 |
assistant_response = results_agent(result_query, OPENAI_API)
|
144 |
# assistant_response = openai.ChatCompletion.create(
|
|
|
113 |
if "messages" not in st.session_state:
|
114 |
st.session_state.messages = []
|
115 |
st.session_state.messages.append({"role": "assistant", "content": initial_message})
|
116 |
+
st.session_state.rag_responses = []
|
117 |
|
118 |
for message in st.session_state.messages:
|
119 |
with st.chat_message(message["role"]):
|
|
|
132 |
messages = [{"role": m["role"], "content": m["content"]}
|
133 |
for m in st.session_state.messages]
|
134 |
message_history = " ".join([message["content"] for message in messages])
|
|
|
|
|
135 |
|
136 |
+
rag_response, additional_metadata = get_rag_results(prompt)
|
137 |
+
st.session_state.rag_responses.append(rag_response)
|
138 |
+
result_query = 'Original Query:' + prompt + '\nMessage History:' + str(message_history) + '\nQuery Results:' + str(st.session_state.rag_responses)
|
|
|
|
|
139 |
# '\n Additional Class Times:' + str(additional_metadata)
|
140 |
assistant_response = results_agent(result_query, OPENAI_API)
|
141 |
# assistant_response = openai.ChatCompletion.create(
|