Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -168,11 +168,11 @@ def retrieve_context(state):
|
|
168 |
"""
|
169 |
print("---------retrieve_context---------")
|
170 |
query = state['expanded_query'] # Complete the code to define the key for the expanded query
|
171 |
-
print("Query used for retrieval:", query) # Debugging: Print the query
|
172 |
|
173 |
# Retrieve documents from the vector store
|
174 |
docs = retriever.invoke(query)
|
175 |
-
print("Retrieved documents:", docs) # Debugging: Print the raw docs object
|
176 |
|
177 |
# Extract both page_content and metadata from each document
|
178 |
context = [
|
@@ -221,7 +221,7 @@ If the context does not contain enough information to answer accurately, clearly
|
|
221 |
"feedback": state.get('feedback', 'No feedback provided') # add feedback to the prompt
|
222 |
})
|
223 |
state['response'] = response
|
224 |
-
print("intermediate response: ", response) #uncomment this line to see intermediate response
|
225 |
|
226 |
return state
|
227 |
|
@@ -337,7 +337,7 @@ Focus on biblical coherence, faith-based reasoning, and alignment with the theme
|
|
337 |
|
338 |
# Store response suggestions in a structured format
|
339 |
feedback = f"Previous Response: {state['response']}\nSuggestions: {chain.invoke({'query': state['query'], 'response': state['response']})}"
|
340 |
-
print("feedback: ", feedback) #uncomment this line to see feedback
|
341 |
print(f"State: {state}")
|
342 |
state['feedback'] = feedback
|
343 |
return state
|
@@ -370,7 +370,7 @@ Focus on biblical coherence, faith-based reasoning, and alignment with the theme
|
|
370 |
|
371 |
# Store refinement suggestions without modifying the original expanded query
|
372 |
query_feedback = f"Previous Expanded Query: {state['expanded_query']}\nSuggestions: {chain.invoke({'query': state['query'], 'expanded_query': state['expanded_query']})}"
|
373 |
-
print("query_feedback: ", query_feedback)
|
374 |
print(f"Groundedness loop count: {state['groundedness_loop_count']}")
|
375 |
state['query_feedback'] = query_feedback
|
376 |
return state
|
@@ -659,7 +659,7 @@ Your goal is to walk alongside users on their spiritual journey, offering encour
|
|
659 |
context += "---\n"
|
660 |
|
661 |
# Print context for debugging purposes
|
662 |
-
print("Context: ", context)
|
663 |
|
664 |
# Prepare a prompt combining past context and the current query
|
665 |
prompt = f"""
|
|
|
168 |
"""
|
169 |
print("---------retrieve_context---------")
|
170 |
query = state['expanded_query'] # Complete the code to define the key for the expanded query
|
171 |
+
#print("Query used for retrieval:", query) # Debugging: Print the query
|
172 |
|
173 |
# Retrieve documents from the vector store
|
174 |
docs = retriever.invoke(query)
|
175 |
+
#print("Retrieved documents:", docs) # Debugging: Print the raw docs object
|
176 |
|
177 |
# Extract both page_content and metadata from each document
|
178 |
context = [
|
|
|
221 |
"feedback": state.get('feedback', 'No feedback provided') # add feedback to the prompt
|
222 |
})
|
223 |
state['response'] = response
|
224 |
+
#print("intermediate response: ", response) #uncomment this line to see intermediate response
|
225 |
|
226 |
return state
|
227 |
|
|
|
337 |
|
338 |
# Store response suggestions in a structured format
|
339 |
feedback = f"Previous Response: {state['response']}\nSuggestions: {chain.invoke({'query': state['query'], 'response': state['response']})}"
|
340 |
+
#print("feedback: ", feedback) #uncomment this line to see feedback
|
341 |
print(f"State: {state}")
|
342 |
state['feedback'] = feedback
|
343 |
return state
|
|
|
370 |
|
371 |
# Store refinement suggestions without modifying the original expanded query
|
372 |
query_feedback = f"Previous Expanded Query: {state['expanded_query']}\nSuggestions: {chain.invoke({'query': state['query'], 'expanded_query': state['expanded_query']})}"
|
373 |
+
#print("query_feedback: ", query_feedback)
|
374 |
print(f"Groundedness loop count: {state['groundedness_loop_count']}")
|
375 |
state['query_feedback'] = query_feedback
|
376 |
return state
|
|
|
659 |
context += "---\n"
|
660 |
|
661 |
# Print context for debugging purposes
|
662 |
+
#print("Context: ", context)
|
663 |
|
664 |
# Prepare a prompt combining past context and the current query
|
665 |
prompt = f"""
|