Vectorize#

Basic#

Operations.vectorize(fields=None, filters=None, **kwargs)#

Vectorize the model

Parameters
  • fields (List[str]) – A list of fields to vectorize

  • encoders (Dict[str, List[Any]]) – A dictionary that creates a mapping between your unstructured fields and a list of encoders to run over those unstructured fields

Returns

If the vectorization process is successful, this dict contains the added vector names. Else, the dict is the request result containing error information.

Return type

dict

Example

from relevanceai import Client

client = Client()

dataset_id = "sample_dataset_id"
ds = client.Dataset(dataset_id)

ds.vectorize(
    fields=["text_field_1", "text_field_2"],
    encoders={
        "text": ["mpnet", "use"]
    }
)

# This operation with create 4 new vector fields
#
# text_field_1_mpnet_vector_, text_field_1_mpnet_vector_
# text_field_1_use_vector_, text_field_1_use_vector_