OpenAI#
OpenAI governs a embeddings API that is implemented by various providers, including vLLM.
Dependencies#
To interface in Vecworks with embedding services implementing the OpenAI interface additional dependencies need to be installed. You may do so using pip:
pip install vecworks[openai]
API#
- class vecworks.vectorizers.openai.OpenAIVectorizer#
Wrapper class to ease use of services implementing the OpenAI embedding API.
Interface#
- __init__(url: str, model: str, authenticator: Authenticator | None = None, dimensions: int | None = None)#
Initializes the vectorizer.
Parameters#
== Connection
- url
URL of the service providing an OpenAI-compatible API.
- model
Name of the model. If no name is passed, the name must be specified when
transform()
is called.- authenticator
Authenticator that may be used to acquire an authentication key when the external service requests for authentication.
== Configuration
- dimensions
The number of embeddings the resulting vector should have.
- transform(input: Any | Iterable[Any], model: str | None = None) ndarray #
Vectorizes the given data.
Also see:
Vectorizer
.