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

refactor(plugin-watson): revive watson plugin with assistantV2 #1401

Merged
merged 17 commits into from
Apr 1, 2021

Conversation

vanbasten17
Copy link
Contributor

@vanbasten17 vanbasten17 commented Mar 25, 2021

Description

Botonic plugin-watson stopped working and a refactor has been needed to revive it.

Documentation

We need to document that this plugin does not support V1 Assistant anymore. Instead, it supports V2 Assistant.

Now, the plugin options needed are:

  • apikey
  • url
  • assistant_id
  • version (Optional: if not provided, '2020-04-01' will be used)

Test

If you want to try the new plugin:

  1. Ask @elozano98 for the Watson Assistant options used.
  2. Create a bot and link this plugin-watson version to it.
  3. Log the data assigned to input in the pre method.
  4. Deploy your chatbot.
  5. Text to your chatbot with something like: "I want to return this leather jacket".
  6. Feel free to experiment with it!

@vanbasten17 vanbasten17 marked this pull request as draft March 25, 2021 17:00
@vanbasten17 vanbasten17 added the documentation Documentation changes label Mar 25, 2021
@elozano98 elozano98 requested review from dpinol and ericmarcos March 26, 2021 11:19
@elozano98
Copy link
Contributor

@vanbasten17 I can not add you to reviewers, but can you take a look at this PR please? 🙏

@elozano98 elozano98 marked this pull request as ready for review March 26, 2021 11:31
Copy link
Contributor Author

@vanbasten17 vanbasten17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but we must be sure to return the results in the Botonic standard format. Remove @types/axios devDep as the plugin is not in TS yet. Also, too many things happening in index.js. Encapsulate it into a class WatsonOutputParser. And call sth like:

const parser = new WatsonOutputParser()
const nluResults = await parser.toBotonicOutput(input.data)
Object.assign(input, nluResults)

@elozano98 elozano98 force-pushed the fix/plugin-watson branch 2 times, most recently from dad071f to 97436ab Compare March 29, 2021 10:45
@elozano98 elozano98 requested review from MarcosCA and guinii March 29, 2021 10:55
packages/botonic-plugin-watson/README.md Outdated Show resolved Hide resolved
packages/botonic-plugin-watson/src/index.js Show resolved Hide resolved
packages/botonic-plugin-watson/src/index.js Outdated Show resolved Hide resolved
packages/botonic-plugin-watson/src/index.js Outdated Show resolved Hide resolved
packages/botonic-plugin-watson/src/index.js Outdated Show resolved Hide resolved
@elozano98 elozano98 requested a review from dpinol March 29, 2021 11:56
@elozano98 elozano98 requested a review from MarcosCA March 29, 2021 14:42
Copy link
Contributor

@asastre asastre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 2 small observations (the documentation one I think it should be fixed), the rest LGTM!

packages/botonic-plugin-watson/README.md Outdated Show resolved Hide resolved
packages/botonic-plugin-watson/package.json Outdated Show resolved Hide resolved
@elozano98 elozano98 merged commit f6e15c8 into master Apr 1, 2021
@elozano98 elozano98 deleted the fix/plugin-watson branch April 1, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation changes size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants