adding support for more notebooks in CI (#2060)

This commit is contained in:
Isaac Francisco
2024-10-10 01:48:13 +00:00
committed by GitHub
parent db0f508269
commit aa83f4a33e
6 changed files with 36 additions and 19 deletions
+9 -5
View File
@@ -40,7 +40,6 @@ NOTEBOOKS_NO_EXECUTION = [
"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/multi_agent/hierarchical_agent_teams.ipynb", # taking a very long time to run
"docs/docs/tutorials/customer-support/customer-support.ipynb", # user input - update
"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/how-tos/map-reduce.ipynb" # flakiness from structured output, only when running with VCR
@@ -70,10 +69,13 @@ def is_comment(code: str) -> bool:
return code.strip().startswith("#")
def has_blocklisted_command(code: str) -> bool:
def has_blocklisted_command(code: str, metadata: dict) -> bool:
if 'hide_from_vcr' in metadata:
return True
code = code.strip()
for blocklisted_command in BLOCKLIST_COMMANDS:
if blocklisted_command in code:
for blocklisted_pattern in BLOCKLIST_COMMANDS:
if blocklisted_pattern in code:
return True
return False
@@ -108,7 +110,7 @@ def add_vcr_to_notebook(
if all(is_comment(line) or not line.strip() for line in lines):
continue
if has_blocklisted_command(cell.source):
if has_blocklisted_command(cell.source, cell.metadata):
continue
cell_id = cell.get("id", idx)
@@ -125,6 +127,8 @@ def add_vcr_to_notebook(
"import msgpack",
"import base64",
"import zlib",
"import os",
"os.environ.pop(\"LANGCHAIN_TRACING_V2\", None)",
"custom_vcr = vcr.VCR()",
"",
"def compress_data(data, compression_level=9):",
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -85,7 +85,7 @@
"cell_type": "code",
"execution_count": 21,
"id": "71638c2a-5038-439e-907a-de2bb548db34",
"metadata": {},
"metadata": {"hide_from_vcr": true},
"outputs": [],
"source": [
"import os\n",
@@ -176,7 +176,7 @@
"cell_type": "code",
"execution_count": 22,
"id": "654e2f81",
"metadata": {},
"metadata": {"hide_from_vcr": true},
"outputs": [],
"source": [
"import re\n",
@@ -2340,10 +2340,13 @@
" # We have an interrupt! The agent is trying to use a tool, and the user can approve or deny it\n",
" # Note: This code is all outside of your graph. Typically, you would stream the output to a UI.\n",
" # Then, you would have the frontend trigger a new run via an API call when the user has provided input.\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" try:\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" except:\n",
" user_input = \"y\"\n",
" if user_input.strip() == \"y\":\n",
" # Just continue\n",
" result = part_2_graph.invoke(\n",
@@ -2958,10 +2961,13 @@
" # We have an interrupt! The agent is trying to use a tool, and the user can approve or deny it\n",
" # Note: This code is all outside of your graph. Typically, you would stream the output to a UI.\n",
" # Then, you would have the frontend trigger a new run via an API call when the user has provided input.\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" try:\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" except:\n",
" user_input = \"y\"\n",
" if user_input.strip() == \"y\":\n",
" # Just continue\n",
" result = part_3_graph.invoke(\n",
@@ -4373,10 +4379,13 @@
" # We have an interrupt! The agent is trying to use a tool, and the user can approve or deny it\n",
" # Note: This code is all outside of your graph. Typically, you would stream the output to a UI.\n",
" # Then, you would have the frontend trigger a new run via an API call when the user has provided input.\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" try:\n",
" user_input = input(\n",
" \"Do you approve of the above actions? Type 'y' to continue;\"\n",
" \" otherwise, explain your requested changed.\\n\\n\"\n",
" )\n",
" except:\n",
" user_input = \"y\"\n",
" if user_input.strip() == \"y\":\n",
" # Just continue\n",
" result = part_4_graph.invoke(\n",