From d59b0c0d3877e09a9d84588ef371e7bced97846b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 6 Jan 2025 09:38:53 -0500 Subject: [PATCH 1/4] Add github action to codespell main on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..c59e0473 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From 4a58a91d78d4b62a7ca9c2880cb12971be3c66fe Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 6 Jan 2025 09:38:53 -0500 Subject: [PATCH 2/4] Add rudimentary codespell config --- .codespellrc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..fe851c03 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git*,*.pdf,*.svg,.codespellrc +check-hidden = true +# ignore-regex = +# ignore-words-list = From 9e1c0362cc4d9bb9ab35ca43847f266e88d5d1a8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 6 Jan 2025 09:38:53 -0500 Subject: [PATCH 3/4] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cca527c..ae6adf7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,4 +7,9 @@ repos: entry: black args: ["knowledge_storm/"] language: python - pass_filenames: true \ No newline at end of file + pass_filenames: true + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in .codespellrc + rev: v2.3.0 + hooks: + - id: codespell From fa573a5f017c07c9ec5768d115a0508685e5c63b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 6 Jan 2025 09:39:27 -0500 Subject: [PATCH 4/4] [DATALAD RUNCMD] run codespell throughout fixing few left typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- examples/storm_examples/run_storm_wiki_serper.py | 2 +- frontend/demo_light/pages_util/CreateNewArticle.py | 2 +- .../modules/costorm_expert_utterance_generator.py | 4 ++-- .../modules/information_insertion_module.py | 2 +- knowledge_storm/lm.py | 2 +- knowledge_storm/storm_wiki/modules/storm_dataclass.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/storm_examples/run_storm_wiki_serper.py b/examples/storm_examples/run_storm_wiki_serper.py index df27b98b..8ab6b41b 100644 --- a/examples/storm_examples/run_storm_wiki_serper.py +++ b/examples/storm_examples/run_storm_wiki_serper.py @@ -77,7 +77,7 @@ def main(args): # Important to note that tbs(date range is hardcoded values). # num is results per pages and is recommended to use in increments of 10(10, 20, etc). # page is how many pages will be searched. - # h1 is where the google search will orginate from. + # h1 is where the google search will originate from. topic = input("topic: ") data = {"autocorrect": True, "num": 10, "page": 1} rm = SerperRM(serper_search_api_key=os.getenv("SERPER_API_KEY"), query_params=data) diff --git a/frontend/demo_light/pages_util/CreateNewArticle.py b/frontend/demo_light/pages_util/CreateNewArticle.py index 2257044a..938a2554 100644 --- a/frontend/demo_light/pages_util/CreateNewArticle.py +++ b/frontend/demo_light/pages_util/CreateNewArticle.py @@ -81,7 +81,7 @@ def handle_final_writing(): # update status bar st.session_state["page3_write_article_state"] = "prepare_to_show_result" - status.update(label="information snythesis complete!", state="complete") + status.update(label="information synthesis complete!", state="complete") def handle_prepare_to_show_result(): if st.session_state["page3_write_article_state"] == "prepare_to_show_result": diff --git a/knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py b/knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py index 2c7c3505..bfa395ec 100644 --- a/knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py +++ b/knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py @@ -33,7 +33,7 @@ class GenExpertActionPlanning(dspy.Signature): last_utterance = dspy.InputField( prefix="Last utterance in the conversation: \n", format=str ) - resposne = dspy.OutputField( + response = dspy.OutputField( prefix="Now give your note. Start with one of [Original Question, Further Details, Information Request, Potential Answer] with one sentence description\n", format=str, ) @@ -126,7 +126,7 @@ def forward( expert=current_expert, summary=conversation_summary, last_utterance=last_utterance, - ).resposne + ).response action_type, action_content = self.parse_action(action) if self.callback_handler is not None: diff --git a/knowledge_storm/collaborative_storm/modules/information_insertion_module.py b/knowledge_storm/collaborative_storm/modules/information_insertion_module.py index c858671b..e67a3c63 100644 --- a/knowledge_storm/collaborative_storm/modules/information_insertion_module.py +++ b/knowledge_storm/collaborative_storm/modules/information_insertion_module.py @@ -79,7 +79,7 @@ def _get_navigation_choice( if child_names: structure += f"Child Nodes: {child_names}" navigated_path = " -> ".join(knowledge_node.get_path_from_root()) - structure += f"Path you have nagivated: {navigated_path}" + structure += f"Path you have navigated: {navigated_path}" # get predicted action with dspy.settings.context(lm=self.engine): diff --git a/knowledge_storm/lm.py b/knowledge_storm/lm.py index 0cae49be..ea195423 100644 --- a/knowledge_storm/lm.py +++ b/knowledge_storm/lm.py @@ -488,7 +488,7 @@ def __call__(self, prompt, only_completed=True, return_sorted=False, **kwargs): assert return_sorted is False, "for now" # per eg here: https://docs.anthropic.com/claude/reference/messages-examples # max tokens can be used as a proxy to return smaller responses - # so this cannot be a proper indicator for incomplete response unless it isnt the user-intent. + # so this cannot be a proper indicator for incomplete response unless it isn't the user-intent. n = kwargs.pop("n", 1) completions = [] for _ in range(n): diff --git a/knowledge_storm/storm_wiki/modules/storm_dataclass.py b/knowledge_storm/storm_wiki/modules/storm_dataclass.py index 75812d9c..7a97f947 100644 --- a/knowledge_storm/storm_wiki/modules/storm_dataclass.py +++ b/knowledge_storm/storm_wiki/modules/storm_dataclass.py @@ -387,7 +387,7 @@ def pre_order_find_index(node): pre_order_find_index(child) pre_order_find_index(self.root) - # constrcut index mapping + # construct index mapping ref_index_mapping = {} for ref_index in ref_indices: if ref_index not in ref_index_mapping: