From 2ea104d738d64e39525099a191410f2f86f695cd Mon Sep 17 00:00:00 2001 From: Gurjot Singh Date: Thu, 16 Jan 2025 11:31:22 +0530 Subject: [PATCH] Fix linting errors --- README.md | 2 +- examples/query_keyword_separation_example.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 233fe56d..8a0da666 100644 --- a/README.md +++ b/README.md @@ -334,7 +334,7 @@ with open("./newText.txt") as f: We've introduced a new function `query_with_separate_keyword_extraction` to enhance the keyword extraction capabilities. This function separates the keyword extraction process from the user's prompt, focusing solely on the query to improve the relevance of extracted keywords. ##### How It Works? -The function operates by dividing the input into two parts: +The function operates by dividing the input into two parts: - `User Query` - `Prompt` diff --git a/examples/query_keyword_separation_example.py b/examples/query_keyword_separation_example.py index 43606834..f11ce8c1 100644 --- a/examples/query_keyword_separation_example.py +++ b/examples/query_keyword_separation_example.py @@ -95,20 +95,22 @@ book2 = open("./book_2.txt", encoding="utf-8") rag.insert([book1.read(), book2.read()]) + # Example function demonstrating the new query_with_separate_keyword_extraction usage async def run_example(): query = "What are the top themes in this story?" prompt = "Please simplify the response for a young audience." - + # Using the new method to ensure the keyword extraction is only applied to the query response = rag.query_with_separate_keyword_extraction( query=query, prompt=prompt, - param=QueryParam(mode="hybrid") # Adjust QueryParam mode as necessary + param=QueryParam(mode="hybrid"), # Adjust QueryParam mode as necessary ) - + print("Extracted Response:", response) + # Run the example asynchronously if __name__ == "__main__": asyncio.run(run_example())