Susper gives answers to your questions using SUSI AI. We want to give users best experience while they are searching for solutions to their questions. To achieve this, we have incorporated with features like infobox and intelligence using SUSI.
Google has this feature where users can ask questions like ‘Who is president of USA?’ and get answers directly without encouraging the users to deep-dive into the search results to know the answer.
Similarly Susper gives answer to the user:
It also gives answer to question which is related to real time data like temperature.
How we have implemented this feature?
We used the API Endpoint of SUSI at http://api.asksusi.com/
Using SUSI API is as simple as sending query as a URL parameter in GET request http://api.susi.ai/susi/chat.json?q=YOUR_QUERY
You can also get various action types in the response. Eg: An anwser type response for http://api.susi.ai/susi/chat.json?q=hey%20susi is:
Documentation regarding SUSI is available at here.
Implementation in Susper:
We have created an Intelligence component to display answer related to a question. You can check it here: https://github.com/fossasia/susper.com/tree/master/src/app/intelligence
It takes care about rendering the information and styling of the rendered data received from SUSI API.
The intelligence.component.ts makes a call to Intelligence Service with the required query and the intelligence service makes a GETrequest to the SUSI API and retrieves the results.
Whenever the getintelligenceresponse of intelligenceService is called, it creates a URLSearchParams() object and set required parameters in it and send them in jsonp.get request. We also set callback to ‘JSONP_CALLBACK’ to inform the API to send us data in JSONP.
Thereby, the intelligence component retrieves the answer and displays it with search resultson Susper.
Source code for this implementation could be found in this pull:
- Susi Documentation: https://github.com/fossasia/susi_server/blob/development/docs/skills/susi_chat_api.md
- Susi EndPoint: http://api.susi.ai/