Skip to content

Commit

Permalink
log json decoding errors (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
CTY-git authored Nov 1, 2024
1 parent 80790e9 commit 4af4c6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion patchwork/steps/SimplifiedLLM/SimplifiedLLM.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from patchwork.common.client.llm.utils import example_json_to_schema
from patchwork.common.utils.utils import RetryData, exclude_none_dict, retry
from patchwork.logger import logger
from patchwork.step import Step, StepStatus
from patchwork.steps.CallLLM.CallLLM import CallLLM
from patchwork.steps.ExtractModelResponse.ExtractModelResponse import (
Expand Down Expand Up @@ -50,7 +51,8 @@ def __retry_unit(self, prepare_prompt_outputs, call_llm_inputs, retry_data: Retr
try:
json_response = json.loads(response, strict=False)
json_responses.append(json_response)
except json.JSONDecodeError:
except json.JSONDecodeError as e:
logger.error(f"Json to decode: \n{response}\nError: \n{e}")
call_llm.set_status(StepStatus.FAILED, "Failed to decode JSON response")
self.__record_status_or_raise(retry_data, call_llm)
continue
Expand Down
2 changes: 1 addition & 1 deletion patchwork/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
ModifyCodePB = ModifyCodeOnce
PRPB = PR
ReadPRDiffsPB = ReadPRDiffs
SimplifiedLLMOncePB = SimplifiedLLM
SimplifiedLLMOncePB = SimplifiedLLMOnce

__all__ = [
"AnalyzeImpact",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "patchwork-cli"
version = "0.0.73"
version = "0.0.74"
description = ""
authors = ["patched.codes"]
license = "AGPL"
Expand Down

0 comments on commit 4af4c6c

Please sign in to comment.