RemoteQuestionAnswering#

class RemoteQuestionAnswering(config)#

Bases: BatchedStep

Step that uses an external API endpoint.

It sends a batch of Document to qa remote service and returns the annotated batch of Document

Parameters
  • step (str, "external") – external

  • type (str, "remote_qa") – remote_qa

  • input_field__question (str, "qa_question") – Input field containing the question

  • input_field__context (str, "qa_context") – Input field containing the context

  • output_field__answer (str, "qa_answer") – Output field

  • max_concurrent (int, 10) – Maximum concurrent requests

  • language_service_mapping (dict,{}) – Define custom service URL that should be used for the detected language. If the language is not found in the mapping, the default_worker is used and the service URL is read from the configuration service.

  • default_worker (str, "accurate") – Default worker that is used to read service URL from the configuration service if detected language is not found in the language_service_mapping.

Example

{
    "step": "external",
    "type": "remote_qa",
    "language_service_mapping": {
        "en": "http://localhost:8000"
    },
    "default_worker: "accurate"
}

Methods Summary

get_client(language, worker)

rtype

QAClient

process_batch(batch)

Process a batch of documents.

Methods Documentation

get_client(language, worker)#
Return type

QAClient

process_batch(batch)#

Process a batch of documents. If not defined will default to using self.process_doc for each document in the batch.

Parameters

batch (list(Document)) – List of documents

Returns

List of processed documents

Return type

list(Document)