openvino_genai.TextEmbeddingPipeline#

class openvino_genai.TextEmbeddingPipeline#

Bases: pybind11_object

Text embedding pipeline

__init__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, models_path: os.PathLike | str | bytes, device: str, config: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.Config | None = None, **kwargs) None#

Constructs a pipeline from xml/bin files, tokenizer and configuration in the same dir models_path (os.PathLike): Path to the directory containing model xml/bin files and tokenizer device (str): Device to run the model on (e.g., CPU, GPU). config: (TextEmbeddingPipeline.Config): Optional pipeline configuration kwargs: Plugin and/or config properties

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__()

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(self, models_path, device[, config])

Constructs a pipeline from xml/bin files, tokenizer and configuration in the same dir models_path (os.PathLike): Path to the directory containing model xml/bin files and tokenizer device (str): Device to run the model on (e.g., CPU, GPU).

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_pybind11_conduit_v1_

embed_documents(self, texts)

Computes embeddings for a vector of texts

embed_query(self, text)

Computes embeddings for a query

start_embed_documents_async(self, texts)

Asynchronously computes embeddings for a vector of texts

start_embed_query_async(self, text)

Asynchronously computes embeddings for a query

wait_embed_documents(self)

Waits computed embeddings of a vector of texts

wait_embed_query(self)

Waits computed embeddings for a query

Attributes

__annotations__

class Config#

Bases: pybind11_object

Structure to keep TextEmbeddingPipeline configuration parameters.

Attributes:
max_length (int, optional):

Maximum length of tokens passed to the embedding model.

pooling_type (TextEmbeddingPipeline.PoolingType, optional):

Pooling strategy applied to the model output tensor. Defaults to PoolingType.CLS.

normalize (bool, optional):

If True, L2 normalization is applied to embeddings. Defaults to True.

query_instruction (str, optional):

Instruction to use for embedding a query.

embed_instruction (str, optional):

Instruction to use for embedding a document.

__annotations__ = {}#
__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(value, /)#

Return self==value.

__format__(format_spec, /)#

Default object formatter.

Return str(self) if format_spec is empty. Raise TypeError otherwise.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__getstate__()#

Helper for pickle.

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.Config) -> None

  2. __init__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.Config, **kwargs) -> None

__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__ne__(value, /)#

Return self!=value.

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

__sizeof__()#

Size of object in memory, in bytes.

__str__()#

Return str(self).

__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

_pybind11_conduit_v1_()#
property embed_instruction#
property max_length#
property normalize#
property pooling_type#
property query_instruction#
class PoolingType#

Bases: pybind11_object

Members:

CLS : First token embeddings

MEAN : The average of all token embeddings

CLS = <PoolingType.CLS: 0>#
MEAN = <PoolingType.MEAN: 1>#
__annotations__ = {}#
__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(self: object, other: object, /) bool#
__format__(format_spec, /)#

Default object formatter.

Return str(self) if format_spec is empty. Raise TypeError otherwise.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__getstate__(self: object, /) int#
__gt__(value, /)#

Return self>value.

__hash__(self: object, /) int#
__index__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.PoolingType, /) int#
__init__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.PoolingType, value: SupportsInt) None#
__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__int__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.PoolingType, /) int#
__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__members__ = {'CLS': <PoolingType.CLS: 0>, 'MEAN': <PoolingType.MEAN: 1>}#
__ne__(self: object, other: object, /) bool#
__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__(self: object, /) str#
__setattr__(name, value, /)#

Implement setattr(self, name, value).

__setstate__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.PoolingType, state: SupportsInt, /) None#
__sizeof__()#

Size of object in memory, in bytes.

__str__(self: object, /) str#
__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

_pybind11_conduit_v1_()#
property name#
property value#
__annotations__ = {}#
__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(value, /)#

Return self==value.

__format__(format_spec, /)#

Default object formatter.

Return str(self) if format_spec is empty. Raise TypeError otherwise.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__getstate__()#

Helper for pickle.

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, models_path: os.PathLike | str | bytes, device: str, config: openvino_genai.py_openvino_genai.TextEmbeddingPipeline.Config | None = None, **kwargs) None#

Constructs a pipeline from xml/bin files, tokenizer and configuration in the same dir models_path (os.PathLike): Path to the directory containing model xml/bin files and tokenizer device (str): Device to run the model on (e.g., CPU, GPU). config: (TextEmbeddingPipeline.Config): Optional pipeline configuration kwargs: Plugin and/or config properties

__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__ne__(value, /)#

Return self!=value.

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

__sizeof__()#

Size of object in memory, in bytes.

__str__()#

Return str(self).

__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

_pybind11_conduit_v1_()#
embed_documents(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, texts: collections.abc.Sequence[str]) list[list[float]] | list[list[int]] | list[list[int]]#

Computes embeddings for a vector of texts

embed_query(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, text: str) list[float] | list[int] | list[int]#

Computes embeddings for a query

start_embed_documents_async(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, texts: collections.abc.Sequence[str]) None#

Asynchronously computes embeddings for a vector of texts

start_embed_query_async(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline, text: str) None#

Asynchronously computes embeddings for a query

wait_embed_documents(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline) list[list[float]] | list[list[int]] | list[list[int]]#

Waits computed embeddings of a vector of texts

wait_embed_query(self: openvino_genai.py_openvino_genai.TextEmbeddingPipeline) list[float] | list[int] | list[int]#

Waits computed embeddings for a query