Issue with a custom function #68
Unanswered
divya-akula
asked this question in
Q&A
Replies: 1 comment
-
You should be doing this instead: // Add a prompt function for getting the current status of the lights
app.ai.prompts.addFunction(
'GetUsers',
async (context: TurnContext, state: ApplicationTurnState) => {
getUsers(state, ...);
return true;
}
); Note that you cannot pass If it's static, independent of the turn & read only, define it as a variable in the scope in which you're defining the prompt function and use it in the handler function. Javascript's closure should work. Note that this approach can cause concurrency issues. Another, more appropriate way to access app.turn('beforeTurn', (context, state) => {
state.temp.userData.value = // assign it the user data
// NOTE: you will have to update the typescript interface appropriately
}); // inside the handler function for the `GetUsers` prompt function registration access the data like this
state.temp.userData.value |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi ,
I am facing the following issue, stating The DefaultPromptManager.invokeFunction() method was called for an unregistered function named "GetUsers" though I have registered it in the second screenshot, I am stuck with this , any help wold be highly appreciated.
though I have registered the action
Beta Was this translation helpful? Give feedback.
All reactions