ActionResponseValidator class
Validates action calls returned by the model.
Constructors
Action |
Creates a new |
Properties
actions | Gets a list of the actions configured for the validator. |
Methods
validate |
Validates a response to a prompt. |
Constructor Details
ActionResponseValidator(ChatCompletionAction[], boolean, string, string)
Creates a new ActionResponseValidator
instance.
new ActionResponseValidator(actions: ChatCompletionAction[], isRequired: boolean, noun?: string, Noun?: string)
Parameters
- actions
List of supported actions.
- isRequired
-
boolean
Whether the response is required to call an action.
- noun
-
string
Optional. Name of the action to use in feedback messages. Defaults to action
.
- Noun
-
string
Optional. Name of the action to use in feedback messages. Defaults to Action
.
Property Details
actions
Gets a list of the actions configured for the validator.
ChatCompletionAction[] actions
Property Value
A list of the actions configured for the validator.
Method Details
validateResponse(TurnContext, Memory, Tokenizer, PromptResponse<string>, number)
Validates a response to a prompt.
function validateResponse(context: TurnContext, memory: Memory, tokenizer: Tokenizer, response: PromptResponse<string>, remaining_attempts: number): Promise<Validation<ValidatedChatCompletionAction>>
Parameters
- context
-
TurnContext
Context for the current turn of conversation with the user.
- memory
- Memory
An interface for accessing state values.
- tokenizer
- Tokenizer
Tokenizer to use for encoding and decoding text.
- response
-
PromptResponse<string>
Response to validate.
- remaining_attempts
-
number
Number of remaining attempts to validate the response.
Returns
Promise<Validation<ValidatedChatCompletionAction>>
A Validation
object.