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
Manually updated all examples except serper to follow the same style as main branch
zenith11089be9743e94a
diff --git a/examples/helper/process_kaggle_arxiv_abstract_dataset.py b/examples/helper/process_kaggle_arxiv_abstract_dataset.pyindex 30583c4..1a07d06 100644--- a/examples/helper/process_kaggle_arxiv_abstract_dataset.py+++ b/examples/helper/process_kaggle_arxiv_abstract_dataset.py@@ -8,28 +8,21 @@ import pandas as pdif __name__ == "__main__":parser = ArgumentParser()- parser.add_argument(- "--input-path", type=str, help="Path to arxiv_data_210930-054931.csv."- )- parser.add_argument(- "--output-path",- type=str,- help="Path to store the csv file that is compatible with VectorRM.",- )+ parser.add_argument("--input-path", type=str, help="Path to arxiv_data_210930-054931.csv.")+ parser.add_argument("--output-path", type=str,+ help="Path to store the csv file that is compatible with VectorRM.")args = parser.parse_args()df = pd.read_csv(args.input_path)- print(f"The original dataset has {len(df)} samples.")+ print(f'The original dataset has {len(df)} samples.')# Downsample the dataset.- df = df[df["terms"] == "['cs.CV']"]+ df = df[df['terms'] == "['cs.CV']"]# Reformat the dataset to match the VectorRM input format.df.rename(columns={"abstracts": "content", "titles": "title"}, inplace=True)- df["url"] = [- "uid_" + str(idx) for idx in range(len(df))- ] # Ensure the url is unique.- df["description"] = ""+ df['url'] = ['uid_' + str(idx) for idx in range(len(df))] # Ensure the url is unique.+ df['description'] = ''- print(f"The downsampled dataset has {len(df)} samples.")- df.to_csv(args.output_path, index=False)+ print(f'The downsampled dataset has {len(df)} samples.')+ df.to_csv(args.output_path, index=False)\ No newline at end of filediff --git a/examples/run_storm_wiki_claude.py b/examples/run_storm_wiki_claude.pyindex 3d6847c..64031f6 100644--- a/examples/run_storm_wiki_claude.py+++ b/examples/run_storm_wiki_claude.py@@ -19,23 +19,19 @@ args.output_dir/import osfrom argparse import ArgumentParser-from knowledge_storm import (- STORMWikiRunnerArguments,- STORMWikiRunner,- STORMWikiLMConfigs,-)+from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigsfrom knowledge_storm.lm import ClaudeModelfrom knowledge_storm.rm import YouRM, BingSearchfrom knowledge_storm.utils import load_api_keydef main(args):- load_api_key(toml_file_path="secrets.toml")+ load_api_key(toml_file_path='secrets.toml')lm_configs = STORMWikiLMConfigs()claude_kwargs = {- "api_key": os.getenv("ANTHROPIC_API_KEY"),- "temperature": 1.0,- "top_p": 0.9,+ 'api_key': os.getenv("ANTHROPIC_API_KEY"),+ 'temperature': 1.0,+ 'top_p': 0.9}# STORM is a LM system so different components can be powered by different models.@@ -43,21 +39,11 @@ def main(args):# which is used to split queries, synthesize answers in the conversation. We recommend using stronger models# for outline_gen_lm which is responsible for organizing the collected information, and article_gen_lm# which is responsible for generating sections with citations.- conv_simulator_lm = ClaudeModel(- model="claude-3-haiku-20240307", max_tokens=500, **claude_kwargs- )- question_asker_lm = ClaudeModel(- model="claude-3-sonnet-20240229", max_tokens=500, **claude_kwargs- )- outline_gen_lm = ClaudeModel(- model="claude-3-opus-20240229", max_tokens=400, **claude_kwargs- )- article_gen_lm = ClaudeModel(- model="claude-3-opus-20240229", max_tokens=700, **claude_kwargs- )- article_polish_lm = ClaudeModel(- model="claude-3-opus-20240229", max_tokens=4000, **claude_kwargs- )+ conv_simulator_lm = ClaudeModel(model='claude-3-haiku-20240307', max_tokens=500, **claude_kwargs)+ question_asker_lm = ClaudeModel(model='claude-3-sonnet-20240229', max_tokens=500, **claude_kwargs)+ outline_gen_lm = ClaudeModel(model='claude-3-opus-20240229', max_tokens=400, **claude_kwargs)+ article_gen_lm = ClaudeModel(model='claude-3-opus-20240229', max_tokens=700, **claude_kwargs)+ article_polish_lm = ClaudeModel(model='claude-3-opus-20240229', max_tokens=4000, **claude_kwargs)lm_configs.set_conv_simulator_lm(conv_simulator_lm)lm_configs.set_question_asker_lm(question_asker_lm)@@ -75,16 +61,14 @@ def main(args):# STORM is a knowledge curation system which consumes information from the retrieval module.# Currently, the information source is the Internet and we use search engine API as the retrieval module.- if args.retriever == "bing":- rm = BingSearch(- bing_search_api=os.getenv("BING_SEARCH_API_KEY"), k=engine_args.search_top_k- )- elif args.retriever == "you":- rm = YouRM(ydc_api_key=os.getenv("YDC_API_KEY"), k=engine_args.search_top_k)+ if args.retriever == 'bing':+ rm = BingSearch(bing_search_api=os.getenv('BING_SEARCH_API_KEY'), k=engine_args.search_top_k)+ elif args.retriever == 'you':+ rm = YouRM(ydc_api_key=os.getenv('YDC_API_KEY'), k=engine_args.search_top_k)runner = STORMWikiRunner(engine_args, lm_configs, rm)- topic = input("Topic: ")+ topic = input('Topic: ')runner.run(topic=topic,do_research=args.do_research,@@ -96,81 +80,38 @@ def main(args):runner.summary()-if __name__ == "__main__":+if __name__ == '__main__':parser = ArgumentParser()# global arguments- parser.add_argument(- "--output-dir",- type=str,- default="./results/claude",- help="Directory to store the outputs.",- )- parser.add_argument(- "--max-thread-num",- type=int,- default=3,- help="Maximum number of threads to use. The information seeking part and the article generation"- "part can speed up by using multiple threads. Consider reducing it if keep getting "- '"Exceed rate limit" error when calling LM API.',- )- parser.add_argument(- "--retriever",- type=str,- choices=["bing", "you"],- help="The search engine API to use for retrieving information.",- )+ parser.add_argument('--output-dir', type=str, default='./results/claude',+ help='Directory to store the outputs.')+ parser.add_argument('--max-thread-num', type=int, default=3,+ help='Maximum number of threads to use. The information seeking part and the article generation'+ 'part can speed up by using multiple threads. Consider reducing it if keep getting '+ '"Exceed rate limit" error when calling LM API.')+ parser.add_argument('--retriever', type=str, choices=['bing', 'you'],+ help='The search engine API to use for retrieving information.')# stage of the pipeline- parser.add_argument(- "--do-research",- action="store_true",- help="If True, simulate conversation to research the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-outline",- action="store_true",- help="If True, generate an outline for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-article",- action="store_true",- help="If True, generate an article for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-polish-article",- action="store_true",- help="If True, polish the article by adding a summarization section and (optionally) removing "- "duplicate content.",- )+ parser.add_argument('--do-research', action='store_true',+ help='If True, simulate conversation to research the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-outline', action='store_true',+ help='If True, generate an outline for the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-article', action='store_true',+ help='If True, generate an article for the topic; otherwise, load the results.')+ parser.add_argument('--do-polish-article', action='store_true',+ help='If True, polish the article by adding a summarization section and (optionally) removing '+ 'duplicate content.')# hyperparameters for the pre-writing stage- parser.add_argument(- "--max-conv-turn",- type=int,- default=3,- help="Maximum number of questions in conversational question asking.",- )- parser.add_argument(- "--max-perspective",- type=int,- default=3,- help="Maximum number of perspectives to consider in perspective-guided question asking.",- )- parser.add_argument(- "--search-top-k",- type=int,- default=3,- help="Top k search results to consider for each search query.",- )+ parser.add_argument('--max-conv-turn', type=int, default=3,+ help='Maximum number of questions in conversational question asking.')+ parser.add_argument('--max-perspective', type=int, default=3,+ help='Maximum number of perspectives to consider in perspective-guided question asking.')+ parser.add_argument('--search-top-k', type=int, default=3,+ help='Top k search results to consider for each search query.')# hyperparameters for the writing stage- parser.add_argument(- "--retrieve-top-k",- type=int,- default=3,- help="Top k collected references for each section title.",- )- parser.add_argument(- "--remove-duplicate",- action="store_true",- help="If True, remove duplicate content from the article.",- )+ parser.add_argument('--retrieve-top-k', type=int, default=3,+ help='Top k collected references for each section title.')+ parser.add_argument('--remove-duplicate', action='store_true',+ help='If True, remove duplicate content from the article.')- main(parser.parse_args())+ main(parser.parse_args())\ No newline at end of filediff --git a/examples/run_storm_wiki_deepseek.py b/examples/run_storm_wiki_deepseek.pyindex d159e94..2a7b256 100644--- a/examples/run_storm_wiki_deepseek.py+++ b/examples/run_storm_wiki_deepseek.py@@ -23,11 +23,7 @@ import reimport loggingfrom argparse import ArgumentParser-from knowledge_storm import (- STORMWikiRunnerArguments,- STORMWikiRunner,- STORMWikiLMConfigs,-)+from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigsfrom knowledge_storm.lm import DeepSeekModelfrom knowledge_storm.rm import YouRM, BingSearchfrom knowledge_storm.utils import load_api_key@@ -39,10 +35,10 @@ def sanitize_topic(topic):Remove or replace characters that are not allowed in file names."""# Replace spaces with underscores- topic = topic.replace(" ", "_")+ topic = topic.replace(' ', '_')# Remove any character that isn't alphanumeric, underscore, or hyphen- topic = re.sub(r"[^a-zA-Z0-9_-]", "", topic)+ topic = re.sub(r'[^a-zA-Z0-9_-]', '', topic)# Ensure the topic isn't empty after sanitizationif not topic:@@ -52,35 +48,27 @@ def sanitize_topic(topic):def main(args):- load_api_key(toml_file_path="secrets.toml")+ load_api_key(toml_file_path='secrets.toml')lm_configs = STORMWikiLMConfigs()# Ensure DEEPSEEK_API_KEY is setif not os.getenv("DEEPSEEK_API_KEY"):- raise ValueError(- "DEEPSEEK_API_KEY environment variable is not set. Please set it in your secrets.toml file."- )+ raise ValueError("DEEPSEEK_API_KEY environment variable is not set. Please set it in your secrets.toml file.")deepseek_kwargs = {- "api_key": os.getenv("DEEPSEEK_API_KEY"),- "api_base": os.getenv("DEEPSEEK_API_BASE", "https://api.deepseek.com"),- "temperature": args.temperature,- "top_p": args.top_p,+ 'api_key': os.getenv("DEEPSEEK_API_KEY"),+ 'api_base': os.getenv("DEEPSEEK_API_BASE", "https://api.deepseek.com"),+ 'temperature': args.temperature,+ 'top_p': args.top_p,}# DeepSeek offers two main models: 'deepseek-chat' for general tasks and 'deepseek-coder' for coding tasks# Users can choose the appropriate model based on their needs- conv_simulator_lm = DeepSeekModel(- model=args.model, max_tokens=500, **deepseek_kwargs- )- question_asker_lm = DeepSeekModel(- model=args.model, max_tokens=500, **deepseek_kwargs- )+ conv_simulator_lm = DeepSeekModel(model=args.model, max_tokens=500, **deepseek_kwargs)+ question_asker_lm = DeepSeekModel(model=args.model, max_tokens=500, **deepseek_kwargs)outline_gen_lm = DeepSeekModel(model=args.model, max_tokens=400, **deepseek_kwargs)article_gen_lm = DeepSeekModel(model=args.model, max_tokens=700, **deepseek_kwargs)- article_polish_lm = DeepSeekModel(- model=args.model, max_tokens=4000, **deepseek_kwargs- )+ article_polish_lm = DeepSeekModel(model=args.model, max_tokens=4000, **deepseek_kwargs)lm_configs.set_conv_simulator_lm(conv_simulator_lm)lm_configs.set_question_asker_lm(question_asker_lm)@@ -98,20 +86,16 @@ def main(args):# STORM is a knowledge curation system which consumes information from the retrieval module.# Currently, the information source is the Internet and we use search engine API as the retrieval module.- if args.retriever == "bing":- rm = BingSearch(- bing_search_api=os.getenv("BING_SEARCH_API_KEY"), k=engine_args.search_top_k- )- elif args.retriever == "you":- rm = YouRM(ydc_api_key=os.getenv("YDC_API_KEY"), k=engine_args.search_top_k)+ if args.retriever == 'bing':+ rm = BingSearch(bing_search_api=os.getenv('BING_SEARCH_API_KEY'), k=engine_args.search_top_k)+ elif args.retriever == 'you':+ rm = YouRM(ydc_api_key=os.getenv('YDC_API_KEY'), k=engine_args.search_top_k)else:- raise ValueError(- f"Invalid retriever: {args.retriever}. Choose either 'bing' or 'you'."- )+ raise ValueError(f"Invalid retriever: {args.retriever}. Choose either 'bing' or 'you'.")runner = STORMWikiRunner(engine_args, lm_configs, rm)- topic = input("Topic: ")+ topic = input('Topic: ')sanitized_topic = sanitize_topic(topic)try:@@ -130,95 +114,44 @@ def main(args):raise-if __name__ == "__main__":+if __name__ == '__main__':parser = ArgumentParser()# global arguments- parser.add_argument(- "--output-dir",- type=str,- default="./results/deepseek",- help="Directory to store the outputs.",- )- parser.add_argument(- "--max-thread-num",- type=int,- default=3,- help="Maximum number of threads to use. The information seeking part and the article generation"- "part can speed up by using multiple threads. Consider reducing it if keep getting "- '"Exceed rate limit" error when calling LM API.',- )- parser.add_argument(- "--retriever",- type=str,- choices=["bing", "you"],- required=True,- help="The search engine API to use for retrieving information.",- )- parser.add_argument(- "--model",- type=str,- choices=["deepseek-chat", "deepseek-coder"],- default="deepseek-chat",- help='DeepSeek model to use. "deepseek-chat" for general tasks, "deepseek-coder" for coding tasks.',- )- parser.add_argument(- "--temperature", type=float, default=1.0, help="Sampling temperature to use."- )- parser.add_argument(- "--top_p", type=float, default=0.9, help="Top-p sampling parameter."- )+ parser.add_argument('--output-dir', type=str, default='./results/deepseek',+ help='Directory to store the outputs.')+ parser.add_argument('--max-thread-num', type=int, default=3,+ help='Maximum number of threads to use. The information seeking part and the article generation'+ 'part can speed up by using multiple threads. Consider reducing it if keep getting '+ '"Exceed rate limit" error when calling LM API.')+ parser.add_argument('--retriever', type=str, choices=['bing', 'you'], required=True,+ help='The search engine API to use for retrieving information.')+ parser.add_argument('--model', type=str, choices=['deepseek-chat', 'deepseek-coder'], default='deepseek-chat',+ help='DeepSeek model to use. "deepseek-chat" for general tasks, "deepseek-coder" for coding tasks.')+ parser.add_argument('--temperature', type=float, default=1.0,+ help='Sampling temperature to use.')+ parser.add_argument('--top_p', type=float, default=0.9,+ help='Top-p sampling parameter.')# stage of the pipeline- parser.add_argument(- "--do-research",- action="store_true",- help="If True, simulate conversation to research the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-outline",- action="store_true",- help="If True, generate an outline for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-article",- action="store_true",- help="If True, generate an article for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-polish-article",- action="store_true",- help="If True, polish the article by adding a summarization section and (optionally) removing "- "duplicate content.",- )+ parser.add_argument('--do-research', action='store_true',+ help='If True, simulate conversation to research the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-outline', action='store_true',+ help='If True, generate an outline for the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-article', action='store_true',+ help='If True, generate an article for the topic; otherwise, load the results.')+ parser.add_argument('--do-polish-article', action='store_true',+ help='If True, polish the article by adding a summarization section and (optionally) removing '+ 'duplicate content.')# hyperparameters for the pre-writing stage- parser.add_argument(- "--max-conv-turn",- type=int,- default=3,- help="Maximum number of questions in conversational question asking.",- )- parser.add_argument(- "--max-perspective",- type=int,- default=3,- help="Maximum number of perspectives to consider in perspective-guided question asking.",- )- parser.add_argument(- "--search-top-k",- type=int,- default=3,- help="Top k search results to consider for each search query.",- )+ parser.add_argument('--max-conv-turn', type=int, default=3,+ help='Maximum number of questions in conversational question asking.')+ parser.add_argument('--max-perspective', type=int, default=3,+ help='Maximum number of perspectives to consider in perspective-guided question asking.')+ parser.add_argument('--search-top-k', type=int, default=3,+ help='Top k search results to consider for each search query.')# hyperparameters for the writing stage- parser.add_argument(- "--retrieve-top-k",- type=int,- default=3,- help="Top k collected references for each section title.",- )- parser.add_argument(- "--remove-duplicate",- action="store_true",- help="If True, remove duplicate content from the article.",- )+ parser.add_argument('--retrieve-top-k', type=int, default=3,+ help='Top k collected references for each section title.')+ parser.add_argument('--remove-duplicate', action='store_true',+ help='If True, remove duplicate content from the article.')- main(parser.parse_args())+ main(parser.parse_args())\ No newline at end of filediff --git a/examples/run_storm_wiki_gpt.py b/examples/run_storm_wiki_gpt.pyindex b97c1c4..5e4dda3 100644--- a/examples/run_storm_wiki_gpt.py+++ b/examples/run_storm_wiki_gpt.py@@ -22,54 +22,40 @@ args.output_dir/import osfrom argparse import ArgumentParser-from knowledge_storm import (- STORMWikiRunnerArguments,- STORMWikiRunner,- STORMWikiLMConfigs,-)+from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigsfrom knowledge_storm.lm import OpenAIModel, AzureOpenAIModelfrom knowledge_storm.rm import YouRM, BingSearchfrom knowledge_storm.utils import load_api_keydef main(args):- load_api_key(toml_file_path="secrets.toml")+ load_api_key(toml_file_path='secrets.toml')lm_configs = STORMWikiLMConfigs()openai_kwargs = {- "api_key": os.getenv("OPENAI_API_KEY"),- "temperature": 1.0,- "top_p": 0.9,+ 'api_key': os.getenv("OPENAI_API_KEY"),+ 'temperature': 1.0,+ 'top_p': 0.9,}- ModelClass = (- OpenAIModel if os.getenv("OPENAI_API_TYPE") == "openai" else AzureOpenAIModel- )+ ModelClass = OpenAIModel if os.getenv('OPENAI_API_TYPE') == 'openai' else AzureOpenAIModel# If you are using Azure service, make sure the model name matches your own deployed model name.# The default name here is only used for demonstration and may not match your case.- gpt_35_model_name = (- "gpt-3.5-turbo" if os.getenv("OPENAI_API_TYPE") == "openai" else "gpt-35-turbo"- )- gpt_4_model_name = "gpt-4o"- if os.getenv("OPENAI_API_TYPE") == "azure":- openai_kwargs["api_base"] = os.getenv("AZURE_API_BASE")- openai_kwargs["api_version"] = os.getenv("AZURE_API_VERSION")+ gpt_35_model_name = 'gpt-3.5-turbo' if os.getenv('OPENAI_API_TYPE') == 'openai' else 'gpt-35-turbo'+ gpt_4_model_name = 'gpt-4o'+ if os.getenv('OPENAI_API_TYPE') == 'azure':+ openai_kwargs['api_base'] = os.getenv('AZURE_API_BASE')+ openai_kwargs['api_version'] = os.getenv('AZURE_API_VERSION')# STORM is a LM system so different components can be powered by different models.# For a good balance between cost and quality, you can choose a cheaper/faster model for conv_simulator_lm# which is used to split queries, synthesize answers in the conversation. We recommend using stronger models# for outline_gen_lm which is responsible for organizing the collected information, and article_gen_lm# which is responsible for generating sections with citations.- conv_simulator_lm = ModelClass(- model=gpt_35_model_name, max_tokens=500, **openai_kwargs- )- question_asker_lm = ModelClass(- model=gpt_35_model_name, max_tokens=500, **openai_kwargs- )+ conv_simulator_lm = ModelClass(model=gpt_35_model_name, max_tokens=500, **openai_kwargs)+ question_asker_lm = ModelClass(model=gpt_35_model_name, max_tokens=500, **openai_kwargs)outline_gen_lm = ModelClass(model=gpt_4_model_name, max_tokens=400, **openai_kwargs)article_gen_lm = ModelClass(model=gpt_4_model_name, max_tokens=700, **openai_kwargs)- article_polish_lm = ModelClass(- model=gpt_4_model_name, max_tokens=4000, **openai_kwargs- )+ article_polish_lm = ModelClass(model=gpt_4_model_name, max_tokens=4000, **openai_kwargs)lm_configs.set_conv_simulator_lm(conv_simulator_lm)lm_configs.set_question_asker_lm(question_asker_lm)@@ -87,16 +73,14 @@ def main(args):# STORM is a knowledge curation system which consumes information from the retrieval module.# Currently, the information source is the Internet and we use search engine API as the retrieval module.- if args.retriever == "bing":- rm = BingSearch(- bing_search_api=os.getenv("BING_SEARCH_API_KEY"), k=engine_args.search_top_k- )- elif args.retriever == "you":- rm = YouRM(ydc_api_key=os.getenv("YDC_API_KEY"), k=engine_args.search_top_k)+ if args.retriever == 'bing':+ rm = BingSearch(bing_search_api=os.getenv('BING_SEARCH_API_KEY'), k=engine_args.search_top_k)+ elif args.retriever == 'you':+ rm = YouRM(ydc_api_key=os.getenv('YDC_API_KEY'), k=engine_args.search_top_k)runner = STORMWikiRunner(engine_args, lm_configs, rm)- topic = input("Topic: ")+ topic = input('Topic: ')runner.run(topic=topic,do_research=args.do_research,@@ -108,81 +92,38 @@ def main(args):runner.summary()-if __name__ == "__main__":+if __name__ == '__main__':parser = ArgumentParser()# global arguments- parser.add_argument(- "--output-dir",- type=str,- default="./results/gpt",- help="Directory to store the outputs.",- )- parser.add_argument(- "--max-thread-num",- type=int,- default=3,- help="Maximum number of threads to use. The information seeking part and the article generation"- "part can speed up by using multiple threads. Consider reducing it if keep getting "- '"Exceed rate limit" error when calling LM API.',- )- parser.add_argument(- "--retriever",- type=str,- choices=["bing", "you"],- help="The search engine API to use for retrieving information.",- )+ parser.add_argument('--output-dir', type=str, default='./results/gpt',+ help='Directory to store the outputs.')+ parser.add_argument('--max-thread-num', type=int, default=3,+ help='Maximum number of threads to use. The information seeking part and the article generation'+ 'part can speed up by using multiple threads. Consider reducing it if keep getting '+ '"Exceed rate limit" error when calling LM API.')+ parser.add_argument('--retriever', type=str, choices=['bing', 'you'],+ help='The search engine API to use for retrieving information.')# stage of the pipeline- parser.add_argument(- "--do-research",- action="store_true",- help="If True, simulate conversation to research the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-outline",- action="store_true",- help="If True, generate an outline for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-article",- action="store_true",- help="If True, generate an article for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-polish-article",- action="store_true",- help="If True, polish the article by adding a summarization section and (optionally) removing "- "duplicate content.",- )+ parser.add_argument('--do-research', action='store_true',+ help='If True, simulate conversation to research the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-outline', action='store_true',+ help='If True, generate an outline for the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-article', action='store_true',+ help='If True, generate an article for the topic; otherwise, load the results.')+ parser.add_argument('--do-polish-article', action='store_true',+ help='If True, polish the article by adding a summarization section and (optionally) removing '+ 'duplicate content.')# hyperparameters for the pre-writing stage- parser.add_argument(- "--max-conv-turn",- type=int,- default=3,- help="Maximum number of questions in conversational question asking.",- )- parser.add_argument(- "--max-perspective",- type=int,- default=3,- help="Maximum number of perspectives to consider in perspective-guided question asking.",- )- parser.add_argument(- "--search-top-k",- type=int,- default=3,- help="Top k search results to consider for each search query.",- )+ parser.add_argument('--max-conv-turn', type=int, default=3,+ help='Maximum number of questions in conversational question asking.')+ parser.add_argument('--max-perspective', type=int, default=3,+ help='Maximum number of perspectives to consider in perspective-guided question asking.')+ parser.add_argument('--search-top-k', type=int, default=3,+ help='Top k search results to consider for each search query.')# hyperparameters for the writing stage- parser.add_argument(- "--retrieve-top-k",- type=int,- default=3,- help="Top k collected references for each section title.",- )- parser.add_argument(- "--remove-duplicate",- action="store_true",- help="If True, remove duplicate content from the article.",- )+ parser.add_argument('--retrieve-top-k', type=int, default=3,+ help='Top k collected references for each section title.')+ parser.add_argument('--remove-duplicate', action='store_true',+ help='If True, remove duplicate content from the article.')- main(parser.parse_args())+ main(parser.parse_args())\ No newline at end of filediff --git a/examples/run_storm_wiki_gpt_with_VectorRM.py b/examples/run_storm_wiki_gpt_with_VectorRM.pyindex 6eed844..d6662d3 100644--- a/examples/run_storm_wiki_gpt_with_VectorRM.py+++ b/examples/run_storm_wiki_gpt_with_VectorRM.py@@ -30,11 +30,7 @@ import osimport sysfrom argparse import ArgumentParser-from knowledge_storm import (- STORMWikiRunnerArguments,- STORMWikiRunner,- STORMWikiLMConfigs,-)+from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigsfrom knowledge_storm.rm import VectorRMfrom knowledge_storm.lm import OpenAIModel, AzureOpenAIModelfrom knowledge_storm.utils import load_api_key@@ -42,45 +38,35 @@ from knowledge_storm.utils import load_api_keydef main(args):# Load API key from the specified toml file path- load_api_key(toml_file_path="secrets.toml")+ load_api_key(toml_file_path='secrets.toml')# Initialize the language model configurationsengine_lm_configs = STORMWikiLMConfigs()openai_kwargs = {- "api_key": os.getenv("OPENAI_API_KEY"),- "temperature": 1.0,- "top_p": 0.9,+ 'api_key': os.getenv("OPENAI_API_KEY"),+ 'temperature': 1.0,+ 'top_p': 0.9,}- ModelClass = (- OpenAIModel if os.getenv("OPENAI_API_TYPE") == "openai" else AzureOpenAIModel- )+ ModelClass = OpenAIModel if os.getenv('OPENAI_API_TYPE') == 'openai' else AzureOpenAIModel# If you are using Azure service, make sure the model name matches your own deployed model name.# The default name here is only used for demonstration and may not match your case.- gpt_35_model_name = (- "gpt-3.5-turbo" if os.getenv("OPENAI_API_TYPE") == "openai" else "gpt-35-turbo"- )- gpt_4_model_name = "gpt-4o"- if os.getenv("OPENAI_API_TYPE") == "azure":- openai_kwargs["api_base"] = os.getenv("AZURE_API_BASE")- openai_kwargs["api_version"] = os.getenv("AZURE_API_VERSION")+ gpt_35_model_name = 'gpt-3.5-turbo' if os.getenv('OPENAI_API_TYPE') == 'openai' else 'gpt-35-turbo'+ gpt_4_model_name = 'gpt-4o'+ if os.getenv('OPENAI_API_TYPE') == 'azure':+ openai_kwargs['api_base'] = os.getenv('AZURE_API_BASE')+ openai_kwargs['api_version'] = os.getenv('AZURE_API_VERSION')# STORM is a LM system so different components can be powered by different models.- # For a good balance between cost and quality, you can choose a cheaper/faster model for conv_simulator_lm+ # For a good balance between cost and quality, you can choose a cheaper/faster model for conv_simulator_lm# which is used to split queries, synthesize answers in the conversation. We recommend using stronger models# for outline_gen_lm which is responsible for organizing the collected information, and article_gen_lm# which is responsible for generating sections with citations.- conv_simulator_lm = ModelClass(- model=gpt_35_model_name, max_tokens=500, **openai_kwargs- )- question_asker_lm = ModelClass(- model=gpt_35_model_name, max_tokens=500, **openai_kwargs- )+ conv_simulator_lm = ModelClass(model=gpt_35_model_name, max_tokens=500, **openai_kwargs)+ question_asker_lm = ModelClass(model=gpt_35_model_name, max_tokens=500, **openai_kwargs)outline_gen_lm = ModelClass(model=gpt_4_model_name, max_tokens=400, **openai_kwargs)article_gen_lm = ModelClass(model=gpt_4_model_name, max_tokens=700, **openai_kwargs)- article_polish_lm = ModelClass(- model=gpt_4_model_name, max_tokens=4000, **openai_kwargs- )+ article_polish_lm = ModelClass(model=gpt_4_model_name, max_tokens=4000, **openai_kwargs)engine_lm_configs.set_conv_simulator_lm(conv_simulator_lm)engine_lm_configs.set_question_asker_lm(question_asker_lm)@@ -98,36 +84,30 @@ def main(args):)# Setup VectorRM to retrieve information from your own data- rm = VectorRM(- collection_name=args.collection_name,- device=args.device,- k=engine_args.search_top_k,- )+ rm = VectorRM(collection_name=args.collection_name, device=args.device, k=engine_args.search_top_k)# initialize the vector store, either online (store the db on Qdrant server) or offline (store the db locally):- if args.vector_db_mode == "offline":+ if args.vector_db_mode == 'offline':rm.init_offline_vector_db(vector_store_path=args.offline_vector_db_dir)- elif args.vector_db_mode == "online":- rm.init_online_vector_db(- url=args.online_vector_db_url, api_key=os.getenv("QDRANT_API_KEY")- )+ elif args.vector_db_mode == 'online':+ rm.init_online_vector_db(url=args.online_vector_db_url, api_key=os.getenv('QDRANT_API_KEY'))# Update the vector store with the documents in the csv fileif args.update_vector_store:rm.update_vector_store(file_path=args.csv_file_path,- content_column="content",- title_column="title",- url_column="url",- desc_column="description",- batch_size=args.embed_batch_size,+ content_column='content',+ title_column='title',+ url_column='url',+ desc_column='description',+ batch_size=args.embed_batch_size)# Initialize the STORM Wiki Runnerrunner = STORMWikiRunner(engine_args, engine_lm_configs, rm)# run the pipeline- topic = input("Topic: ")+ topic = input('Topic: ')runner.run(topic=topic,do_research=args.do_research,@@ -142,119 +122,51 @@ def main(args):if __name__ == "__main__":parser = ArgumentParser()# global arguments- parser.add_argument(- "--output-dir",- type=str,- default="./results/gpt_retrieval",- help="Directory to store the outputs.",- )- parser.add_argument(- "--max-thread-num",- type=int,- default=3,- help="Maximum number of threads to use. The information seeking part and the article generation"- "part can speed up by using multiple threads. Consider reducing it if keep getting "- '"Exceed rate limit" error when calling LM API.',- )+ parser.add_argument('--output-dir', type=str, default='./results/gpt_retrieval',+ help='Directory to store the outputs.')+ parser.add_argument('--max-thread-num', type=int, default=3,+ help='Maximum number of threads to use. The information seeking part and the article generation'+ 'part can speed up by using multiple threads. Consider reducing it if keep getting '+ '"Exceed rate limit" error when calling LM API.')# provide local corpus and set up vector db- parser.add_argument(- "--collection-name",- type=str,- default="my_documents",- help="The collection name for vector store.",- )- parser.add_argument(- "--device",- type=str,- default="mps",- help="The device used to run the retrieval model (mps, cuda, cpu, etc).",- )- parser.add_argument(- "--vector-db-mode",- type=str,- choices=["offline", "online"],- help="The mode of the Qdrant vector store (offline or online).",- )- parser.add_argument(- "--offline-vector-db-dir",- type=str,- default="./vector_store",- help="If use offline mode, please provide the directory to store the vector store.",- )- parser.add_argument(- "--online-vector-db-url",- type=str,- help="If use online mode, please provide the url of the Qdrant server.",- )- parser.add_argument(- "--update-vector-store",- action="store_true",- help="If True, update the vector store with the documents in the csv file; otherwise, "- "use the existing vector store.",- )- parser.add_argument(- "--csv-file-path",- type=str,- help="The path of the custom document corpus in CSV format. The CSV file should include "- "content, title, url, and description columns.",- )- parser.add_argument(- "--embed-batch-size",- type=int,- default=64,- help="Batch size for embedding the documents in the csv file.",- )+ parser.add_argument('--collection-name', type=str, default="my_documents",+ help='The collection name for vector store.')+ parser.add_argument('--device', type=str, default="mps",+ help='The device used to run the retrieval model (mps, cuda, cpu, etc).')+ parser.add_argument('--vector-db-mode', type=str, choices=['offline', 'online'],+ help='The mode of the Qdrant vector store (offline or online).')+ parser.add_argument('--offline-vector-db-dir', type=str, default='./vector_store',+ help='If use offline mode, please provide the directory to store the vector store.')+ parser.add_argument('--online-vector-db-url', type=str,+ help='If use online mode, please provide the url of the Qdrant server.')+ parser.add_argument('--update-vector-store', action='store_true',+ help='If True, update the vector store with the documents in the csv file; otherwise, '+ 'use the existing vector store.')+ parser.add_argument('--csv-file-path', type=str,+ help='The path of the custom document corpus in CSV format. The CSV file should include '+ 'content, title, url, and description columns.')+ parser.add_argument('--embed-batch-size', type=int, default=64,+ help='Batch size for embedding the documents in the csv file.')# stage of the pipeline- parser.add_argument(- "--do-research",- action="store_true",- help="If True, simulate conversation to research the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-outline",- action="store_true",- help="If True, generate an outline for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-article",- action="store_true",- help="If True, generate an article for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-polish-article",- action="store_true",- help="If True, polish the article by adding a summarization section and (optionally) removing "- "duplicate content.",- )+ parser.add_argument('--do-research', action='store_true',+ help='If True, simulate conversation to research the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-outline', action='store_true',+ help='If True, generate an outline for the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-article', action='store_true',+ help='If True, generate an article for the topic; otherwise, load the results.')+ parser.add_argument('--do-polish-article', action='store_true',+ help='If True, polish the article by adding a summarization section and (optionally) removing '+ 'duplicate content.')# hyperparameters for the pre-writing stage- parser.add_argument(- "--max-conv-turn",- type=int,- default=3,- help="Maximum number of questions in conversational question asking.",- )- parser.add_argument(- "--max-perspective",- type=int,- default=3,- help="Maximum number of perspectives to consider in perspective-guided question asking.",- )- parser.add_argument(- "--search-top-k",- type=int,- default=3,- help="Top k search results to consider for each search query.",- )+ parser.add_argument('--max-conv-turn', type=int, default=3,+ help='Maximum number of questions in conversational question asking.')+ parser.add_argument('--max-perspective', type=int, default=3,+ help='Maximum number of perspectives to consider in perspective-guided question asking.')+ parser.add_argument('--search-top-k', type=int, default=3,+ help='Top k search results to consider for each search query.')# hyperparameters for the writing stage- parser.add_argument(- "--retrieve-top-k",- type=int,- default=3,- help="Top k collected references for each section title.",- )- parser.add_argument(- "--remove-duplicate",- action="store_true",- help="If True, remove duplicate content from the article.",- )- main(parser.parse_args())+ parser.add_argument('--retrieve-top-k', type=int, default=3,+ help='Top k collected references for each section title.')+ parser.add_argument('--remove-duplicate', action='store_true',+ help='If True, remove duplicate content from the article.')+ main(parser.parse_args())\ No newline at end of filediff --git a/examples/run_storm_wiki_ollama.py b/examples/run_storm_wiki_ollama.pyindex 2e93046..76f85dc 100644--- a/examples/run_storm_wiki_ollama.py+++ b/examples/run_storm_wiki_ollama.py@@ -1,8 +1,8 @@"""-STORM Wiki pipeline powered by local model hosted by Ollama server and You.com or Bing search engine.+STORM Wiki pipeline powered by Mistral-7B-Instruct-v0.2 hosted by VLLM server and You.com search engine.You need to set up the following environment variables to run this script:- YDC_API_KEY: You.com API key; or, BING_SEARCH_API_KEY: Bing Search API key-You also need to have a Ollama server running with the llama3 model or other. Specify `--url`, `--port` and `--model` accordingly.+You also need to have a VLLM server running with the Mistral-7B-Instruct-v0.2 model. Specify `--url` and `--port` accordingly.Output will be structured as belowargs.output_dir/@@ -15,42 +15,33 @@ args.output_dir/storm_gen_article.txt # Final article generatedstorm_gen_article_polished.txt # Polished final article (if args.do_polish_article is True)"""-import os-import sysfrom argparse import ArgumentParserfrom dspy import Example-sys.path.append("./src")-from lm import OllamaClient-from rm import YouRM, BingSearch-from storm_wiki.engine import (- STORMWikiRunnerArguments,- STORMWikiRunner,- STORMWikiLMConfigs,-)-from utils import load_api_key+from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigs+from knowledge_storm.lm import VLLMClient+from knowledge_storm.rm import YouRM, BingSearch+from knowledge_storm.utils import load_api_keydef main(args):- load_api_key(toml_file_path="secrets.toml")+ load_api_key(toml_file_path='secrets.toml')lm_configs = STORMWikiLMConfigs()- ollama_kwargs = {- "model": args.model,+ mistral_kwargs = {+ "model": "mistralai/Mistral-7B-Instruct-v0.2","port": args.port,"url": args.url,- "stop": (- "\n\n---",- ), # dspy uses "\n\n---" to separate examples. Open models sometimes generate this.+ "stop": ('\n\n---',) # dspy uses "\n\n---" to separate examples. Open models sometimes generate this.}- conv_simulator_lm = OllamaClient(max_tokens=500, **ollama_kwargs)- question_asker_lm = OllamaClient(max_tokens=500, **ollama_kwargs)- outline_gen_lm = OllamaClient(max_tokens=400, **ollama_kwargs)- article_gen_lm = OllamaClient(max_tokens=700, **ollama_kwargs)- article_polish_lm = OllamaClient(max_tokens=4000, **ollama_kwargs)+ conv_simulator_lm = VLLMClient(max_tokens=500, **mistral_kwargs)+ question_asker_lm = VLLMClient(max_tokens=500, **mistral_kwargs)+ outline_gen_lm = VLLMClient(max_tokens=400, **mistral_kwargs)+ article_gen_lm = VLLMClient(max_tokens=700, **mistral_kwargs)+ article_polish_lm = VLLMClient(max_tokens=4000, **mistral_kwargs)lm_configs.set_conv_simulator_lm(conv_simulator_lm)lm_configs.set_question_asker_lm(question_asker_lm)@@ -68,12 +59,10 @@ def main(args):# STORM is a knowledge curation system which consumes information from the retrieval module.# Currently, the information source is the Internet and we use search engine API as the retrieval module.- if args.retriever == "bing":- rm = BingSearch(- bing_search_api=os.getenv("BING_SEARCH_API_KEY"), k=engine_args.search_top_k- )- elif args.retriever == "you":- rm = YouRM(ydc_api_key=os.getenv("YDC_API_KEY"), k=engine_args.search_top_k)+ if args.retriever == 'bing':+ rm = BingSearch(bing_search_api=os.getenv('BING_SEARCH_API_KEY'), k=engine_args.search_top_k)+ elif args.retriever == 'you':+ rm = YouRM(ydc_api_key=os.getenv('YDC_API_KEY'), k=engine_args.search_top_k)runner = STORMWikiRunner(engine_args, lm_configs, rm)@@ -85,28 +74,26 @@ def main(args):find_related_topic_example = Example(topic="Knowledge Curation",related_topics="https://en.wikipedia.org/wiki/Knowledge_management\n"- "https://en.wikipedia.org/wiki/Information_science\n"- "https://en.wikipedia.org/wiki/Library_science\n",+ "https://en.wikipedia.org/wiki/Information_science\n"+ "https://en.wikipedia.org/wiki/Library_science\n")gen_persona_example = Example(topic="Knowledge Curation",examples="Title: Knowledge management\n"- "Table of Contents: History\nResearch\n Dimensions\n Strategies\n Motivations\nKM technologies"- "\nKnowledge barriers\nKnowledge retention\nKnowledge audit\nKnowledge protection\n"- " Knowledge protection methods\n Formal methods\n Informal methods\n"- " Balancing knowledge protection and knowledge sharing\n Knowledge protection risks",+ "Table of Contents: History\nResearch\n Dimensions\n Strategies\n Motivations\nKM technologies"+ "\nKnowledge barriers\nKnowledge retention\nKnowledge audit\nKnowledge protection\n"+ " Knowledge protection methods\n Formal methods\n Informal methods\n"+ " Balancing knowledge protection and knowledge sharing\n Knowledge protection risks",personas="1. Historian of Knowledge Systems: This editor will focus on the history and evolution of knowledge curation. They will provide context on how knowledge curation has changed over time and its impact on modern practices.\n"- "2. Information Science Professional: With insights from 'Information science', this editor will explore the foundational theories, definitions, and philosophy that underpin knowledge curation\n"- "3. Digital Librarian: This editor will delve into the specifics of how digital libraries operate, including software, metadata, digital preservation.\n"- "4. Technical expert: This editor will focus on the technical aspects of knowledge curation, such as common features of content management systems.\n"- "5. Museum Curator: The museum curator will contribute expertise on the curation of physical items and the transition of these practices into the digital realm.",+ "2. Information Science Professional: With insights from 'Information science', this editor will explore the foundational theories, definitions, and philosophy that underpin knowledge curation\n"+ "3. Digital Librarian: This editor will delve into the specifics of how digital libraries operate, including software, metadata, digital preservation.\n"+ "4. Technical expert: This editor will focus on the technical aspects of knowledge curation, such as common features of content management systems.\n"+ "5. Museum Curator: The museum curator will contribute expertise on the curation of physical items and the transition of these practices into the digital realm.")runner.storm_knowledge_curation_module.persona_generator.create_writer_with_persona.find_related_topic.demos = [- find_related_topic_example- ]+ find_related_topic_example]runner.storm_knowledge_curation_module.persona_generator.create_writer_with_persona.gen_persona.demos = [- gen_persona_example- ]+ gen_persona_example]# A trade-off of adding one-shot example is that it will increase the input length of the prompt. Also, some# examples may be very long (e.g., an example for writing a section based on the given information), which may@@ -118,28 +105,24 @@ def main(args):topic="Example Topic",conv="Wikipedia Writer: ...\nExpert: ...\nWikipedia Writer: ...\nExpert: ...",old_outline="# Section 1\n## Subsection 1\n## Subsection 2\n"- "# Section 2\n## Subsection 1\n## Subsection 2\n"- "# Section 3",+ "# Section 2\n## Subsection 1\n## Subsection 2\n"+ "# Section 3",outline="# New Section 1\n## New Subsection 1\n## New Subsection 2\n"- "# New Section 2\n"- "# New Section 3\n## New Subsection 1\n## New Subsection 2\n## New Subsection 3",+ "# New Section 2\n"+ "# New Section 3\n## New Subsection 1\n## New Subsection 2\n## New Subsection 3")- runner.storm_outline_generation_module.write_outline.write_page_outline.demos = [- write_page_outline_example- ]+ runner.storm_outline_generation_module.write_outline.write_page_outline.demos = [write_page_outline_example]write_section_example = Example(info="[1]\nInformation in document 1\n[2]\nInformation in document 2\n[3]\nInformation in document 3",topic="Example Topic",section="Example Section",output="# Example Topic\n## Subsection 1\n"- "This is an example sentence [1]. This is another example sentence [2][3].\n"- "## Subsection 2\nThis is one more example sentence [1].",+ "This is an example sentence [1]. This is another example sentence [2][3].\n"+ "## Subsection 2\nThis is one more example sentence [1].")- runner.storm_article_generation.section_gen.write_section.demos = [- write_section_example- ]+ runner.storm_article_generation.section_gen.write_section.demos = [write_section_example]- topic = input("Topic: ")+ topic = input('Topic: ')runner.run(topic=topic,do_research=args.do_research,@@ -151,90 +134,42 @@ def main(args):runner.summary()-if __name__ == "__main__":+if __name__ == '__main__':parser = ArgumentParser()# global arguments- parser.add_argument(- "--url", type=str, default="http://localhost", help="URL of the Ollama server."- )- parser.add_argument(- "--port", type=int, default=11434, help="Port of the Ollama server."- )- parser.add_argument(- "--model", type=str, default="llama3:latest", help="Model of the Ollama server."- )- parser.add_argument(- "--output-dir",- type=str,- default="./results/ollama",- help="Directory to store the outputs.",- )- parser.add_argument(- "--max-thread-num",- type=int,- default=3,- help="Maximum number of threads to use. The information seeking part and the article generation"- "part can speed up by using multiple threads. Consider reducing it if keep getting "- '"Exceed rate limit" error when calling LM API.',- )- parser.add_argument(- "--retriever",- type=str,- choices=["bing", "you"],- help="The search engine API to use for retrieving information.",- )+ parser.add_argument('--url', type=str, default='http://localhost',+ help='URL of the VLLM server.')+ parser.add_argument('--port', type=int, default=8000,+ help='Port of the VLLM server.')+ parser.add_argument('--output-dir', type=str, default='./results/mistral_7b',+ help='Directory to store the outputs.')+ parser.add_argument('--max-thread-num', type=int, default=3,+ help='Maximum number of threads to use. The information seeking part and the article generation'+ 'part can speed up by using multiple threads. Consider reducing it if keep getting '+ '"Exceed rate limit" error when calling LM API.')+ parser.add_argument('--retriever', type=str, choices=['bing', 'you'],+ help='The search engine API to use for retrieving information.')# stage of the pipeline- parser.add_argument(- "--do-research",- action="store_true",- help="If True, simulate conversation to research the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-outline",- action="store_true",- help="If True, generate an outline for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-generate-article",- action="store_true",- help="If True, generate an article for the topic; otherwise, load the results.",- )- parser.add_argument(- "--do-polish-article",- action="store_true",- help="If True, polish the article by adding a summarization section and (optionally) removing "- "duplicate content.",- )+ parser.add_argument('--do-research', action='store_true',+ help='If True, simulate conversation to research the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-outline', action='store_true',+ help='If True, generate an outline for the topic; otherwise, load the results.')+ parser.add_argument('--do-generate-article', action='store_true',+ help='If True, generate an article for the topic; otherwise, load the results.')+ parser.add_argument('--do-polish-article', action='store_true',+ help='If True, polish the article by adding a summarization section and (optionally) removing '+ 'duplicate content.')# hyperparameters for the pre-writing stage- parser.add_argument(- "--max-conv-turn",- type=int,- default=3,- help="Maximum number of questions in conversational question asking.",- )- parser.add_argument(- "--max-perspective",- type=int,- default=3,- help="Maximum number of perspectives to consider in perspective-guided question asking.",- )- parser.add_argument(- "--search-top-k",- type=int,- default=3,- help="Top k search results to consider for each search query.",- )+ parser.add_argument('--max-conv-turn', type=int, default=3,+ help='Maximum number of questions in conversational question asking.')+ parser.add_argument('--max-perspective', type=int, default=3,+ help='Maximum number of perspectives to consider in perspective-guided question asking.')+ parser.add_argument('--search-top-k', type=int, default=3,+ help='Top k search results to consider for each search query.')# hyperparameters for the writing stage- parser.add_argument(- "--retrieve-top-k",- type=int,- default=3,- help="Top k collected references for each section title.",- )- parser.add_argument(- "--remove-duplicate",- action="store_true",- help="If True, remove duplicate content from the article.",- )+ parser.add_argument('--retrieve-top-k', type=int, default=3,+ help='Top k collected references for each section title.')+ parser.add_argument('--remove-duplicate', action='store_true',+ help='If True, remove duplicate content from the article.')- main(parser.parse_args())+ main(parser.parse_args())\ No newline at end of filediff --git a/examples/run_storm_wiki_serper.py b/examples/run_storm_wiki_serper.pyindex 70c2ac1..df27b98 100644--- a/examples/run_storm_wiki_serper.py+++ b/examples/run_storm_wiki_serper.py@@ -101,7 +101,7 @@ if __name__ == "__main__":parser.add_argument("--output-dir",type=str,- default="./results/claude",+ default="./results/serper",help="Directory to store the outputs.",)parser.add_argument(