Labelling performs a vector search on the labels and fetches the closest max_number_of_labels.

Module Contents#

class relevanceai.operations_new.text_tagging.transform.TextTagTransform(text_field: str, labels: list, minimum_score: float = 0.25, model_id=None, maximum_number_of_labels: int = 5, **kwargs)#

To write your own operation, you need to add: - name - transform

property classifier(self)#
transform(self, documents) List[Dict[str, Any]]#

abstractmethod for transform

property name(self)#

abstractproperty for name

tag_text(self, query, labels)#

It takes a query vector, a vector field, a list of documents, and a few other parameters, and returns a list of documents sorted by their cosine similarity to the query vector

  • query_vector – the vector you want to compare against

  • vector_field – the field in the documents that contains the vector

  • documents – list of documents

  • reverse – True/False

  • optional – True/False

  • score_field (str, optional) – str = “_label_score”

  • max_number_of_labels (int, optional) – int = 1,

  • similarity_threshold (float, optional) – float = 0,

Return type

A list of dictionaries.

get_operation_metadata(self) Dict[str, Any]#

abstractmethod for return metadata for upsertion