llm_intent_classifier#
- class besser.bot.nlp.intent_classifier.llm_intent_classifier.LLMIntentClassifier(nlp_engine, state)[source]#
Bases:
IntentClassifier
An LLM-based Intent Classifier.
It sends a prompt to an LLM, indicating how to perform the Intent Classification task and providing the State’s intents and its parameters
- Parameters:
Attributes:
See also
- _abc_impl = <_abc._abc_data object>#
- _generate_prompt(message)[source]#
Generates the prompt for the LLM giving instructions for the intent classification task.
- predict(message)[source]#
Predict the intent of a given message.
Instead of returning only the intent with the highest likelihood, return all predictions. Predictions include not only the intent scores but other information extracted from the message.
- Parameters:
message (str) – the message to predict the intent
- Returns:
the list of predictions made by the intent classifier.
- Return type:
- predict_huggingface_inference_api(prompt)[source]#
Send the prompt to the HuggingFace Inference API LLM.