Vectorizer

Vectorizer#

Vecworks ships with a built-in server to remotely serve any vectorizer implementing Vecworks’ Vectorizer interface. For example, to remotely serve a sentence transformer built on top of the multilingual-e5-large model, the following bash command may be invoked:

python -m vecworks.servers.vectorizer \
    -v vecworks.vectorizers.sbert.sbertVectorizer \
        "intfloat/multilingual-e5-large" \
        model_name_or_path="intfloat/multilingual-e5-large" \
        prompt_format="query: " normalize=True device="cuda" \
    --port 4000

Dependencies#

To deploy Vecworks built-in vectorizer server, additional packages need to be installed. You may do so using pip:

pip install vecworks[server]

Arguments#

Vecworks vectorizer server takes a nummer of arguments as detailed below.

-v <vectorizer> <alias> <args>, --vectorizer <vectorizer> <alias> <args>#

Specifies what vectorizer to serve, under what alias, and how to instantiate it.

Note

Multiple vectorizer specifications may be passed to a server, making it possible to serve multiple vectorizers using the same server instance. This may be done as follows:

python -m vecworks.server.vectorizer \
    -v vecworks.vectorizers.sbertVectorizer <args> \
    -v vecworks.vectorizers.fastText <args> \
    -- port 4000
vectorizer : str (required)#

Qualified name of the Python class to deploy as vectorizer.

alias : str (required)#

Alias to assign to instantiation of given vectorizer.

args : arg (optional, multiple)#

Vectorizer-specific arguments formatted in argument_name="value" format.

--host <str> = "127.0.0.1"#

Host to bind to.

--port <int>, -p <int> = 8000#

Port to bind to.

--ssl-keyfile <str>#

Path to the SSL key file.

--ssl-keyfile-password <str>#

Password with which the SSL key file may be decrypted.

--ssl-certfile <str>#

Path to the SSL cert file.

--ssl-ca-certs <str>#

Path to file containing list of root certificates issued by certification authorities.

--ssl-cert-reqs <int> = 0#

Specifies whether peers’ certificates are validated, and how to behave if verification fails.

The following values may be passed:

  1. CERT_NONE

  2. CERT_OPTIONAL

  3. CERT_REQUIRED

--ssl-ciphers <str> = "TLSv1"#

Ciphers available for the socket to use, formatted in OpenSSL cipher list format.

--cors-allowed-origins <str+>#

A list of origins that should be permitted to make cross-origin requests.

--cors-allow-credentials <bool> = FALSE#

Whether cookies are supported for cross-origin requests.

--cors-allowed-methods <str+> = "GET"#

A list of HTTP methods that should be allowed for cross-origin requests.

--cors-allowed-headers <str+>#

A list of HTTP request headers that should be supported for cross-origin requests

--log-level <"critical" | "error" | "warning" | "info" | "debug" | "trace"> = "info"#

The minimal event level that should be logged.