Skip to content
Open
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
2 changes: 1 addition & 1 deletion apps/backend/app/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def _supports_json_mode(model_name: str) -> bool:


def _appears_truncated(data: dict, schema_type: str = "resume") -> bool:
FALLBACK_MAX_TOKENS = 4096
FALLBACK_MAX_TOKENS = 4096

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.

P1: FALLBACK_MAX_TOKENS is now local to the stray _appears_truncated function, so get_safe_max_tokens() will hit NameError on the fallback path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/backend/app/llm.py, line 735:

<comment>`FALLBACK_MAX_TOKENS` is now local to the stray `_appears_truncated` function, so `get_safe_max_tokens()` will hit `NameError` on the fallback path.</comment>

<file context>
@@ -732,7 +732,7 @@ def _supports_json_mode(model_name: str) -> bool:
 
 def _appears_truncated(data: dict, schema_type: str = "resume") -> bool:
-FALLBACK_MAX_TOKENS = 4096
+    FALLBACK_MAX_TOKENS = 4096
 
 def get_safe_max_tokens(model_name: str, requested: int = DEFAULT_JSON_MAX_TOKENS) -> int:
</file context>


def get_safe_max_tokens(model_name: str, requested: int = DEFAULT_JSON_MAX_TOKENS) -> int:
"""Return a token count safe for the given model, clamped to its output limit.
Expand Down