Skip to main content

Module argument_parsing

Module argument_parsing 

Source
Expand description

Shared helpers for parsing model-supplied tool arguments.

Functions§

deserialize_to_optional_uuid_and_errors_to_none
Deserializes an optional string field and parses it into an Uuid, doing this optionally without failure. If an error occurs, a None is returned. This is desired for truly optional id fields generated by an LLM, which can be None or a non-Uuid string in some cases. If any errors should occur, they are emitted in ChatbotTools’s from_db_and_arguments.
parse_required_uuid
Parses a required UUID tool argument, reporting a parse failure as ChatbotErrorType::InvalidToolArguments naming field_name and the offending value.