Skip to content

Commit

Permalink
Add actionId to PredictedDoCommand interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina Gum committed Aug 5, 2024
1 parent f3344c4 commit 52d9c47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/packages/teams-ai/src/AI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export class AI<TState extends TurnState = TurnState> {
const cmd = plan.commands[i];
switch (cmd.type) {
case 'DO': {
const { action } = cmd as PredictedDoCommand;
const { action, actionId } = cmd as PredictedDoCommand;
if (this._actions.has(action)) {
// Call action handler
const handler = this._actions.get(action)!.handler;
Expand All @@ -418,6 +418,9 @@ export class AI<TState extends TurnState = TurnState> {
.handler(context, state, { handler, ...(cmd as PredictedDoCommand) }, action);
should_loop = output.length > 0;
state.temp.actionOutputs[action] = output;
if (actionId) {
should_loop = true;
}
} else {
// Redirect to UnknownAction handler
output = await this._actions
Expand Down
6 changes: 6 additions & 0 deletions js/packages/teams-ai/src/planners/Planner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export interface PredictedDoCommand extends PredictedCommand {
* Any parameters that the AI system should use to perform the action.
*/
parameters: Record<string, any>;

/**
* The id mapped to the name action that the AI system should perform.
* In OpenAI, this is associated with the action_id tool calls.
*/
actionId?: string;
}

/**
Expand Down

0 comments on commit 52d9c47

Please sign in to comment.