Filters #16688
Replies: 1 comment 14 replies
-
The error you're encountering, To resolve this, ensure that the
Here's a revised version of your function: def handle_chat(query_str, contract_id):
try:
# Create a filter for contractid using MetadataFilters
filters = MetadataFilters(
filters=[ExactMatchFilter(key="contractid", value=contract_id)]
)
# Use the retriever to get results filtered by contractid
retriever = index.as_retriever(filters=filters, similarity_top_k=1000)
search_results = retriever.retrieve(query_str) # Perform the search query
if not search_results:
return "No relevant results found for this contract ID."
# Pass the search results directly to the chat engine
response = chat_engine.chat(query_str, prev_chunks=search_results)
return str(response)
except Exception as e:
return f"An error occurred: {e}" Make sure that the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@dosu
def handle_chat(query_str, contract_id):
try:
# Create a filter for contractid using MetadataFilters
filters = MetadataFilters(
filters=[ExactMatchFilter(key="contractid", value=contract_id)]
)
Beta Was this translation helpful? Give feedback.
All reactions