Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
vbarda committed Jan 14, 2025
1 parent 837fb8c commit e40bd62
Show file tree
Hide file tree
Showing 53 changed files with 50 additions and 46 deletions.
31 changes: 16 additions & 15 deletions docs/_scripts/prepare_notebooks_for_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
"docs/docs/tutorials/storm/storm.ipynb", # issues only when running with VCR
"docs/docs/tutorials/lats/lats.ipynb", # issues only when running with VCR
"docs/docs/tutorials/rag/langgraph_crag.ipynb", # flakiness from tavily
"docs/docs/tutorials/rag/langgraph_adaptive_rag.ipynb", # Cannot create a consistent method resolution error from VCR
"docs/docs/tutorials/rag/langgraph_agentic_rag.ipynb", # flakiness
"docs/docs/tutorials/rag/langgraph_self_rag.ipynb", # flakiness
"docs/docs/how-tos/map-reduce.ipynb", # flakiness from structured output, only when running with VCR
"docs/docs/tutorials/tot/tot.ipynb",
"docs/docs/how-tos/visualization.ipynb"
"docs/docs/how-tos/visualization.ipynb",
"docs/docs/tutorials/llm-compiler/LLMCompiler.ipynb"
]


Expand Down Expand Up @@ -129,7 +127,18 @@ def add_vcr_to_notebook(
uses_langsmith = True

# Add import statement
vcr_import_lines = [
vcr_import_lines = []
if uses_langsmith:
vcr_import_lines.extend([
# patch urllib3 to handle vcr errors, see more here:
# https://github.com/langchain-ai/langsmith-sdk/blob/main/python/langsmith/_internal/_patch.py
"import sys",
f"sys.path.insert(0, '{os.path.join(DOCS_PATH, '_scripts')}')",
"import _patch as patch_urllib3",
"patch_urllib3.patch_urllib3()",
])

vcr_import_lines.extend([
"import nest_asyncio",
"nest_asyncio.apply()",
"import vcr",
Expand Down Expand Up @@ -159,16 +168,8 @@ def add_vcr_to_notebook(
"",
"custom_vcr.register_serializer('advanced_compressed', AdvancedCompressedSerializer())",
"custom_vcr.serializer = 'advanced_compressed'",
]
if uses_langsmith:
vcr_import_lines.extend([
# patch urllib3 to handle vcr errors, see more here:
# https://github.com/langchain-ai/langsmith-sdk/blob/main/python/langsmith/_internal/_patch.py
"import sys",
f"sys.path.insert(0, '{os.path.join(DOCS_PATH, '_scripts')}')",
"import _patch as patch_urllib3",
"patch_urllib3.patch_urllib3()",
])
])

import_cell = nbformat.v4.new_code_cell(source="\n".join(vcr_import_lines))
import_cell.pop("id", None)
notebook.cells.insert(0, import_cell)
Expand Down

This file was deleted.

Loading

0 comments on commit e40bd62

Please sign in to comment.