Skip to content
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

feat: Added qdrant support for BaseEngine and added MediaWiki RAG! #60

Merged
merged 11 commits into from
May 20, 2024

Conversation

amindadgar
Copy link
Member

@amindadgar amindadgar commented May 16, 2024

Summary by CodeRabbit

  • New Features

    • Introduced MediaWikiQueryEngine for querying MediaWiki sources.
    • Added configuration for qdrant service with health check in test environment.
  • Bug Fixes

    • Updated retriever implementations to improve compatibility and performance.
  • Tests

    • Added unit tests for MediaWikiQueryEngine.
    • Updated tests to use VectorIndexRetriever.
  • Dependencies

    • Upgraded tc-hivemind-backend to version 1.2.0.

Copy link
Contributor

coderabbitai bot commented May 16, 2024

Warning

Rate Limit Exceeded

@amindadgar has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 1 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between b1f15f4 and 62e3a22.

Walkthrough

This update enhances the project by incorporating QDrant for vector storage and retrieval, upgrading the tc-hivemind-backend to version 1.2.0, and introducing a new MediaWikiQueryEngine for querying MediaWiki sources. It also includes the necessary adjustments in test cases to align with the new retriever and vector access implementations.

Changes

Files/Groups Change Summaries
docker-compose.test.yml Added environment variables for QDrant, introduced qdrant-healthcheck service, and configured the qdrant service.
requirements.txt Updated tc-hivemind-backend from version 1.1.5 to 1.2.0.
utils/query_engine/base_engine.py Replaced specific retrievers and vector access modules with new implementations (VectorIndexRetriever and QDrantVectorAccess).
utils/query_engine/media_wiki.py Introduced MediaWikiQueryEngine class for querying MediaWiki sources.
utils/query_engine/__init__.py Added import statement for MediaWikiQueryEngine.
subquery.py Updated parameter naming conventions and implemented functionality for MediaWiki querying.
tests/unit/test_mediawiki_query_engine.py Added test cases for MediaWikiQueryEngine.
tests/unit/test_gdrive_query_engine.py,
..._github_query_engine.py,
..._notion_query_engine.py
Updated tests to use VectorIndexRetriever instead of CustomVectorStoreRetriever.

In code's embrace, we find our way,
With QDrant's help, we save the day.
MediaWiki queries now take flight,
As engines hum through day and night.
Tests refined, our path is clear,
To build and learn, with endless cheer. 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 219c091 and f32a46f.
Files selected for processing (3)
  • docker-compose.test.yml (3 hunks)
  • requirements.txt (1 hunks)
  • utils/query_engine/base_engine.py (3 hunks)
Files skipped from review due to trivial changes (1)
  • requirements.txt
Additional comments not posted (7)
utils/query_engine/base_engine.py (4)

3-5: Imports look good and are used correctly in the code.

Also applies to: 7-7


27-27: The change from self.dbname to self.collection_name is consistent and correctly implemented.


30-37: The changes in the prepare method to use vector_store_index and VectorIndexRetriever are consistent and correctly implemented.


58-66: The changes in the _setup_vector_store_index method to use collection_name and QDrantVectorAccess are consistent and correctly implemented.

docker-compose.test.yml (3)

37-39: The addition of environment variables QDRANT_HOST, QDRANT_PORT, and QDRANT_API_KEY is correctly implemented and necessary for the new functionality.


49-50: The addition of qdrant-healthcheck to the depends_on section is correctly implemented and necessary for the new functionality.


95-116: The new services for qdrant and qdrant-healthcheck are correctly configured and necessary for the new functionality.

@amindadgar amindadgar requested review from cyri113 and TjitsevdM May 16, 2024 12:47
@amindadgar amindadgar changed the title feat: Added qdrant support for BaseEngine! feat: Added qdrant support for BaseEngine and added MediaWiki RAG! May 16, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f32a46f and 41093fb.
Files selected for processing (4)
  • subquery.py (4 hunks)
  • tests/unit/test_mediawiki_query_engine.py (1 hunks)
  • utils/query_engine/init.py (1 hunks)
  • utils/query_engine/media_wiki.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • utils/query_engine/init.py
Additional comments not posted (5)
utils/query_engine/media_wiki.py (1)

1-7: The __init__ method looks good and follows standard practices.

tests/unit/test_mediawiki_query_engine.py (2)

8-10: The setUp method looks good and follows standard practices.


12-15: Verify the usage of CustomVectorStoreRetriever.

The test uses CustomVectorStoreRetriever, but the changes in base_engine.py suggest a switch to VectorIndexRetriever. Ensure the test is consistent with the updated implementation.

subquery.py (2)

29-29: The parameters look good and follow standard practices.


Line range hint 162-194: The query execution looks good and follows standard practices.

Comment on lines +147 to +160
if mediaWiki:
mediawiki_query_engine = MediaWikiQueryEngine(
community_id=community_id
).prepare()
tool_metadata = ToolMetadata(
name="WikiPedia",
description="Hosts articles about any information on internet",
)
query_engine_tools.append(
QueryEngineTool(
query_engine=mediawiki_query_engine,
metadata=tool_metadata,
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the typo in the tool metadata name.

- name="WikiPedia",
+ name="MediaWiki",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if mediaWiki:
mediawiki_query_engine = MediaWikiQueryEngine(
community_id=community_id
).prepare()
tool_metadata = ToolMetadata(
name="WikiPedia",
description="Hosts articles about any information on internet",
)
query_engine_tools.append(
QueryEngineTool(
query_engine=mediawiki_query_engine,
metadata=tool_metadata,
)
)
if mediaWiki:
mediawiki_query_engine = MediaWikiQueryEngine(
community_id=community_id
).prepare()
tool_metadata = ToolMetadata(
name="MediaWiki",
description="Hosts articles about any information on internet",
)
query_engine_tools.append(
QueryEngineTool(
query_engine=mediawiki_query_engine,
metadata=tool_metadata,
)
)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 41093fb and 9a9247d.
Files selected for processing (1)
  • docker-compose.test.yml (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • docker-compose.test.yml

We were using the default `VectorIndexRetriever` for the new pipelines and it was wrong to assert those with CustomVectorStoreRetriever.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9a9247d and b1f15f4.
Files selected for processing (4)
  • tests/unit/test_gdrive_query_engine.py (2 hunks)
  • tests/unit/test_github_query_engine.py (2 hunks)
  • tests/unit/test_mediawiki_query_engine.py (1 hunks)
  • tests/unit/test_notion_query_engine.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • tests/unit/test_mediawiki_query_engine.py
Additional comments not posted (6)
tests/unit/test_gdrive_query_engine.py (2)

3-3: Updated import statement aligns with the new VectorIndexRetriever usage.


15-15: Updated assertion correctly checks for the instance of VectorIndexRetriever.

tests/unit/test_github_query_engine.py (2)

3-3: Updated import statement aligns with the new VectorIndexRetriever usage.


15-15: Updated assertion correctly checks for the instance of VectorIndexRetriever.

tests/unit/test_notion_query_engine.py (2)

3-3: Updated import statement aligns with the new VectorIndexRetriever usage.


15-15: Updated assertion correctly checks for the instance of VectorIndexRetriever.

getting it back from main branch but just a couple of renames
qdrant engine had different property from pg engine we had earlier!
This was linked to issues May 20, 2024
@cyri113 cyri113 merged commit aa78e16 into main May 20, 2024
16 checks passed
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.

feat: MediaWiki RAG Update: Vector database from pgvector to qdrant
4 participants