Skip to content

Add embeddings and vector_io tests#488

Merged
jgarciao merged 8 commits intoopendatahub-io:mainfrom
jgarciao:add-vectordb-tests
Aug 7, 2025
Merged

Add embeddings and vector_io tests#488
jgarciao merged 8 commits intoopendatahub-io:mainfrom
jgarciao:add-vectordb-tests

Conversation

@jgarciao
Copy link
Copy Markdown
Contributor

@jgarciao jgarciao commented Aug 4, 2025

Signed-off-by: Jorge Garcia Oncins <jgarciao@redhat.com>
Signed-off-by: Jorge Garcia Oncins <jgarciao@redhat.com>
@jgarciao jgarciao requested a review from a team as a code owner August 4, 2025 15:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Added new tests for embedding model inference and vector database operations.
    • Renamed an existing test for improved clarity.
  • Chores
    • Updated ignored files to exclude the results/ directory from version control.

Walkthrough

The .gitignore file was updated to exclude the results/ directory from version control. In addition, the RAG test suite was expanded with two new tests covering embedding inference and vector database operations, and an existing test was renamed for clarity without modifying its logic.

Changes

Cohort / File(s) Change Summary
Git Ignore Update
.gitignore
Added results/ to the ignore list, preventing tracked changes to this directory or its contents.
RAG Test Enhancements
tests/rag/test_rag.py
Added two tests for embedding inference and vector database ingestion/retrieval; renamed an existing test method.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

size/xl, lgtm-by-lugi0

Suggested reviewers

  • jiripetrlik
  • ChristianZaccaria

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 059bb71 and 79d9103.

📒 Files selected for processing (2)
  • .gitignore (1 hunks)
  • tests/rag/test_rag.py (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
📚 Learning: in model registry rbac tests, client instantiation tests are designed to verify the ability to creat...
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#354
File: tests/model_registry/rbac/test_mr_rbac.py:64-77
Timestamp: 2025-06-16T11:26:53.789Z
Learning: In Model Registry RBAC tests, client instantiation tests are designed to verify the ability to create and use the MR python client, with actual API functionality testing covered by separate existing tests.

Applied to files:

  • tests/rag/test_rag.py
🧬 Code Graph Analysis (1)
tests/rag/test_rag.py (1)
tests/rag/conftest.py (1)
  • rag_lls_client (122-155)
🔇 Additional comments (5)
.gitignore (1)

53-53: LGTM! Appropriate exclusion of test artifacts.

Adding results/ to .gitignore is a sensible change that prevents test output and intermediate data from being committed to version control, which aligns with the new RAG tests being added.

tests/rag/test_rag.py (4)

6-7: LGTM! Appropriate type imports for new tests.

The additional imports for EmbeddingsResponse, QueryChunksResponse, and Chunk are necessary for the new embedding and vector I/O tests and follow proper typing practices.


55-55: LGTM! Improved test method naming.

Renaming to test_rag_chat_completions makes the test purpose more specific and descriptive compared to the generic test_rag_basic_inference.


82-103: LGTM! Well-structured embedding functionality test.

The new test method effectively validates embedding generation with:

  • Clear documentation of test purpose
  • Proper model retrieval and dimension extraction
  • Comprehensive assertions for response structure and data types
  • Appropriate use of type ignore for the output_dimension parameter

The test follows established patterns and provides good coverage for embedding model functionality.


104-162: LGTM! Comprehensive vector I/O integration test.

This test method excellently validates the complete vector database workflow:

  • Proper resource management with unique ID generation and cleanup
  • Complete test flow: register → insert → query → cleanup
  • Robust error handling with logging for cleanup failures
  • Comprehensive assertions validating retrieved data integrity
  • Clear documentation referencing the llama-stack documentation

The try/finally structure ensures proper cleanup even on test failures, which is a best practice for integration tests that create external resources.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/m label Aug 4, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/hold', '/verified', '/build-push-pr-image', '/wip', '/cherry-pick', '/lgtm'}

Comment thread tests/rag/test_rag.py
Copy link
Copy Markdown
Contributor

@jiripetrlik jiripetrlik left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'm concerned, though, that we might have too many smoke tests. Perhaps we can move some of them to a higher tier.

@jgarciao
Copy link
Copy Markdown
Contributor Author

jgarciao commented Aug 6, 2025

Looks good to me. I'm concerned, though, that we might have too many smoke tests. Perhaps we can move some of them to a higher tier.

@jiripetrlik , it is a valid concern. Currently, all rag tests (including these 2 new) run in 3m 30s in my machine. In my opinion, we can merge this PR and move some tests to sanity when we have more or they require more time

Copy link
Copy Markdown
Contributor

@jiripetrlik jiripetrlik left a comment

Choose a reason for hiding this comment

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

Yes @jgarciao , it is true. Let's merge this PR and decide about moving tests to sanity in the future.

Comment thread tests/rag/test_rag.py
@jgarciao jgarciao enabled auto-merge (squash) August 7, 2025 09:29
@jgarciao jgarciao merged commit 50cd309 into opendatahub-io:main Aug 7, 2025
8 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 7, 2025

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants