Feature Description
Since LLM can hallucinate on arguments for the tool, ValidationError is raised and stop the loop when arguments are not aligned with the signature.
Common llm react pattern will use the error as feedback to correct itself
Supporting "react on error" will help the LLM to have some feedback/reference on how it can correct itself and retry the call
Examples & References
Example Tool
def add_income(name: str, amount: float, frequency: str = "monthly", additional_name: str = "") -> str
LLM sometimes hallucinate even tho you have tool signature that amount is float and not nullable
File "/home/njanaijesinghe/pn_birdie_v2/venv/lib/python3.12/site-packages/byllm/types.py", line 169, in parse_arguments
args[arg_name] = TypeAdapter(arg_type).validate_python(arg_json)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/njanaijesinghe/pn_birdie_v2/venv/lib/python3.12/site-packages/pydantic/type_adapter.py", line 441, in validate_python
return self.validator.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for float
Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.12/v/float_type
Feature Description
Since LLM can hallucinate on arguments for the tool, ValidationError is raised and stop the loop when arguments are not aligned with the signature.
Common llm react pattern will use the error as feedback to correct itself
Supporting "react on error" will help the LLM to have some feedback/reference on how it can correct itself and retry the call
Examples & References
Example Tool
LLM sometimes hallucinate even tho you have tool signature that amount is float and not nullable