An LLM-powered knowledge curation system that researches a topic and generates a full-length report with citations.
Python agentic-ragdeep-researchemnlp2024knowledge-curationlarge-language-modelsnaaclnlpreport-generationretrieval-augmented-generation
Made changes based off feedback
zenith110f97b7558e626
diff --git a/knowledge_storm/rm.py b/knowledge_storm/rm.pyindex 3d0a5fb..743428d 100644--- a/knowledge_storm/rm.py+++ b/knowledge_storm/rm.py@@ -1,7 +1,6 @@import loggingimport osfrom typing import Callable, Union, List-from duckduckgo_search import DDGSimport dspyimport requests@@ -510,6 +509,7 @@ class BraveRM(dspy.Retrieve):return collected_results+class DuckDuckGoSearchRM(dspy.Retrieve):"""Retrieve information from custom queries using DuckDuckGo."""def __init__(@@ -530,7 +530,10 @@ class DuckDuckGoSearchRM(dspy.Retrieve):**kwargs: Additional parameters for the OpenAI API."""super().__init__(k=k)-+ try:+ from duckduckgo_search import DDGS+ except ImportError as err:+ raise ImportError("Duckduckgo requires `pip install duckduckgo_search`.") from errself.k = kself.webpage_helper = WebPageHelper(min_char_count=min_char_count,@@ -560,13 +563,11 @@ class DuckDuckGoSearchRM(dspy.Retrieve):# Import the duckduckgo search library found here: https://github.com/deedy5/duckduckgo_searchself.ddgs = DDGS()- # Store usage of credits and reset the class usage variabledef get_usage_and_reset(self):usage = self.usageself.usage = 0return {'DuckDuckGoRM': usage}- # this is the important function that is used by Retriever in the pipelinedef forward(self, query_or_queries: Union[str, List[str]], exclude_urls: List[str] = []):diff --git a/requirements.txt b/requirements.txtindex 5a679ff..7e1a88a 100644--- a/requirements.txt+++ b/requirements.txt@@ -7,5 +7,4 @@ trafilaturalangchain-huggingfaceqdrant-clientlangchain-qdrant-numpy==1.26.4-duckduckgo_search\ No newline at end of file+numpy==1.26.4\ No newline at end of file