EndpointStep#

class EndpointStep(config)#

Bases: BatchedStep

Step that uses an external API endpoint.

It sends a batch of Document in the shape of {“docs”:LIST_OF_DOCS, “fields”:LIST_OF_FIELDS} to the endpoint and returns the received batch of Document

Parameters
  • type (str) – endpoint

  • fields (list) – list of relevant fields

  • process_endpoint (str) – URL of batched process endpoint

  • train_endpoint (str) – URL of batched train endpoint

Example

{
    "name": "endpoint",
    "step": "endpoint",
    "type": "endpoint",
    "fields": ["title","body"],
    "process_endpoint": "https://localhost:<PORT>/process",
    "train_endpoint": "https://localhost:<PORT>/train"
}

Methods Summary

process_batch(batch)

Process a batch of documents.

train_batch(batch)

Train on a batch of documents

Methods Documentation

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)

train_batch(batch)#

Train on a batch of documents

Parameters

batch (list(Document)) – List of documents