How does OpenRouterEmbedder handle out-of-order provider responses?

OpenRouterEmbedder.embed() sends batches to OpenRouter and handles out-of-order provider responses by sorting the response items by their index field. The embedder reads the index from each response item and places the embedding vector back into the original input slot, preserving order. A missing index defaults to 0; the call raises VectorSearchError only if the returned count doesn't match the batch size, or if any embedding's dimension doesn't match the expected dimension.

Diagram projects-orchestrata-ultimate-faq-openrouter-out-of-order-1