Skip to content

add embedder tests #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2025
Merged

Conversation

evanmschultz
Copy link
Contributor

@evanmschultz evanmschultz commented May 1, 2025

Add Tests for Embedder Implementations

Changes

  • Added test suite for OpenAI, Gemini, and VoyageAI embedder implementations
  • Created test fixtures to generate mock embedding values
  • Implemented tests for both single and batch embedding operations

Technical Details

  • Added test files:
    • embedder_fixtures.py: Utility function for creating mock embedding values
    • test_openai.py: Tests for OpenAI embedder
    • test_gemini.py: Tests for Gemini embedder
    • test_voyage.py: Tests for VoyageAI embedder
  • Each test file includes:
    • Mock responses for API clients
    • Tests for API parameter validation
    • Tests for proper response processing
    • Tests for both single and batch embedding methods

I have read the CLA Document and I hereby sign the CLA


Important

Add tests for OpenAI, Gemini, and VoyageAI embedders, including single and batch operations, with mock API interactions.

  • Tests:
    • Added test_openai.py, test_gemini.py, test_voyage.py for OpenAI, Gemini, and VoyageAI embedders.
    • Each test file includes tests for single and batch embedding operations, API parameter validation, and response processing.
    • Utilizes mock responses and clients to simulate API interactions.
  • Fixtures:
    • Added embedder_fixtures.py for creating mock embedding values.
    • Provides utility function create_embedding_values() for generating mock data.

This description was created by Ellipsis for c7af153. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to c7af153 in 1 minute and 34 seconds. Click for details.
  • Reviewed 439 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 10 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/embedder/embedder_fixtures.py:18
  • Draft comment:
    The create_embedding_values function is clear and idiomatic. Consider adding a type hint for 'dimension' if desired, but it's acceptable.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 80% None
2. tests/embedder/test_gemini.py:31
  • Draft comment:
    The helper create_gemini_embedding is clear; no changes required.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 80% None
3. tests/embedder/test_openai.py:31
  • Draft comment:
    The create_openai_embedding function and slicing for embedding dimensions are clear and correctly implemented.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 80% None
4. tests/embedder/test_voyage.py:88
  • Draft comment:
    Converting embedding values to float in expected results is clear; no issues found.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 80% None
5. tests/embedder/embedder_fixtures.py:18
  • Draft comment:
    Optional: Consider using 'List[float]' from the typing module for clearer type annotations if you need compatibility with older Python versions.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None
6. tests/embedder/test_gemini.py:61
  • Draft comment:
    Ensure the patch target 'google.genai.Client' is correct and up-to-date with the actual module structure.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None
7. tests/embedder/test_openai.py:61
  • Draft comment:
    Verify that the patch target 'openai.AsyncOpenAI' correctly reflects how the OpenAI client is imported and used in OpenAIEmbedder.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None
8. tests/embedder/test_voyage.py:54
  • Draft comment:
    Confirm that 'voyageai.AsyncClient' is the correct patch target for the VoyageAI client. Adjust if the client’s import path ever changes.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None
9. tests/embedder/test_voyage.py:88
  • Draft comment:
    The explicit conversion to float in the expected result may be redundant if the embedding values are already floats; consider adding a comment if this conversion is intentional.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None
10. tests/embedder/test_gemini.py:30
  • Draft comment:
    Consider parameterizing similar test cases across embedder implementations to reduce duplication in test logic (optional).
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 80% None

Workflow ID: wflow_V6wkOa7Fdml2KcX3

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@evanmschultz
Copy link
Contributor Author

Partially addresses issue #375

@prasmussen15 prasmussen15 self-requested a review May 3, 2025 13:13
Copy link
Collaborator

@prasmussen15 prasmussen15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@prasmussen15 prasmussen15 merged commit f2e95a5 into getzep:main May 3, 2025
4 checks passed
@getzep getzep locked and limited conversation to collaborators May 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants