Fix linting errors

This commit is contained in:
Gurjot Singh
2025-01-16 11:31:22 +05:30
parent e64805c9e2
commit 2ea104d738
2 changed files with 6 additions and 4 deletions

View File

@@ -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. 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? ##### 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` - `User Query`
- `Prompt` - `Prompt`

View File

@@ -95,20 +95,22 @@ book2 = open("./book_2.txt", encoding="utf-8")
rag.insert([book1.read(), book2.read()]) rag.insert([book1.read(), book2.read()])
# Example function demonstrating the new query_with_separate_keyword_extraction usage # Example function demonstrating the new query_with_separate_keyword_extraction usage
async def run_example(): async def run_example():
query = "What are the top themes in this story?" query = "What are the top themes in this story?"
prompt = "Please simplify the response for a young audience." prompt = "Please simplify the response for a young audience."
# Using the new method to ensure the keyword extraction is only applied to the query # Using the new method to ensure the keyword extraction is only applied to the query
response = rag.query_with_separate_keyword_extraction( response = rag.query_with_separate_keyword_extraction(
query=query, query=query,
prompt=prompt, prompt=prompt,
param=QueryParam(mode="hybrid") # Adjust QueryParam mode as necessary param=QueryParam(mode="hybrid"), # Adjust QueryParam mode as necessary
) )
print("Extracted Response:", response) print("Extracted Response:", response)
# Run the example asynchronously # Run the example asynchronously
if __name__ == "__main__": if __name__ == "__main__":
asyncio.run(run_example()) asyncio.run(run_example())