From 726234eee5b491bfa877c0c7c71fe4c59558066c Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Thu, 18 Apr 2024 16:42:03 -0700 Subject: [PATCH] infra: fix doc imports ci (#20629) --- .github/scripts/check_diff.py | 4 ++++ .github/workflows/check_diffs.yml | 3 ++- docs/docs/modules/model_io/prompts/few_shot_examples.ipynb | 2 +- .../modules/model_io/prompts/few_shot_examples_chat.ipynb | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check_diff.py b/.github/scripts/check_diff.py index de1ec42368..6ea2482b5d 100644 --- a/.github/scripts/check_diff.py +++ b/.github/scripts/check_diff.py @@ -19,6 +19,7 @@ if __name__ == "__main__": "test": set(), "extended-test": set(), } + docs_edited = False if len(files) == 300: # max diff length is 300 files - there are likely files missing @@ -76,6 +77,8 @@ if __name__ == "__main__": "an update for this new library!" ) elif any(file.startswith(p) for p in ["docs/", "templates/", "cookbook/"]): + if file.startswith("docs/"): + docs_edited = True dirs_to_run["lint"].add(".") outputs = { @@ -84,6 +87,7 @@ if __name__ == "__main__": ), "dirs-to-test": list(dirs_to_run["test"] | dirs_to_run["extended-test"]), "dirs-to-extended-test": list(dirs_to_run["extended-test"]), + "docs-edited": "true" if docs_edited else "", } for key, value in outputs.items(): json_output = json.dumps(value) diff --git a/.github/workflows/check_diffs.yml b/.github/workflows/check_diffs.yml index 764cbf7c98..f71173456b 100644 --- a/.github/workflows/check_diffs.yml +++ b/.github/workflows/check_diffs.yml @@ -36,6 +36,7 @@ jobs: dirs-to-lint: ${{ steps.set-matrix.outputs.dirs-to-lint }} dirs-to-test: ${{ steps.set-matrix.outputs.dirs-to-test }} dirs-to-extended-test: ${{ steps.set-matrix.outputs.dirs-to-extended-test }} + docs-edited: ${{ steps.set-matrix.outputs.docs-edited }} lint: name: cd ${{ matrix.working-directory }} needs: [ build ] @@ -62,7 +63,7 @@ jobs: test_doc_imports: needs: [ build ] - if: ${{ needs.build.outputs.dirs-to-test != '[]' }} + if: ${{ needs.build.outputs.dirs-to-test != '[]' || needs.build.outputs.docs-edited }} uses: ./.github/workflows/_test_doc_imports.yml secrets: inherit diff --git a/docs/docs/modules/model_io/prompts/few_shot_examples.ipynb b/docs/docs/modules/model_io/prompts/few_shot_examples.ipynb index 7a92dadbb7..7d86419325 100644 --- a/docs/docs/modules/model_io/prompts/few_shot_examples.ipynb +++ b/docs/docs/modules/model_io/prompts/few_shot_examples.ipynb @@ -254,7 +254,7 @@ ], "source": [ "from langchain_chroma import Chroma\n", - "from langchain_core.prompts.example_selector import SemanticSimilarityExampleSelector\n", + "from langchain_core.example_selectors import SemanticSimilarityExampleSelector\n", "from langchain_openai import OpenAIEmbeddings\n", "\n", "example_selector = SemanticSimilarityExampleSelector.from_examples(\n", diff --git a/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb b/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb index f83ab6344b..2e33bf6a57 100644 --- a/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb +++ b/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb @@ -202,7 +202,7 @@ "outputs": [], "source": [ "from langchain_chroma import Chroma\n", - "from langchain_core.prompts import SemanticSimilarityExampleSelector\n", + "from langchain_core.example_selectors import SemanticSimilarityExampleSelector\n", "from langchain_openai import OpenAIEmbeddings" ] },