🗣️ Intent Classification model
Use the default Intent Classification model
Need a general-purpose Intent Classification model? You can use Artifex's default intent classification model, which is trained to recognize twelve intents out-of-the-box:
greetingfarewellthank_youaffirmationnegationsmall_talkbot_capabilitiesfeedback_positivefeedback_negativeclarificationsuggestionlanguage_change
from artifex import Artifex
intent_classifier = Artifex().intent_classifier
print(intent_classifier("Hey there, how are you doing?"))
# >>> [{'label': 'greeting', 'score': 0.9955}]
Learn more about the default Intent Classification model and what intents it is trained to recognize on our Intent Classification HF model page.
Create & use a custom Intent Classification model
Need more control over the intents recognized, or do you want to tailor the model to your specific domain for better results? Fine-tune your own Intent Classification model, use it locally on CPU and keep it forever:
from artifex import Artifex
intent_classifier = Artifex().intent_classifier
model_output_path = "./output_model/"
intent_classifier.train(
domain="e-commerce customer support", # change to your desired domain
classes={ # define your custom intents
"order_status": "Inquiries about the status of an order.",
"return_item": "Requests to return a purchased item.",
"product_info": "Questions about product details or specifications.",
"greeting": "Friendly greetings or salutations.",
},
output_path=model_output_path
)
intent_classifier.load(model_output_path)
print(intent_classifier("I want to return an item I bought last week."))
# >>> [{'label': 'return_item', 'score': 0.9914}]