diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8c0bf1..1be13c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: args: ["-r", "faststream_gen"] - repo: https://github.com/returntocorp/semgrep - rev: "v1.14.0" + rev: "v1.61.1" hooks: - id: semgrep name: Semgrep diff --git a/faststream_gen/_code_generator/chat.py b/faststream_gen/_code_generator/chat.py index 8c0599e..5f0098a 100644 --- a/faststream_gen/_code_generator/chat.py +++ b/faststream_gen/_code_generator/chat.py @@ -98,7 +98,7 @@ def _get_relevant_document(query: str) -> str: The content of the most relevant document as a string. """ db_path = get_root_data_path() / "docs" - db = FAISS.load_local(db_path, OpenAIEmbeddings()) + db = FAISS.load_local(db_path, OpenAIEmbeddings()) # type: ignore results = db.max_marginal_relevance_search(query, k=1, fetch_k=3) results_str = "\n".join([result.page_content for result in results]) return results_str diff --git a/faststream_gen/_code_generator/helper.py b/faststream_gen/_code_generator/helper.py index 3eaf9fa..bb71621 100644 --- a/faststream_gen/_code_generator/helper.py +++ b/faststream_gen/_code_generator/helper.py @@ -196,7 +196,7 @@ def get_relevant_prompt_examples(query: str) -> Dict[str, str]: The dictionary of the most relevant examples for each step. """ db_path = get_root_data_path() / "examples" - db = FAISS.load_local(db_path, OpenAIEmbeddings()) + db = FAISS.load_local(db_path, OpenAIEmbeddings()) # type: ignore results = db.similarity_search(query, k=3, fetch_k=5) results_page_content = [r.page_content for r in results] prompt_examples = _format_examples(results_page_content) diff --git a/nbs/Chat.ipynb b/nbs/Chat.ipynb index 2bb1694..a667c70 100644 --- a/nbs/Chat.ipynb +++ b/nbs/Chat.ipynb @@ -230,7 +230,7 @@ " The content of the most relevant document as a string.\n", " \"\"\"\n", " db_path = get_root_data_path() / \"docs\"\n", - " db = FAISS.load_local(db_path, OpenAIEmbeddings())\n", + " db = FAISS.load_local(db_path, OpenAIEmbeddings()) # type: ignore\n", " results = db.max_marginal_relevance_search(query, k=1, fetch_k=3)\n", " results_str = \"\\n\".join([result.page_content for result in results])\n", " return results_str" diff --git a/nbs/Helper.ipynb b/nbs/Helper.ipynb index 1c12095..2a25a03 100644 --- a/nbs/Helper.ipynb +++ b/nbs/Helper.ipynb @@ -594,7 +594,7 @@ " The dictionary of the most relevant examples for each step.\n", " \"\"\"\n", " db_path = get_root_data_path() / \"examples\"\n", - " db = FAISS.load_local(db_path, OpenAIEmbeddings())\n", + " db = FAISS.load_local(db_path, OpenAIEmbeddings()) # type: ignore\n", " results = db.similarity_search(query, k=3, fetch_k=5)\n", " results_page_content = [r.page_content for r in results]\n", " prompt_examples = _format_examples(results_page_content)\n", diff --git a/settings.ini b/settings.ini index 0676867..d93c911 100644 --- a/settings.ini +++ b/settings.ini @@ -54,7 +54,7 @@ requirements = \ dev_requirements = \ nbdev-mkdocs==0.6.0 \ bandit==1.7.5 \ - semgrep==1.34.1 \ + semgrep==1.61.1 \ pytest==7.4.2 \ nbqa==1.7.0 \ black==23.7.0 \