Update app.py
Browse files
app.py
CHANGED
@@ -174,11 +174,32 @@ if query:
|
|
174 |
|
175 |
response_chain = LLMChain(llm=rag_llm,prompt=final_prompt,output_key="final_response")
|
176 |
|
|
|
|
|
177 |
st.subheader("Response Chain")
|
178 |
st.json(response_chain)
|
179 |
|
|
|
180 |
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
--------
|
184 |
|
|
|
174 |
|
175 |
response_chain = LLMChain(llm=rag_llm,prompt=final_prompt,output_key="final_response")
|
176 |
|
177 |
+
|
178 |
+
#temp
|
179 |
st.subheader("Response Chain")
|
180 |
st.json(response_chain)
|
181 |
|
182 |
+
response = chain.invoke({"query":query,"context":contexts['relevant_contexts']})
|
183 |
|
184 |
+
#temp
|
185 |
+
st.subheader("blah response")
|
186 |
+
st.json(response.content)
|
187 |
+
|
188 |
+
# Orchestrate using SequentialChain
|
189 |
+
context_management_chain = SequentialChain(
|
190 |
+
chains=[context_relevancy_evaluation_chain ,pick_relevant_context_chain, relevant_contexts_chain,response_chain],
|
191 |
+
input_variables=["context","retriever_query","query"],
|
192 |
+
output_variables=["relevancy_response", "context_number","relevant_contexts","final_response"]
|
193 |
+
)
|
194 |
+
|
195 |
+
final_output = context_management_chain({"context":context,"retriever_query":query,"query":query})
|
196 |
+
st.subheader("Final Output from Context Management chain")
|
197 |
+
st.json(final_output)
|
198 |
+
|
199 |
+
st.subheader("Context of Final Output from Context Management chain")
|
200 |
+
st.json(final_output['context'])
|
201 |
+
|
202 |
+
|
203 |
|
204 |
--------
|
205 |
|