async def test_large_batch_splitting(self, model):
        """Test that large batches are split appropriately."""
        # Create a list of 150 texts (larger than MAX_BATCH_SIZE of 100)
        texts = [f"Text {i}" for i in range(150)]

        mock_embedding = [0.1, 0.2, 0.3] * 512

        # Create responses for each batch
        def create_mock_response(batch_size):
            return CreateEmbeddingResponse(
                object="list",
                data=[
                    Embedding(
                        object="embedding",
                        embedding=mock_embedding,
                        index=i
                    ) for i in range(batch_size)
                ],
                model="text-embedding-3-small",
                usage={"prompt_tokens": batch_size * 5, "total_tokens": batch_size * 5}
            )

        with patch.object(model._client.embeddings, 'create', new_callable=AsyncMock) as mock_create:
            # Setup side effects for multiple batches
            mock_create.side_effect = [
                create_mock_response(100),  # First batch: 100 texts
                create_mock_response(50),   # Second batch: 50 texts
            ]

            result = await model.embed_many(texts)

            # Verify the result
            assert isinstance(result, list)
            assert len(result) == 150
            assert all(len(vec) == 1536 for vec in result)

            # Verify two API calls were made
            assert mock_create.call_count == 2

            # Verify the first call had 100 texts and second had 50
            first_call_args = mock_create.call_args_list[0]
            second_call_args = mock_create.call_args_list[1]

            assert len(first_call_args.kwargs["input"]) == 100
            assert len(second_call_args.kwargs["input"]) == 50
Test that large batches are split appropriately.
backend/tests/platform/embedding_models/test_openai_text2vec.py