Skip to main content
The input field can be a single string or an array of inputs. Batching is useful when you are indexing many chunks and want to reduce request overhead.

Batch Example

The response returns one embedding per input with an index field, so you can map results back to the original batch order.

How to read the result

  • data[0] is the embedding for the first input
  • data[1] is the embedding for the second input
  • the index field lets you map embeddings back to the original batch even if you do additional processing later

When To Batch

  • indexing many documents or chunks
  • reducing per-request overhead
  • building offline retrieval corpora

Common mistakes

  • batching inputs from different workflows when you need separate metadata
  • assuming the response order can be inferred without using index
  • sending a giant batch without thinking about request size, retries, and indexing checkpoints

Reference