Skip to main content
Version: Next

tool_post_processor

File: core/src/utcp/interfaces/tool_post_processor.py

class ToolPostProcessor

Documentation

Abstract interface for tool post processors.

Defines the contract for tool post processors that process the result of a tool call.

Tool Post Processors Are Responsible For

  • Processing the result of a tool call
  • Returning the processed result

Fields:

  • tool_post_processor_type: str

Methods:

post_process(self, caller: 'UtcpClient', tool: Tool, manual_call_template: 'CallTemplate', result: Any) -> Any

Process the result of a tool call.

Args

  • caller: The UTCP client that is calling this method.
  • tool: The tool that was called.
  • manual_call_template: The call template of the manual that was called.
  • result: The result of the tool call.

Returns

The processed result.


class ToolPostProcessorConfigSerializer (Serializer[ToolPostProcessor])

Documentation

Serializer for tool post processors.

Defines the contract for serializers that convert tool post processors to and from

Dictionaries For Storage Or Transmission. Serializers Are Responsible For

  • Converting tool post processors to dictionaries for storage or transmission
  • Converting dictionaries back to tool post processors
  • Ensuring data consistency during serialization and deserialization

Fields:

  • tool_post_processor_implementations: Dict[str, Serializer[ToolPostProcessor]]

Methods:

to_dict(self, obj: ToolPostProcessor) -> dict

Convert a tool post processor to a dictionary.

Args

  • obj: The tool post processor to convert.

Returns

The dictionary converted from the tool post processor.

validate_dict(self, data: dict) -> ToolPostProcessor

Validate a dictionary and convert it to a tool post processor.

Args

  • data: The dictionary to validate and convert.

Returns

The tool post processor converted from the dictionary.