Data Agents
To Classification Agent
The ToClassificationAgent
is used to convert arbitrary data into a standardized classification format.
Initialization
Parameters
The ToClassificationAgent
is initialized with 1 argument:
ToClassificationAgent(fn)
fn
Union[Callable[[Any], str], Callable[[Any], List[str]]]
requiredThis 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)