You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Ollama ignores graphify's context size, so docs come back empty #4413
I tried graphify extract --backend ollama with qwen2.5:14b on a few docs, and none of them made it into the graph. Every try, the model wrote a plain summary of the docs instead of JSON, and graphify gave up after 3 retries.
graphify works out a context size for each chunk and sends it to Ollama as num_ctx. But it sends it to Ollama's /v1 address, and that address ignores it. So Ollama just uses its own default, which is 4096 on my machine, and cuts off the rest of the prompt. That cuts off the part asking for JSON, so the model answers in plain text.
You can see it in graphify's own output. It says tokens: 4,096 in even though the docs were a lot bigger than that.
How to see it for yourself
This sends the same long prompt with num_ctx set to 20000, once to /v1 like graphify does and once to Ollama's own /api/chat:
Same 2 docs (requests' README and quickstart, about 5.5k tokens), same model. The only change was making a copy of the model with the bigger context built in (PARAMETER num_ctx 12288 in a Modelfile):
normal qwen2.5:14b: cut to 4,096 tokens, plain text back 3 times, empty graph after about 12 minutes
copy with 12k context: all 6,316 tokens read, proper JSON first try, done in 3 minutes
What should happen
The context size graphify works out should actually reach Ollama, so chunks bigger than Ollama's default don't get cut off.
Also, when this happens the message says it's usually "a rate limit, a transport hiccup, a refusal, or a model that answered in prose". That sent me looking in the wrong places. If the tokens in are exactly Ollama's context size, it would help to say the prompt was probably cut off.
Related: #3982 saw part of this. They asked for 14000 and got their server's 11000.
This looks already fixed on v8: graphify/llm.py has _call_ollama_native, which sends requests to Ollama's native /api/chat endpoint (falling back to /v1 only for servers without it, e.g. LM Studio/llama.cpp) specifically citing this issue number in its comment, landed via #4414 (closed, not auto linked since it was cherry picked rather than merged through the PR button, same as #2780/#2779). Might be worth closing this one.
Activity
github-actions commentedon Oct 13, 2026
Thanks for opening this issue, @smngvlkz. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
ayushcodes10 commentedon Oct 16, 2026
This looks already fixed on v8:
graphify/llm.pyhas_call_ollama_native, which sends requests to Ollama's native/api/chatendpoint (falling back to/v1only for servers without it, e.g. LM Studio/llama.cpp) specifically citing this issue number in its comment, landed via #4414 (closed, not auto linked since it was cherry picked rather than merged through the PR button, same as #2780/#2779). Might be worth closing this one.omsenjalia commentedon Oct 18, 2026
This looks fixed on the
v8branch by f48425e6 (send ollama requests to /api/chat so num_ctx actually applies). Could a maintainer confirm and close?