intent_classifier_configuration#
- class besser.agent.nlp.intent_classifier.intent_classifier_configuration.IntentClassifierConfiguration[source]#
Bases:
ABC
The Intent Classifier Configuration abstract class.
This configuration is assigned to a state, allowing the customization of its intent classifier.
This class serves as a template to implement intent classifier configurations for the different Intent Classifiers.
- _abc_impl = <_abc._abc_data object>#
- class besser.agent.nlp.intent_classifier.intent_classifier_configuration.LLMIntentClassifierConfiguration(llm_name, parameters=None, use_intent_descriptions=True, use_training_sentences=True, use_entity_descriptions=True, use_entity_synonyms=True)[source]#
Bases:
IntentClassifierConfiguration
The LLM Intent Classifier Configuration class.
It allows the customization of a
LLMIntentClassifier
.- Parameters:
llm_name (str) – the name of the LLM to be used (must be created in the agent)
parameters (dict) – the LLM parameters (this will vary depending on the suite and the LLM)
use_intent_descriptions (bool) – whether to include the intent descriptions in the LLM prompt
use_training_sentences (bool) – whether to include the intent training sentences in the LLM prompt
use_entity_descriptions (bool) – whether to include the entity descriptions in the LLM prompt
use_entity_synonyms (bool) – whether to include the entity value’s synonyms in the LLM prompt
- use_training_sentences#
whether to include the intent training sentences in the LLM prompt
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.agent.nlp.intent_classifier.intent_classifier_configuration.SimpleIntentClassifierConfiguration(framework='pytorch', num_epochs=300, embedding_dim=128, hidden_dim=128, input_max_num_tokens=15, discard_oov_sentences=True, check_exact_prediction_match=True, activation_last_layer='sigmoid', lr=0.001)[source]#
Bases:
IntentClassifierConfiguration
The Simple Intent Classifier Configuration class.
It allows the customization of a Simple Intent Classifier (
SimpleIntentClassifierTF
orSimpleIntentClassifierTorch
).- Parameters:
framework (str) – The framework to implement the Simple Intent Classifier (‘tensorflow’ or ‘pytorch’). Defaults to ‘pytorch’
num_epochs (int) – Number of epochs to be run during training
embedding_dim (int) – Number of embedding dimensions to be used when embedding the words
hidden_dim (int) – Number of dimensions for the hidden layers
input_max_num_tokens (int) – Max length for the vector representing a sentence
discard_oov_sentences (bool) – whether to automatically assign zero probabilities to sentences with all tokens being oov ones or not
check_exact_prediction_match (bool) – Whether to check for exact match between the sentence to predict and one of the training sentences or not
activation_last_layer (str) – The activation function of the last layer. Allowed values are ‘softmax’ (sum of all predictions equals to 1) and ‘softmax’ (sum of all predictions can be different of 1). Defaults to ‘sigmoid’
lr (float) – Learning rate for the optimizer
- framework#
The framework to implement the Simple Intent Classifier (‘tensorflow’ or ‘pytorch’). Defaults to ‘pytorch’
- Type:
Number of dimensions for the hidden layers
- Type:
- discard_oov_sentences#
whether to automatically assign zero probabilities to sentences with all tokens being oov ones or not
- Type:
- check_exact_prediction_match#
Whether to check for exact match between the sentence to predict and one of the training sentences or not
- Type:
- activation_last_layer#
The activation function of the last layer. Allowed values are ‘softmax’ (sum of all predictions equals to 1) and ‘softmax’ (sum of all predictions can be different of 1). Defaults to ‘sigmoid’
- Type:
- _abc_impl = <_abc._abc_data object>#