DistilBERT REST Client

Predict Request

var request = PredictRequest.builder()
    .question("My Question")
    .style("my-custom-style")
    .model('model-to-use') // this is optional. This line can be omitted and the server will use the default model
    .chunk(new Chunk("chunk-1", "First chunk of text for the prediction"))
    .chunk(new Chunk("chunk-2", "Second chunk of text for the prediction"))
    .build();

var result = client.predict(request);

A model can be specified. If so, then it will be passed as part of the request to the Distilbert server. This is optional however. If no model is provided then the server will use the default one.

The result will return 200 for the status code and the corresponding iterable prediction:

[
  {
    "answer": "prediction",
    "probability": 1.0,
    "start_logit": 4.5558319091796875,
    "end_logit": 4.782039165496826,
    "id": "chunk-1",
    "highlight": "First chunk of text for the <span class=\"my-custom-style\">prediction</span>"
  },
  {
    "answer": "",
    "probability": 1.0,
    "start_logit": 0,
    "end_logit": 0,
    "id": "chunk-2"
  }
]

©2024 Pureinsights Technology Corporation