Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Feedback loop interface has has misnamed property... #2171

Open
andrewconnell opened this issue Nov 7, 2024 · 1 comment
Open

[Bug]: Feedback loop interface has has misnamed property... #2171

andrewconnell opened this issue Nov 7, 2024 · 1 comment
Labels
bug Something isn't working javascript Pull requests that update Javascript code

Comments

@andrewconnell
Copy link

Language

Javascript/Typescript

Version

1.6.0

Description

The interface FeedbackLoopData states the data coming back is in the actionValue property, but looks like it should be actionType (or the data returned is incorrect).

Not sure if the response contains the incorrect property name, or if the interface is incorrect... suspect the latter...

  import {
    Application,
    ActionPlanner,
    DefaultConversationState,
++  FeedbackLoopData,
    Memory,
    OpenAIModel,
    PromptManager,
    TurnState
  } from "@microsoft/teams-ai";

  // ... omitted for brevity

  const app = new Application({
    storage,
    ai: {
      planner,
++    enable_feedback_loop: true,
    },
  });


  // ... omitted for brevity

++// PATCH to fix interface bug:
++// > FeedbackLoopData expects `actionValue` but data returned is in `actionType`
++export interface FeedbackLoopDataPatch extends FeedbackLoopData {
++  actionType: {
++    reaction: string;
++    feedback: string;
++  };
++}
++app.feedbackLoop(async (context: TurnContext, state: TurnState, feedbackLoopData: FeedbackLoopData) => {
++  // what do you get back normally... rut-ro... you get `actionType`, not `actionValue`
++  console.log('Feedback loop data:', feedbackLoopData);
++
++  // patch the bug with custom interface from above
++  const fbData = feedbackLoopData as FeedbackLoopDataPatch;
++  if (fbData.actionType?.reaction === 'like') {
++    console.log(`👍 ${fbData.actionType?.feedback}`);
++  } else {
++    console.log(`👎 ${fbData.actionType?.feedback}`);
++  }
++});

Console output from above test:

Feedback loop data: {
  actionName: 'feedback',
  actionType: { reaction: 'like', feedback: 'rut ro' },
  replyToId: undefined
}
👍 rut to

Reproduction Steps

  1. Create simple chat bot (VSC TTK > New App > Custom Engine Agent > Basic AI Chat Bot
  2. Implement feedback using the steps above.
  3. Add necessary Azure AI deployment details to ./env/.env.testtool.user
  4. Run in Teams Test Test
  5. Send message to get bot to respond
  6. Add reaction
  7. Look at console that validates what's in the description above
@andrewconnell andrewconnell added the bug Something isn't working label Nov 7, 2024
@lilyydu
Copy link
Contributor

lilyydu commented Nov 8, 2024

Hi @andrewconnell,

Thanks for filing this bug- it should be under actionValue but there have been some recent updates with the feedback loop API that may have changed this- investigating & will follow up with you soon

@lilyydu lilyydu added the javascript Pull requests that update Javascript code label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

2 participants