feat(llm): send an explicit reasoning_effort for Kimi models that support it (GRAPHIFY_KIMI_EFFORT) - #3071
Conversation
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Adds an explicit reasoning_effort to the kimi backend config, defaulting to max and overridable via GRAPHIFY_KIMI_EFFORT, so K3 no longer silently falls back to the server's high default. The value is read at import time and forwarded by the existing request plumbing; models that don't support the field ignore it.
No blocking issues surfaced. 3 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 962 functions depend on the 370 functions this change touches.
Health — this change adds coupling hotspots:
- new:
deduplicate_entities()— 63 callers, 21 callees - new:
build_merge()— 46 callers, 14 callees - new:
extract_files_direct()— 17 callers, 20 callees - new:
extract_corpus_parallel()— 26 callers, 11 callees - new:
_call_claude_cli()— 31 callers, 9 callees - new:
dispatch_command()— 2 callers, 122 callees - new:
_extract_with_adaptive_retry()— 22 callers, 10 callees - new:
_call_llm()— 11 callers, 18 callees - …and 16 more — each is listed as a finding
Verification — 962 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 683 function(s) in the blast radius were not formally verified this run
· 24 more finding(s) on lines outside this diff (see the check run).
…port it (GRAPHIFY_KIMI_EFFORT)
The kimi backend sent no reasoning_effort at all, so the server default
("high" for K3) applied silently — while the gemini block directly above
already carried an effort setting. K3 advertises valid_efforts
["low","high","max"] on /models.
The backend entry now carries `reasoning_effort`, default "max",
overridable with GRAPHIFY_KIMI_EFFORT. It is forwarded by the existing
request plumbing, so models that ignore the field are unaffected.
Tests: effort assembles from GRAPHIFY_KIMI_EFFORT and defaults to max.
8e34665 to
4a1ecaf
Compare
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Adds an explicit reasoning_effort to the kimi backend config, defaulting to max and overridable via GRAPHIFY_KIMI_EFFORT, so K3 no longer silently falls back to the server's "high" default; the value is forwarded by the existing request plumbing and ignored by models that don't support the field. Covers the default and env-override behaviour with reload-based tests.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 962 functions depend on the 370 functions this change touches.
Health — this change adds coupling hotspots:
- new:
deduplicate_entities()— 63 callers, 21 callees - new:
build_merge()— 46 callers, 14 callees - new:
extract_files_direct()— 17 callers, 20 callees - new:
extract_corpus_parallel()— 26 callers, 11 callees - new:
_call_claude_cli()— 31 callers, 9 callees - new:
dispatch_command()— 2 callers, 122 callees - new:
_extract_with_adaptive_retry()— 22 callers, 10 callees - new:
_call_llm()— 11 callers, 18 callees - …and 16 more — each is listed as a finding
Verification — 962 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 683 function(s) in the blast radius were not formally verified this run
· 24 more finding(s) on lines outside this diff (see the check run).
Replaces #2982, which is the same six-line change but was opened from a branch that also carried unrelated work from our fork — 12 files and 21 commits. That was my mistake in how I cut the branch. This branch is cut from
v8and carries only the change. #2982 is being closed with a pointer here.The gap
The
kimibackend entry inBACKENDShas noreasoning_effort, so graphify sends none and the server's own default applies silently —"high"for K3. Thegeminiblock directly above already carries an effort setting, so this reads as an omission rather than a deliberate choice.Kimi K3 advertises
valid_efforts ["low","high","max"]on/models, so the field is supported and settable.The change
The
kimientry gains"reasoning_effort": os.environ.get("GRAPHIFY_KIMI_EFFORT", "max"). It is forwarded by the existing request plumbing — no new call path — so models that ignore the field are unaffected.maxas the default is a judgement call: extraction quality is the point of the pass and the effort field does not change per-token pricing. If you would rather default tohigh(today's effective behaviour) and leavemaxopt-in, that is a one-word change and I am happy to make it.Diff
3 files:
graphify/llm.py(+6),tests/test_kimi_reasoning_effort.py(+31),CHANGELOG.md(+4). Tests pass.