Using sub-microservices with deeppavlov-agent

Hi guys,

Hope you are all well !

I would like to test some custom sub-skills, and I do not know if we can call them skills ^^, in addition of those offered by deeppavlov.

To be clear, I want to add these following repositories as alternative/cumulative answers to a chat message:

Is it possible to use other service and aggregate their responses with deeppavlov agent ?

Shall I use a service like https://www.krakend.io/docs/overview/introduction/ in order to aggregate and reformat response from other service ?

Thanks for your insights and inputs on these questions.

Cheers,
X

Any help on this point would be welcomed ^^

Sorry for your wait. We are making demonstration of usage of the agent with deeppavlov’s models later. Current documentation is available here. It can help you.

Yes, you can use other services (e.g. krakend) and in which case you have 3 options:

  • create your own proxy service to redirect requests from the agent to a third service and back
  • setup agent POST requests (available only POST methods) for a directed request to a third service
  • wrap you third service into native service of agent (it is just docker-based service with POST request handler or raw python code)

For example, you can choose gpt2bot and write a handler based on an interactive_bot.py. Below you can see a snippet with a Flask handler:

@app.route("/model", methods=["POST"])
def respond():
    last_utterance_batch = request.json.get("last_utterance_batch", [])
    human_utterance_history_batch = request.json.get("human_utterance_history_batch", [])
    for last_utterance, human_utterance_history in zip(last_utterance_batch, human_utterance_history_batch):
            response_utter, confidence = model.respond(last_utterance, human_utterance_history)
            response.append((response_utter, confidence))
    return jsonify(response)
1 Like