Skip to content

fix LangGraph notebook (requiring langgraph>0.3.1) #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/nightly-test.yml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ jobs:
[[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue
IGNORE_LIST+=("$skip_nb")
done < .github/ignore-notebooks.txt

# 3) Filter out notebooks that match anything in IGNORE_LIST
FILTERED_NBS=()
for nb in $NBS; do
@@ -47,16 +47,16 @@ jobs:
FILTERED_NBS+=("$nb")
fi
done

# 4) Stuff into a single-line JSON array
NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \
| jq -R . \
| jq -s -c .)

if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then
NB_JSON="[]"
fi

echo "All valid notebooks: $NB_JSON"

# 5) Check if there's anything in FILTERED_NBS
@@ -65,7 +65,7 @@ jobs:
else
echo "has_notebooks=false" >> $GITHUB_OUTPUT
fi

echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT

# ---------------------------------------------------------
@@ -99,7 +99,7 @@ jobs:
python -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install pytest nbval
pip install --no-cache-dir pytest nbval

- name: Test notebook
env:
@@ -108,4 +108,4 @@ jobs:
run: |
echo "Testing notebook: ${{ matrix.notebook }}"
source venv/bin/activate
pytest --nbval-lax --disable-warnings "${{ matrix.notebook }}"
pytest --nbval-lax --nbval-cell-timeout=300 --disable-warnings "${{ matrix.notebook }}"
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -27,15 +27,15 @@ jobs:
# 1) Compare this commit/PR to 'main' and list changed notebooks
git fetch --depth=1 origin main
CHANGED_NOTEBOOKS=$(git diff --name-only origin/main | grep '\.ipynb$' || true)

# 2) Load notebooks to ignore
IGNORE_LIST=()
while IFS= read -r skip_nb || [ -n "$skip_nb" ]; do
# Skip empty lines or comment lines
[[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue
IGNORE_LIST+=("$skip_nb")
done < .github/ignore-notebooks.txt

# 3) Filter out ignored notebooks
FILTERED_NBS=()
for nb in $CHANGED_NOTEBOOKS; do
@@ -52,16 +52,16 @@ jobs:
FILTERED_NBS+=("$nb")
fi
done

# 4) Stuff into a single-line JSON array
NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \
| jq -R . \
| jq -s -c .)

if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then
NB_JSON="[]"
fi

echo "All valid notebooks: $NB_JSON"

# 5) Check if there's anything in FILTERED_NBS
@@ -104,7 +104,7 @@ jobs:
python -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install pytest nbval
pip install --no-cache-dir pytest nbval

- name: Test notebook
env:
@@ -113,4 +113,4 @@ jobs:
run: |
echo "Testing notebook: ${{ matrix.notebook }}"
source venv/bin/activate
pytest --nbval-lax --disable-warnings "${{ matrix.notebook }}"
pytest --nbval-lax --nbval-cell-timeout=300 --disable-warnings "${{ matrix.notebook }}"
6 changes: 3 additions & 3 deletions python-recipes/agents/00_langgraph_redis_agentic_rag.ipynb
Original file line number Diff line number Diff line change
@@ -38,14 +38,14 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "969fb438",
"metadata": {
"id": "969fb438"
},
"outputs": [],
"source": [
"%pip install -q langchain-community tiktoken langchain-openai langchainhub \"langchain-redis>=0.2.0\" langchain langgraph langchain-text-splitters bs4"
"%pip install -q --upgrade --force-reinstall langchain-community tiktoken langchain-openai langchainhub \"langchain-redis>=0.2.0\" langchain \"langgraph>0.3.1\" langchain-text-splitters bs4"
]
},
{
@@ -666,7 +666,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.13.1"
}
},
"nbformat": 4,
8 changes: 4 additions & 4 deletions python-recipes/agents/02_full_featured_agent.ipynb
Original file line number Diff line number Diff line change
@@ -30,13 +30,13 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"id": "Zz62U5COgF21"
},
"outputs": [],
"source": [
"%pip install -q langchain langchain-openai \"langchain-redis>=0.2.0\" langgraph sentence-transformers"
"%pip install -q --upgrade --force-reinstall langchain langchain-openai \"langchain-redis>=0.2.0\" \"langgraph>0.3.1\" sentence-transformers"
]
},
{
@@ -969,7 +969,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -985,7 +985,7 @@
" if cache_hit:\n",
" print(\"Cache hit - short circuit\")\n",
" return cache_hit\n",
" \n",
"\n",
" return graph.invoke({\"messages\": question})\n"
]
}