llm#
- class besser.bot.nlp.llm.llm.LLM(nlp_engine, name, parameters)[source]#
Bases:
ABCThe LLM abstract class.
An LLM (Large Language Model) receives a text input and generates an output. Depending on the LLM, several tasks can be performed, such as question answering, translation, text classification, etc.
This class serves as a template to be implemented for specific LLM providers.
- Parameters:
- _nlp_engine#
the NLPEngine that handles the NLP processes of the bot the LLM belongs to
- Type:
- _abc_impl = <_abc._abc_data object>#
- chat(session, parameters=None)[source]#
Make a prediction, i.e., generate an output.
This function can provide the chat history to the LLM for the output generation, simulating a conversation or remembering previous messages.
- intent_classification(intent_classifier, message, parameters=None)[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:
intent_classifier (LLMIntentClassifier) – the intent classifier that is running the intent classification process
message (str) – the message to predict the intent
parameters (dict) – the LLM parameters. If none is provided, the RAG’s default value will be used
- Returns:
the list of predictions made by the LLM.
- Return type: