How to make rasa chatbot to search any topic from google?

I created a simple Rasa Chatbot and trained with basic questions but if user ask anything other than what I trained it should search from Google and show it. How to do it. Thank you.

1 Like

I guess you’ll have to write a custom action that takes the user input (or part of it), sends it to the Custom Search JSON API by Google and displays the responses accordingly. I suggest you look into Rasa Custom Actions and above mention Google API

3 Likes

One approach could be:

You can have something like an out-of-scope intent (see this example) and trigger a custom action on that intent. In this custom action you can hit google’s api to search for the text.

3 Likes

can you show me an example or sample code because where to use it I have no idea and thanks for fast reply.

In your stories.md file, you write:

## search_google
* out_of_scope
    - action_search_google

Now you need to implement this action in your actions.py. See doc. You can either scrape the search page or use Google API as mentioned by @sugarshock for getting the search results.

1 Like

Thank you so much.

I want to search the out _of_scope text on duck duck go search engine and display the results . I want to implement this as a custom action.Request someone to help me with this. Thank you.

Hey skjainmiah, Did you find solution to your problem? I am also trying to build something similar to this for my personnel use. I am trying to fetch meaning of some particular medical term from a website which user will input in the rasabot. This is the website:

I am trying to use Google Custom Search API

I have got no success in this.

Can you please share your repository if you have implemented something similar in your bot. That will be of great help!

Thanks

1 Like