File size: 318 Bytes
9e2986a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import pipeline

classifier = pipeline("text-classification")

def llm_agent(observation):
    result = classifier(observation)[0]['label'].lower()

    if "spam" in result:
        return "spam"
    elif "important" in result:
        return "important"
    else:
        return "normal"