module pixeltable.functions.voyageai
Pixeltable UDFs that wrap various endpoints from the Voyage AI API. In order to use them, you must firstpip install voyageai and configure your Voyage AI credentials, as described in
the Working with Voyage AI tutorial.
udf embeddings()
Signature
embeddings API endpoint.
For additional details, see: https://docs.voyageai.com/docs/embeddings
Request throttling:
Applies the rate limit set in the config (section voyageai, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install voyageai
input(pxt.String): The text to embed.model(pxt.String): The model to use for the embedding. Recommended options:voyage-3-large,voyage-3.5,voyage-3.5-lite,voyage-code-3,voyage-finance-2,voyage-law-2.input_type(pxt.String | None): Type of the input text. Options:None,query,document. Wheninput_typeisNone, the embedding model directly converts the inputs into numerical vectors. For retrieval/search purposes, we recommend setting this toqueryordocumentas appropriate.truncation(pxt.Bool | None): Whether to truncate the input texts to fit within the context length. Defaults toTrue.output_dimension(pxt.Int | None): The number of dimensions for resulting output embeddings. Most models only support a single default dimension. Modelsvoyage-3-large,voyage-3.5,voyage-3.5-lite, andvoyage-code-3support: 256, 512, 1024 (default), and 2048.output_dtype(pxt.String | None): The data type for the embeddings to be returned. Options:float,int8,uint8,binary,ubinary. Onlyfloatis currently supported in Pixeltable.
pxt.Array[(None,), Float]: An array representing the application of the given embedding toinput.
voyage-3.5 to an existing Pixeltable column tbl.text of the table tbl:
text, using the model voyage-3.5:
udf multimodal_embed()
Signatures
multimodal_embed API endpoint.
For additional details, see: https://docs.voyageai.com/docs/multimodal-embeddings
Request throttling:
Applies the rate limit set in the config (section voyageai, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install voyageai
text(String): The text to embed.model(String, default:Literal('voyage-multimodal-3')): The model to use. Currently onlyvoyage-multimodal-3is supported.input_type(String | None, default:Literal(None)): Type of the input. Options:None,query,document. For retrieval/search, set toqueryordocumentas appropriate.truncation(Bool, default:Literal(True)): Whether to truncate inputs to fit within context length. Defaults toTrue.
pxt.Array[(1024,), Float]: An array of 1024 floats representing the embedding.
description:
description:
img:
udf rerank()
Signature
rerank API endpoint.
For additional details, see: https://docs.voyageai.com/docs/reranker
Request throttling:
Applies the rate limit set in the config (section voyageai, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install voyageai
query(pxt.String): The query as a string.documents(pxt.Json): The documents to be reranked as a list of strings.model(pxt.String): The model to use for reranking. Recommended options:rerank-2.5,rerank-2.5-lite.top_k(pxt.Int | None): The number of most relevant documents to return. If not specified, all documents will be reranked and returned.truncation(pxt.Bool): Whether to truncate the input to satisfy context length limits. Defaults toTrue.
pxt.Json: A dictionary containing:results: List of reranking results withindex,document, andrelevance_scoretotal_tokens: The total number of tokens used