Skip to content

Conversation

@mattapperson
Copy link
Collaborator

Summary

This PR adds comprehensive end-to-end tests for the newly added embeddings API functionality.

Changes

  • ✅ Added tests/e2e/embeddings.test.ts with 5 test cases covering:

    • Single text input embeddings generation
    • Multiple text inputs (batch processing)
    • Embedding dimensions consistency validation
    • Edge case handling (empty strings)
    • Model information validation
    • Support for both array and base64 encoded embeddings
  • ✅ Updated tests/e2e/README.md to document the new test suite

Test Results

All 5 tests pass successfully:

✓ should successfully generate embeddings for a single text input
✓ should generate embeddings for multiple text inputs
✓ should generate consistent embedding dimensions
✓ should handle empty string input gracefully
✓ should include model information in response

Model Used

Tests use openai/text-embedding-3-small model via OpenRouter's embeddings API.

Test plan

  • All tests pass locally
  • Tests properly handle both array and base64 response formats
  • Documentation updated

- Add comprehensive test suite for the embeddings API
- Test single and multiple text input embeddings
- Verify embedding dimensions consistency
- Handle edge cases (empty strings)
- Support both array and base64 encoded embeddings
- Validate model information in responses
- Update e2e README with embeddings test documentation

All tests pass successfully with the openai/text-embedding-3-small model.
- Check for promptTokens and totalTokens in usage object
- Verify token counts are numbers and greater than zero
- Ensures comprehensive validation of API response
@mattapperson mattapperson merged commit e444431 into main Nov 5, 2025
2 of 3 checks passed
@mattapperson mattapperson deleted the embeddings-example branch November 5, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants