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
fixed bug
sureenheer376d2b2bbf07
diff --git a/knowledge_storm/storm_wiki/engine.py b/knowledge_storm/storm_wiki/engine.pyindex e0c8dfc..77361ad 100644--- a/knowledge_storm/storm_wiki/engine.py+++ b/knowledge_storm/storm_wiki/engine.py@@ -16,7 +16,7 @@ from .modules.retriever import StormRetrieverfrom .modules.storm_dataclass import StormInformationTable, StormArticlefrom ..interface import Engine, LMConfigsfrom ..lm import OpenAIModel-from ..utils import FileIOHelper, makeStringRed+from ..utils import FileIOHelper, makeStringRed, truncate_filenameclass STORMWikiLMConfigs(LMConfigs):@@ -283,7 +283,7 @@ class STORMWikiRunner(Engine):"No action is specified. Please set at least one of --do-research, --do-generate-outline, --do-generate-article, --do-polish-article")self.topic = topic- self.article_dir_name = topic.replace(' ', '_').replace('/', '_')+ self.article_dir_name = truncate_filename(topic.replace(' ', '_').replace('/', '_'))self.article_output_dir = os.path.join(self.args.output_dir, self.article_dir_name)os.makedirs(self.article_output_dir, exist_ok=True)diff --git a/knowledge_storm/utils.py b/knowledge_storm/utils.pyindex 09412c6..36f68fd 100644--- a/knowledge_storm/utils.py+++ b/knowledge_storm/utils.py@@ -20,6 +20,20 @@ from trafilatura import extractlogging.getLogger("httpx").setLevel(logging.WARNING) # Disable INFO logging for httpx.+def truncate_filename(filename, max_length=125):+ """Truncate filename to max_length to ensure the filename won't exceed the file system limit.++ Args:+ filename: str+ max_length: int, default to 125 (usual path length limit is 255 chars)+ """++ if len(filename) > max_length:+ truncated_filename = filename[:max_length]+ logging.warning(f"Filename is too long. Filename is truncated to {truncated_filename}.")+ return truncated_filename++ return filenamedef load_api_key(toml_file_path):try: