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:

GPTConfigs

gpt_engine

The GPT engine instance used for intent recognition.

Type:

GPTEngine

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

override_system_prompt(system_prompt: str)[source]

Overrides the current system prompt with the provided one.

Parameters:

system_prompt (str) – The new system prompt.

set_custom_actions_to_system_prompt(custom_actions: dict)[source]

Updates the system prompt with custom drone actions.

Parameters:

custom_actions (list) – List of custom drone actions.

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:

IIntentRecognition

get_class_name() str[source]

Returns the class name.

Returns:

The class name.

Return type:

str

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

recognize_intent(text: str) RecognizedIntent[source]

Recognize the intent from the provided text using the configured algorithm.

Parameters:

text (str) – The input text from which intent needs to be recognized.

Returns:

Recognized intent.

Return type:

RecognizedIntent

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

get_class_name()[source]

Returns the class name.

get_algorithm_name()[source]

Returns the name of the algorithm.

get_resolved_intent()[source]

Parses text to detect intent and associated slots.

add_new_intent()[source]

Adds a new intent to the intent file.

get_required_params()[source]

Returns a list of required configuration parameters.

get_optional_params()[source]

Returns a list of optional configuration parameters.

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

get_algorithm_name() str[source]

Returns the name of the algorithm.

get_class_name() str[source]

Returns the class name.

get_optional_params() list[source]

Returns a list of optional configuration parameters.

get_required_params() list[source]

Returns a list of required configuration parameters.

get_resolved_intent(phrase: str) RecognizedIntent[source]

Parses text to detect intent and associated slots.

Parameters:

phrase (str) – The text to be parsed.

Returns:

The detected intent and associated slots.

Return type:

RecognizedIntent

introduce_new_intents(new_intents: dict) bool[source]

Introduces 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

Module contents