Repository navigation
Conversation
Batch and files APIs are served from a dedicated batch. subdomain (https://batch.api.voyageai.com/v1) instead of the default host. Add util.get_batch_base_url() deriving that host from the default base URL, preserving the /v1 path and leaving the MongoDB host untouched. The default base URL for all other endpoints is unchanged (non-breaking).
|
Thanks — reviewed the diff. It's small, additive, non-breaking, and the string logic is correct: 1. Unverified endpoint constant. The whole value of this PR rests on 2. Ignores custom 3. Dead code until batch lands. As the description notes, nothing calls this yet — no batch/files resource exists. Adding a public-ish None of these are correctness bugs in the code as written; (1) and (2) are the ones I'd want settled before this ships. |
|
I believe there is a misunderstanding here. The following is about the batch inference: https://docs.voyageai.com/docs/batch-inference. So, i guess, at the moment none of the batch inference is implemented, therefore it should be a completely new implementation, the batch is not implemented in the SDKs. Please confirm! |
What
Adds
voyageai.util.get_batch_base_url(api_key)— the base-URL seam for the batch and files APIs, which are served from a dedicatedbatch.subdomain:https://api.voyageai.com/v1→https://batch.api.voyageai.com/v1It derives the batch host from
get_default_base_url(), preserving the/v1path convention. The MongoDB host (al-keys →ai.mongodb.com/v1) is left untouched, since thebatch.subdomain only applies to the Voyage AI host.Why
Batch/files calls need to target
batch.api.voyageai.comwhile every other endpoint (embeddings, rerank, multimodal embeddings, contextualized embeddings) keeps usingapi.voyageai.com. This is not a breaking change —get_default_base_url()is unchanged, so all existing endpoints are unaffected.Note for the requester
The SDK does not currently implement batch or files endpoints — the only API resources today are
embeddings,multimodalembeddings,rerank, andcontextualizedembeddings(seevoyageai/api_resources/), all of which resolve their host purely viaget_default_base_url()invoyageai/util.pyand hit it throughAPIRequestor(base_url + url).So there is no existing batch/files call site to repoint. This PR adds the exact seam to call from those endpoints once they land: when the batch/files
APIResource/client methods are added, passbase_url=util.get_batch_base_url(api_key)(or wire it in_BaseClient.__init__for those resources) instead of the default. That keeps host selection in one place, consistent withget_default_base_url().If you'd instead prefer a client constructor arg or an env override, say so and I'll adjust — this was the minimal change that matches the existing code shape.
Tests
Added to
tests/test_unit.py:test_get_batch_base_url_voyage→https://batch.api.voyageai.com/v1test_get_batch_base_url_mongodb→ unchangedhttps://ai.mongodb.com/v1test_get_batch_base_url_leaves_default_unchanged→ default stillhttps://api.voyageai.com/v1pytest tests/test_unit.py -k base_url→ 5 passed. Fulltests/test_unit.py→ 128 passed, 12 skipped; the 3 failures are pre-existing and unrelated (missingffmpegmodule in the local env, inTestVideoUtilsErrorPaths).