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

Adding documentation for Pgvector integration #5505

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

prernadh
Copy link
Contributor

@prernadh prernadh commented Feb 20, 2025

What changes are proposed in this pull request?

Adds in documentation for Pgvector integration

How is this patch tested? If it is not, please explain why.

Built docs locally to test

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

Pgvector integration added into fiftyone-brain

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • Documentation
    • Introduced a new backend option for similarity-based indexing that leverages a vector search extension.
    • Added a comprehensive guide covering setup, configuration, usage tips, and advanced scenarios for the new integration.
    • Enhanced integration details with a dedicated tutorial card and an updated visual link for a supported database system.

Copy link
Contributor

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request expands the FiftyOne Brain documentation by introducing a new pgvector backend. The documentation now includes details on configuring and using the Pgvector integration for similarity indexing. Additionally, new integration elements for Postgres have been added, including a custom image link, a tutorial card, and a comprehensive guide covering setup, usage, and management of Pgvector-based similarity searches.

Changes

File(s) Change Summary
docs/source/brain.rst Added pgvector backend to the Similarity backends and Brain config sections; introduced the new PgvectorSimilarityConfig class.
docs/source/index.rst, docs/source/integrations/index.rst Added a custom image link for Postgres and a new tutorial card with a toctree entry for the Pgvector/Postgres integration.
docs/source/integrations/pgvector.rst Created a new documentation file detailing the Pgvector integration including setup instructions, configuration parameters, usage examples, and brain run management.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant "FiftyOne Brain"
    participant "Pgvector Config"
    participant "Postgres (Pgvector)"
    
    User->>FiftyOne Brain: Request similarity search
    FiftyOne Brain->>Pgvector Config: Retrieve pgvector configuration
    Pgvector Config->>Postgres (Pgvector): Execute vector search query
    Postgres (Pgvector)->>Pgvector Config: Return similarity results
    Pgvector Config->>FiftyOne Brain: Forward results
    FiftyOne Brain->>User: Deliver search outcome
Loading

Possibly related PRs

  • Adding docs for Mosaic integration #5469: Introduced the Mosaic backend and configuration, which parallels the additions made for the pgvector backend in terms of extending similarity index capabilities.

Suggested labels

documentation

Suggested reviewers

  • brimoor
  • manushreegangwar

Poem

I'm a little rabbit, hopping on the docs trail,
Finding new paths with pgvector to unveil.
My whiskers twitch as I explore each config and line,
In a garden of integrations so splendidly fine.
With every gentle hop, new ideas come to play,
Bringing freshness to our code in a whimsical way.
🥕 Hop on, friends—documentation leads the way!


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>, please review it.
    • 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 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 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 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. (Beta)
  • @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.

@prernadh prernadh requested a review from thesteve0 February 20, 2025 20:27
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

🧹 Nitpick comments (3)
docs/source/integrations/index.rst (1)

228-228: Naming Consistency in Toctree Entry.
The toctree lists the new entry as “Postgres” while the tutorial card header is “Pgvector.” Consider aligning the naming (for example, using “Pgvector”) to avoid any potential confusion.

docs/source/index.rst (1)

129-133: Review of the Custom Image Link for Postgres Integration.
The new customimagelink directive is well formatted. However, note that its image title is “Postgres,” which may be at odds with the “Pgvector” branding used in other parts of the documentation. Double-check if this is intentional or if renaming to “Pgvector” would improve overall clarity.

docs/source/brain.rst (1)

2129-2132: Potential Inconsistency in Naming for the New Backend Configuration.
The brain configuration section now includes an entry labeled “postgres” with a configuration class of fiftyone.brain.internal.core.postgres.PostgresSimilarityConfig, whereas the documentation elsewhere refers to the feature as “pgvector.” Consider aligning these names—perhaps by using “pgvector” consistently—so that users are not confused by two different names for the same integration.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 931fee1 and d0a12a4.

⛔ Files ignored due to path filters (1)
  • docs/source/_static/images/integrations/postgres.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (4)
  • docs/source/brain.rst (3 hunks)
  • docs/source/index.rst (1 hunks)
  • docs/source/integrations/index.rst (2 hunks)
  • docs/source/integrations/pgvector.rst (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (16)
docs/source/integrations/index.rst (1)

128-134: New Tutorial Card for Pgvector Integration Added.
The new card follows the established format with clear attributes (header, description, link, image, tags). Verify that the image (using a Postgres icon) and the description fully capture the pgvector extension’s purpose.

docs/source/integrations/pgvector.rst (13)

1-13: Clear Introduction for Pgvector Integration.
The introduction effectively introduces the Pgvector extension by linking to its repository and summarizing its relevance. The “Pgvector Vector Search Integration” title and the following description set a solid context.


14-28: API Overview and Visual Aids are Well Presented.
The explanation of how FiftyOne supports Pgvector—including the note about natural language search—and the inclusion of a centered image are executed clearly. This will help users quickly grasp the new capabilities.


29-37: Informative Basic Recipe Section.
The “Basic recipe” section lays out the step-by-step workflow in an accessible list format. This clear structure should make it easy for users to follow the process from starting a PostgreSQL server to querying the data.


54-64: Prerequisites and Installation Details Are Clear.
The note emphasizing the prerequisites—such as having a PostgreSQL instance with pgvector and installing the psycopg2 module—is well supported by the shell code block. This aids in reducing potential setup errors.


74-94: Comprehensive Code Example for Creating and Querying a Similarity Index.
The provided code example clearly demonstrates how to load a dataset, compute embeddings, and query results using the Pgvector backend. The stepwise commentary on each action is very helpful for users.


120-128: Setup Section Provides Clear Environment Preparation Guidance.
The instructions for installing via Docker and the psycopg2 client are detailed and easy to follow. This section ensures that users will have the necessary components to use the Pgvector backend successfully.


128-165: Detailed Configuration and Usage Instructions.
The documentation effectively explains how to invoke the Pgvector backend by setting the backend parameter and how to permanently configure it via environment variables or the brain configuration file.


166-194: Robust Explanation of Authentication Options.
Multiple strategies for supplying PostgreSQL credentials (environment variables, brain config, and method arguments) are presented with clear examples. This flexibility is beneficial for various user setups.


241-283: Informative Pgvector Config Parameters Section.
Listing the query customization parameters (such as metric, work_mem, hnsw_m, etc.) with an accompanying JSON snippet enhances user understanding on how to fine-tune the backend.


305-377: Comprehensive Guidance for Managing Brain Runs.
The section detailing methods for listing, retrieving, renaming, and deleting brain runs (and cleaning up the external Pgvector index) is very thorough. The clear examples should help users manage their similarity indexes effectively.


378-447: Practical Use Cases Shown in the Examples Section.
The examples illustrate multiple approaches to creating similarity indexes—whether computing embeddings on the fly, using precomputed embeddings, or working with patch similarity. The variations discussed will be useful for both beginner and advanced users.


448-487: Valuable Advanced Usage Scenarios.
The advanced examples demonstrating connectivity to existing indexes, updating embeddings, and retrieving index information are clear and add depth to the documentation. They provide excellent value for power users looking to customize their implementations.


488-687: Overall, Pgvector Documentation is Thorough and User-Friendly.
This new documentation file covers all aspects—from setup and configuration to advanced usage—with clear, detailed guidance. It will serve as an excellent resource for users integrating Pgvector with FiftyOne.

docs/source/brain.rst (2)

440-456: New Pgvector Backend Entry Added to Similarity Backends.
The new entry for the pgvector backend is integrated neatly into the list of supported similarity backends. Confirm that the reference label pgvector-integration correctly navigates to the Pgvector documentation.


1-2218: Overall Integration in the Brain Documentation is Well Executed.
The comprehensive update to include the Pgvector backend enriches the similarity indexing capabilities. Ensure that the naming across the board (pgvector vs. postgres) is consistent to maintain clarity for users.

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.

1 participant