RayMelius Claude Sonnet 4.6 commited on
Commit
d11337b
·
1 Parent(s): a6bc803

Silence JSON parse warnings for empty LLM responses

Browse files

When Groq/HF quota is exhausted complete() returns "" and the parser
was logging a warning for every empty string. Return {} immediately
for empty input instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. src/soci/engine/llm.py +2 -0
src/soci/engine/llm.py CHANGED
@@ -101,6 +101,8 @@ class LLMUsage:
101
  def _parse_json_response(text: str) -> dict:
102
  """Extract JSON from an LLM response, handling markdown blocks and extra text."""
103
  text = text.strip()
 
 
104
  # Handle markdown code blocks
105
  if text.startswith("```"):
106
  lines = text.split("\n")
 
101
  def _parse_json_response(text: str) -> dict:
102
  """Extract JSON from an LLM response, handling markdown blocks and extra text."""
103
  text = text.strip()
104
+ if not text:
105
+ return {}
106
  # Handle markdown code blocks
107
  if text.startswith("```"):
108
  lines = text.split("\n")