Intent Recognition package¶
Submodules¶
gpt_intent_recognition_impl module¶
- class dronebuddylib.atoms.intentrecognition.gpt_intent_recognition_impl.GPTIntentRecognitionImpl(engine_configurations: EngineConfigurations)[source]¶
Bases:
IIntentRecognition
GPT-based intent recognition system specifically tailored for drone actions.
This class interfaces with the GPTEngine to recognize intents from user messages, taking into account system-defined and custom-defined drone actions.
- configs¶
Configurations for the GPT Engine.
- Type:
- get_algorithm_name() str [source]¶
Returns the algorithm name of the intent recognition implementation.
- Returns:
The algorithm name.
- Return type:
str
- get_class_name() str [source]¶
Returns the class name of the intent recognition implementation.
- Returns:
The class name.
- Return type:
str
- get_optional_params() list [source]¶
Returns the list of optional configuration parameters for the intent recognition engine.
- Returns:
List of optional configuration parameters.
- Return type:
list
- get_required_params() list [source]¶
Returns the list of required configuration parameters for the intent recognition engine.
- Returns:
List of required configuration parameters.
- Return type:
list
- get_resolved_intent(user_message: str) RecognizedIntent [source]¶
Recognizes the intent from the provided user message using the ChatGPT engine.
- Parameters:
user_message (str) – The user’s input message for which the intent is to be recognized.
- Returns:
Recognized intent based on the user message.
- Return type:
str
- get_system_prompt() str [source]¶
Retrieves the current system prompt being used.
- Returns:
Current system prompt.
- Return type:
str
- introduce_new_intents(new_intents: dict) bool [source]¶
Introduces new intents to the intent recognition system.
This method should be implemented by subclasses to provide the functionality for adding new intents to the intent recognition system.
- Parameters:
new_intents (dict) – The new intents to be added.
- Returns:
True if the operation was successful, False otherwise.
- Return type:
bool
i_intent_recognition module¶
- class dronebuddylib.atoms.intentrecognition.i_intent_recognition.IIntentRecognition(engine_configurations: EngineConfigurations)[source]¶
Bases:
IDBLFunction
,ABC
Abstract base class for intent recognition implementations.
This class defines the interface for intent recognition systems that are used to determine the user’s intent based on their input.
- abstract get_resolved_intent(phrase: str) RecognizedIntent [source]¶
Resolves the user’s intent based on the given phrase.
This method should be implemented by subclasses to provide the functionality for recognizing the user’s intent.
- Parameters:
phrase (str) – The user’s input phrase.
- Returns:
The recognized intent.
- Return type:
str
- abstract introduce_new_intents(new_intents: dict) bool [source]¶
Introduces new intents to the intent recognition system.
This method should be implemented by subclasses to provide the functionality for adding new intents to the intent recognition system.
- Parameters:
new_intents (dict) – The new intents to be added.
- Returns:
True if the operation was successful, False otherwise.
- Return type:
bool
intent_recognition_engine module¶
- class dronebuddylib.atoms.intentrecognition.intent_recognition_engine.IntentRecognitionEngine(algorithm: IntentRecognitionAlgorithm, config: EngineConfigurations)[source]¶
Bases:
object
- ACTION_FILE_PATH = 'C:\\Users\\Public\\projects\\drone-buddy-library\\dronebuddylib\\atoms\\intentrecognition\\resources\\intents.txt'¶
A high-level engine for intent recognition leveraging various algorithms.
- intent_recognizer¶
An instance of the intent recognition algorithm chosen.
- Type:
- get_current_intents() dict [source]¶
Retrieve the current intents and their descriptions from the intent file.
- Returns:
A dictionary containing intents as keys and their descriptions as values.
- Return type:
dict
- introduce_new_intent(intent: str, description: str) bool [source]¶
Add a new intent and its description to the intent file.
- Parameters:
intent (str) – The new intent to be added.
description (str) – The description of the new intent.
- Returns:
True if the new intent was successfully added, False otherwise.
- Return type:
bool
snips_intent_recognition_impl module¶
- class dronebuddylib.atoms.intentrecognition.snips_intent_recognition_impl.SNIPSIntentRecognitionImpl(engine_configurations: EngineConfigurations)[source]¶
Bases:
IIntentRecognition
Implementation of intent recognition using the Snips NLU engine.
- engine¶
The Snips NLU engine used for intent recognition.
- Type:
SnipsNLUEngine
- add_new_intent(intent: str, description: str) bool [source]¶
Adds a new intent and its description to the intent file.
- Parameters:
intent (str) – The new intent.
description (str) – The description of the new intent.
- Returns:
True if the intent was successfully added, False otherwise.
- Return type:
bool