Skip to content

docs(examples): document what the examples need in order to run - #596

Merged
williedoran-neo4j merged 2 commits into
neo4j:mainfrom
williedoran-neo4j:willie/examples-env-and-docs
Aug 13, 2026
Merged

docs(examples): document what the examples need in order to run#596
williedoran-neo4j merged 2 commits into
neo4j:mainfrom
williedoran-neo4j:willie/examples-env-and-docs

Conversation

@williedoran-neo4j

@williedoran-neo4j williedoran-neo4j commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #595, now that the services are easy to start.

examples/README.md is a pure link index: no mention of API keys, extras, Docker, or the fact that 17 examples talk to a remote demo database. What setup knowledge exists is spread across the root README's Tests section and three per-store READMEs.

Documentation

examples/SETUP.md — what you need in order to run the examples: credentials, the services, which providers are free or have a local equivalent, and the traps that cost the most time. Running from the repo root; the three examples that need PYTHONPATH=examples/data; the two that write to a read-only demo database and so fail with Forbidden as written.

examples/.env.example — a credential template, with .env variants gitignored and the template itself kept tracked.

Every count in SETUP.md was checked against the code rather than estimated — "17 examples use the demo database", "14 call load_dotenv()", "three need PYTHONPATH", the two empty splitter files.

Not documentation — three Ollama examples change behaviour

Flagging this explicitly, because it is code in an otherwise-docs PR.

They could not be run as shipped. ollama_llm.py and ollama_embeddings.py carried a literal model_name="<model_name>" placeholder that had to be edited before the example would do anything. Documenting "first edit this file" would have been documenting a defect, so the model became a command-line argument instead:

ollama pull llama3.2
python examples/customize/llms/ollama_llm.py llama3.2   # or omit it for the default

Which model you have is a property of your machine, not of the example, which is why it is an argument rather than a new hardcoded constant. Defaults are llama3.2 for the LLMs and nomic-embed-text for the embedder, so all three now run with no arguments after a single ollama pull.

One is a real default change worth calling out: ollama_tool_calls.py was not a placeholder — it hardcoded mistral:latest. It now defaults to llama3.2, so that one ollama pull covers all three examples rather than two models being needed. Both support tool calling; the docstring now says to check the model's Ollama page before substituting one that may not.

That file's run instructions also pointed at examples/tool_calls/ollama_tool_calls.py, a path that does not exist. Corrected.

Packaging

python-dotenv and requests are now declared in the examples extra. Fourteen examples call load_dotenv() and tools_retriever_example.py calls a web API with requests, but neither was declared, so both resolved only transitively — working by accident.

Also

The Weaviate and Pinecone READMEs gave python -m a slash path, which cannot work; -m takes a dotted module path. Fixed rather than documented.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update
  • Project configuration change

Complexity

Complexity: Low

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual tests

All three Ollama examples confirmed to parse their arguments and print help. Every command quoted in SETUP.md run as written, and every numeric claim in it re-derived from the code. Green on ruff, mypy --strict and the unit suite.

Checklist

  • Documentation has been updated
  • Unit tests have been updated
  • E2E tests have been updated
  • Examples have been updated
  • New files have copyright header (Markdown and .env template only)
  • CLA (https://neo4j.com/developer/cla/) has been signed
  • CHANGELOG.md updated if appropriate

🤖 Generated with Claude Code

examples/README.md is a pure link index: no mention of API keys, extras, Docker,
or the fact that 17 examples talk to a remote demo database. What setup knowledge
exists is spread across the root README's Tests section and three per-store
READMEs.

Adds examples/SETUP.md covering credentials, the services, which providers are
free or have a local equivalent, and the traps that cost the most time - running
from the repo root, the three examples needing PYTHONPATH=examples/data, and the
examples that cannot work as written against a read-only demo database. Adds
examples/.env.example as a credential template, and gitignores .env variants
while keeping the template tracked.

Declares python-dotenv and requests in the examples extra. Fourteen examples call
load_dotenv() and tools_retriever_example.py calls a web API with requests, but
neither was declared, so both resolved only transitively.

The three Ollama examples now take the model as an argument rather than shipping
a placeholder to edit, since which model you have depends on what you pulled.

Fixes the Weaviate and Pinecone READMEs, which gave `python -m` a slash path.

Every count in SETUP.md was checked against the code rather than estimated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@williedoran-neo4j
williedoran-neo4j force-pushed the willie/examples-env-and-docs branch from 8ad0580 to 54b1cfe Compare August 12, 2026 12:02
@williedoran-neo4j
williedoran-neo4j marked this pull request as ready for review August 12, 2026 12:20
@williedoran-neo4j
williedoran-neo4j requested a review from a team as a code owner August 12, 2026 12:20

@AmirLayegh AmirLayegh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Left a few comments that might be worth addressing before merging.

Comment thread examples/SETUP.md Outdated
Comment thread examples/SETUP.md Outdated
Review feedback on neo4j#596.

The two LangChain/LlamaIndex splitter examples are empty files, and SETUP.md
documented that the README linked to them. Removing the links is the better half
of that trade: nothing points at an empty file now, so the note has nothing left
to warn about.

The Azure note said only what the example does not do - read the environment. It
now says what you actually have to do: its endpoint, key and API version are
placeholders in the file, so it has to be edited before it runs, and that edit
must not be committed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@williedoran-neo4j
williedoran-neo4j merged commit d1e36e7 into neo4j:main Aug 13, 2026
11 of 19 checks passed
williedoran-neo4j added a commit to williedoran-neo4j/neo4j-graphrag-python that referenced this pull request Aug 13, 2026
All three workflows skipped `uv sync` whenever the venv cache key hit exactly.
That trusts the cache to be complete, and it is not always: a cache saved from
an interrupted install is restored on every later run with the same key, and the
install that would repair it is precisely what gets skipped.

Seen on neo4j#596, which changes uv.lock and so minted a fresh key: four e2e jobs
failed with `ImportError: cannot import name 'WeaviateNeo4jRetriever'` and the
same for Pinecone and Qdrant. The restored .venv was missing the vector-store
extras, the test step installed only the 82 default packages, and re-running
reproduced it exactly - the same cache was restored each time. Deleting the
cache entry fixed it.

The failure mode is nasty out of proportion to its cause: it presents as a
flaky test in code that did not change, it survives re-runs, and it persists
until the cache expires or somebody deletes it by hand. Any PR touching uv.lock
is first to hit a new key, so it lands on whoever is least likely to suspect CI.

uv sync takes a few seconds when the environment is already correct, which is
cheap next to that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
williedoran-neo4j added a commit to williedoran-neo4j/neo4j-graphrag-python that referenced this pull request Aug 13, 2026
All three workflows skipped `uv sync` whenever the venv cache key hit exactly.
That trusts the cache to be complete, and it is not always: a cache saved from
an interrupted install is restored on every later run with the same key, and the
install that would repair it is precisely what gets skipped.

Seen on neo4j#596, which changes uv.lock and so minted a fresh key: four e2e jobs
failed with `ImportError: cannot import name 'WeaviateNeo4jRetriever'` and the
same for Pinecone and Qdrant. The restored .venv was missing the vector-store
extras, the test step installed only the 82 default packages, and re-running
reproduced it exactly - the same cache was restored each time. Deleting the
cache entry fixed it.

The failure mode is nasty out of proportion to its cause: it presents as a
flaky test in code that did not change, it survives re-runs, and it persists
until the cache expires or somebody deletes it by hand. Any PR touching uv.lock
is first to hit a new key, so it lands on whoever is least likely to suspect CI.

uv sync takes a few seconds when the environment is already correct, which is
cheap next to that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants