Chooses the best action(s) (intents) and extracts any related params.
The Function Interact Action is designed to determine the most appropriate action(s) (intents) to execute while extracting relevant parameters from user inputs. Alternatively it can be used in non-strict mode which allows it to perform extractions without strict routing to matched actions. It serves as a critical component within conversational flows, enabling precise intent detection, action selection, and context-aware parameter extraction.
jivas/function_interact_action
FunctionInteractAction
The default configuration for this action is highly customizable:
chained (bool
, default=False
):
If set to true
, the action executes only when one or more of its registered actions have already been queued by a preceding Function Interact Action.
strict (bool
, default=True
):
Enforces strict mode execution. If enabled, it executes only those actions belonging to explicitly matched functions.
exceptions (list
, default=['PersonaInteractAction']
):
Defines actions that should always execute irrespective of intent matching when in strict mode. Users may extend this exception list:
exceptions:
- PersonaInteractAction
- CustomAlwaysExecuteAction
^2.0.0
jivas/langchain_model_action
: >=0.0.1
This section details the process and parameters for configuring the Function Interact Action to suit your requirements.
The default configurable options to control action execution behavior:
chained: false # if chained, only executes when one of its actions added by the Function Interact Action is queued.
strict: true # if strict, only actions belonging to matched functions will be executed.
timezone: "America/Guyana" # The timezone to be used for the datetime placeholder
exceptions: # list of actions which are included in intent, regardless
- PersonaInteractAction
Consider your interaction workflows when adjusting these parameters. For broader interaction scope, disable strict enforcement or add relevant exceptions.
The Function Interact Action uses a language model and conversational context to infer intents and parameter extraction accurately. Adjust these settings to tune model behavior and accuracy:
history_size: 5 # Number of recent conversational interactions considered
max_statement_length: 500 # Maximum input text length for processing
model_action: LangChainModelAction # Language model action to use
model_name: gpt-4o # Model identifier used for inference
model_temperature: 0.2 # Model randomness (low value: more deterministic)
model_max_tokens: 2048 # Maximum tokens allowed in model responses
Modify the parameters to balance performance, resource utilization, and predictive accuracy needs.
The Function Interact Action interacts with various actions through defined functions which specify desired intents and associated parameters to extract. Utilize placeholders to handle dynamic data points such as datetime references or custom contextual values. Below is an example of a function definiton which may be placed within an interact action to make use of the function_interact_action.
Example configuration:
functions:
- type: function
function:
name: "extract_user_details"
description: >
Extracted information about user's personal details, <custom_placeholder>, request for a specific service or scheduling preferences.
Use the current date <datetime> to determine the date or time the user references.
Extract any information concerning the user wanting to bring in a machine or vehicle.
parameters:
type: object
properties:
description_of_issue:
type: string
description: "Any details concerning the user wanting to bring in a machine or vehicle."
first_name:
type: string
description: "Returns the first name of the user."
last_name:
type: string
description: "Returns the last name of the user."
required:
- description_of_issue
placeholders:
custom_placeholder: "custom_placeholder_value"
- type: function
function:
name: "extract_confirmation_choice"
description: >
Determine if the user confirms the provided draft report for posting or cancels. Handles affirmatives (e.g., 'yes', 'post it', 'send now', 'sure') and negatives (e.g., 'no', 'cancel', 'nevermind', 'nah').
parameters:
type: object
properties:
confirmation_choice:
type: string
enum: ["true", "false"]
description: >
Returns 'true' if the user responds affirmatively (e.g., 'yes', 'ok'). Returns 'false' for negatives (e.g., 'no', 'cancel', 'nah', 'nevermind').
required:
- confirmation_choice
Placeholders are useful for providing dynamic context-sensitive information during extraction:
<datetime>
placeholders are automatically injected with the current timestamp.placeholders:
custom_placeholder: "current customer support context"
This approach ensures accurate, contextual parameter extraction particularly around time-sensitive and context-varying information.
git clone https://github.com/TrueSelph/function_interact_action
git checkout -b new-feature-x
git commit -m 'Implemented new feature x.'
git push origin new-feature-x
This project is licensed under the Apache License 2.0. Refer to LICENSE for further details.
jvcli download action jivas/function_interact_action
Last published
2 months ago
Version
0.0.3
Downloads
7
Author
jivasType
interact_action
Visibility
Public
Tags