Hi,
i noticed that the errors in the _Extract class don't propagate through the invoke call. This means that if the patch extraction fails, there will not be a retry.
aka. this will not be triggered.
|
except Exception as e: |
|
return { |
|
"messages": [ |
|
HumanMessage( |
|
content="Fix the validation error while" |
|
f" also avoiding: {repr(str(e))}" |
|
) |
|
], |
|
"attempts": 1, |
|
} |
This is relevant if the llm does not generate the indices properly and applying the patch fails.
|
if target: |
|
try: |
|
patches = _ensure_patches(tc["args"]) |
|
if patches or self.tool_choice == "PatchDoc": |
|
# The second condition is so that, when we are continuously |
|
# updating a single doc, we will still include it in |
|
# the output responses list; mainly for backwards |
|
# compatibility |
|
resolved_tool_calls.append( |
|
ToolCall( |
|
id=tc["id"], |
|
name=tool_name, |
|
args=_apply_patch(target, patches), |
|
) |
|
) |
|
updated_docs[tc["id"]] = str(json_doc_id) |
|
except Exception as e: |
|
logger.error(f"Could not apply patch: {e}") |
|
if rt: |
|
rt.error = f"Could not apply patch: {repr(e)}" |
We should re raise the error such that we can retry properly.
If you want I could draft a PR. Any input would be appreciated.
Hi,
i noticed that the errors in the
_Extractclass don't propagate through the invoke call. This means that if the patch extraction fails, there will not be a retry.aka. this will not be triggered.
trustcall/trustcall/_base.py
Lines 1005 to 1014 in 8c7312b
This is relevant if the llm does not generate the indices properly and applying the patch fails.
trustcall/trustcall/_base.py
Lines 806 to 825 in 8c7312b
We should re raise the error such that we can retry properly.
If you want I could draft a PR. Any input would be appreciated.