View Source TxtaiEx.Labels (txtai_ex v0.1.1)

txtai labels instance for interfacing with a remote txtai service via REST API calls, providing functionality for applying zero-shot classification to text.

Summary

Functions

Applies zero-shot classification in batch mode to a list of texts using a provided list of labels.

Applies zero-shot classification to a given text using a provided list of labels.

Functions

Link to this function

batchlabel(api, texts, labels)

View Source

Applies zero-shot classification in batch mode to a list of texts using a provided list of labels.

Parameters

  • api: The API struct containing configuration for URL and token.
  • texts: A list of texts to classify.
  • labels: A list of labels for classification.

Returns

  • on success, where batch_classifications contains a list of classification results for each text.
  • on failure.
Link to this function

label(api, text, labels)

View Source

Applies zero-shot classification to a given text using a provided list of labels.

Parameters

  • api: The API struct containing configuration for URL and token.
  • text: The text to classify.
  • labels: A list of labels for classification.

Returns

  • on success, where classifications is a list of maps with keys id and score, sorted by highest score.
  • on failure.