Closed BMS-geodev closed 2 months ago
right off the bat I'm curious about the "handler" return as seen in the js version.
const handler = this._actions.get(action)!.handler;
return await handler(context, state, parameters, action);
I don't think I'm properly managing the handler in the python
handler = self._actions[action].handler
return await handler(context, state, parameters, action)
also need to find a way this can be used / tested.
I reviewed the /teams/ai/actions scripts. I think changing this
handler = self._actions[action].handler
return await handler(context, state, parameters, action)
to
action_entry = self._actions[action]
handler = action_entry.func
return await handler(ActionTurnContext(action, parameters, context), state)
more appropriately captures how the action handler wants to be invoked.
@lilyydu
I think I hit all the comments. Any other tests you think I should add? Also is test_ai.py in the correct place?
(I did not dismiss anything, that seemed automatic as I made changes after you accepted)
Linked issues
closes: #1778
Change details
This PR focuses on adding do_action functionality to ai.py. This method is present in the JS teams-ai package.
In addition, test_ai.py was created and added to the python tests directory to provide some coverage of the ai.py methods. Specifically however, this PR's test_ai.py work only covers the new do_action method.
code snippets:
screenshots:
Attestation Checklist
[x] My code follows the style guidelines of this project
I have checked for/fixed spelling, linting, and other errors
I have commented my code for clarity
I have made corresponding changes to the documentation (updating the doc strings in the code is sufficient)
My changes generate no new warnings
I have added tests that validates my changes, and provides sufficient test coverage. I have tested with:
New and existing unit tests pass locally with my changes
Additional information