Initialization

Parameters

The ToClassificationAgent is initialized with 1 argument:

ToClassificationAgent(fn)
fn
Union[Callable[[Any], str], Callable[[Any], List[str]]]
required

This function is intended to classify or categorize the input data. It can take in any input type, but should return either a String or a List of Strings

Example

Here’s an example classification function:

def classify_length(text):
    word_count = len(text.split())
    if word_count > 1000:
        return "long"
    elif value > 500:
        return "medium"
    else:
        return "short"
ToClassificationAgent(fn=classify_length)