agentchat.contrib.capabilities
agentchat.contrib.capabilities.transforms_util
cache_key
Calculates the cache key for the given message content and any other hashable args.
Arguments:
content
MessageContentType - The message content to calculate the cache key for.*args
- Any additional hashable args to include in the cache key.
cache_content_get
Retrieves cachedd content from the cache.
Arguments:
cache
None or AbstractCache - The cache to retrieve the content from. If None, the cache is ignored.key
str - The key to retrieve the content from.
cache_content_set
Sets content into the cache.
Arguments:
cache
None or AbstractCache - The cache to set the content into. If None, the cache is ignored.key
str - The key to set the content into.content
MessageContentType - The message content to set into the cache.*extra_values
- Additional values to be passed to the cache.
min_tokens_reached
Returns True if the total number of tokens in the messages is greater than or equal to the specified value.
Arguments:
messages
List[Dict] - A list of messages to check.
count_text_tokens
Calculates the number of text tokens in the given message content.
Arguments:
content
MessageContentType - The message content to calculate the number of text tokens for.
is_content_right_type
A helper function to check if the passed in content is of the right type.
is_content_text_empty
Checks if the content of the message does not contain any text.
Arguments:
content
MessageContentType - The message content to check.
should_transform_message
Validates whether the transform should be applied according to the filter dictionary.
Arguments:
message
Dict[str, Any] - The message to validate.filter_dict
None or Dict[str, Any] - The filter dictionary to validate against. If None, the transform is always applied.exclude
bool - Whether to exclude messages that match the filter dictionary.