Moderator interface
A moderator is responsible for reviewing and approving AI prompts and plans.
Methods
review |
Reviews an incoming utterance and generated prompt before it's sent to the planner. |
review |
Reviews a plan generated by the planner before its executed. |
Method Details
reviewInput(TurnContext, TState)
Reviews an incoming utterance and generated prompt before it's sent to the planner.
function reviewInput(context: TurnContext, state: TState): Promise<undefined | Plan>
Parameters
- context
-
TurnContext
Context for the current turn of conversation.
- state
-
TState
Application state for the current turn of conversation.
Returns
Promise<undefined | Plan>
An undefined value to approve the prompt or a new plan to redirect to if not approved.
Remarks
The moderator can review the incoming utterance for things like prompt injection attacks or the leakage of sensitive information. The moderator can also review the generated prompt to ensure it's appropriate for the current conversation.
To approve a prompt, simply return undefined. Returning a new plan bypasses the planner and
redirects to a new set of actions. Typically the moderator will return a new plan with a
single DO command that calls AI.FlaggedInputActionName
to flag the input for review.
The moderator can pass any entities that make sense to the redirected action.
reviewOutput(TurnContext, TState, Plan)
Reviews a plan generated by the planner before its executed.
function reviewOutput(context: TurnContext, state: TState, plan: Plan): Promise<Plan>
Parameters
- context
-
TurnContext
Context for the current turn of conversation.
- state
-
TState
Application state for the current turn of conversation.
- plan
- Plan
Plan generated by the planner.
Returns
Promise<Plan>
The plan to execute. Either the current plan passed in for review or a new plan.
Remarks
The moderator can review the plan to ensure it's appropriate for the current conversation.
To approve a plan simply return the plan that was passed in. A new plan can be returned to
redirect to a new set of actions. Typically the moderator will return a new plan with a
single DO command that calls AI.FlaggedOutputActionName
to flag the output for review.
The moderator can pass any entities that make sense to the redirected action.