Skip to content

feat(llm): send an explicit reasoning_effort for Kimi models that support it (GRAPHIFY_KIMI_EFFORT) - #3071

Open
Azeem1985 wants to merge 1 commit into
Graphify-Labs:v8from
TelB-io:upstream/kimi-reasoning-effort
Open

feat(llm): send an explicit reasoning_effort for Kimi models that support it (GRAPHIFY_KIMI_EFFORT)#3071
Azeem1985 wants to merge 1 commit into
Graphify-Labs:v8from
TelB-io:upstream/kimi-reasoning-effort

Conversation

@Azeem1985

Copy link
Copy Markdown
Contributor

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 v8 and carries only the change. #2982 is being closed with a pointer here.

The gap

The kimi backend entry in BACKENDS has no reasoning_effort, so graphify sends none and the server's own default applies silently — "high" for K3. The gemini block 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 kimi entry 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.

max as 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 to high (today's effective behaviour) and leave max opt-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.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.
@Azeem1985
Azeem1985 force-pushed the upstream/kimi-reasoning-effort branch from 8e34665 to 4a1ecaf Compare August 25, 2026 08:47

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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).

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.

1 participant