Improve ToolOutputError message (#73)

Before this PR error message:

![image](https://github.com/user-attachments/assets/2d36c05e-006a-4fc5-8265-d2371f9142e4)

Updated error message: 

![image](https://github.com/user-attachments/assets/f7ae7a81-f9b2-4471-9c24-8b02c8009065)
This commit is contained in:
Eric Gustin 2024-09-27 21:40:57 -07:00 committed by GitHub
parent a3a662c6a2
commit aabceae135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,6 +103,10 @@ class ToolExecutor:
output = output_model(**{"result": results})
except ValidationError as e:
raise ToolOutputError(message="Error in output", developer_message=str(e)) from e
raise ToolOutputError(
message="Failed to serialize tool output",
developer_message=f"Validation error occurred while serializing tool output: {e!s}. "
f"Please ensure the tool's output matches the expected schema.",
) from e
return output