-
Notifications
You must be signed in to change notification settings - Fork 0
Multimodal embedder #1
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
base: main
Are you sure you want to change the base?
Conversation
feat: Add support for compacting database indexes.
…ersion Update version for the next release (v0.38.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces multimodal embedder support to the Meilisearch Python SDK, enabling AI-powered search with multiple data types (text, images, etc.). The changes include new fragment-based embedding configuration, a dedicated search method for media queries, experimental features API, and an index compaction feature.
- Added
indexing_fragmentsandsearch_fragmentsfields toRestEmbedderfor multimodal document processing - Introduced
search_with_media()method for performing searches using media parameters instead of text queries - Added experimental features API with
get_experimental_features(),update_experimental_features(),enable_multimodal(), anddisable_multimodal()methods - Implemented
compact()method for triggering index compaction - Version bumped from 0.37.1 to 0.38.0
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
tests/settings/test_settings_fragments.py |
Comprehensive test suite for fragment configuration in embedders, validating that indexingFragments and searchFragments can be configured without triggering AI calls |
tests/settings/test_settings_embedders.py |
Updated timeout values for HuggingFace and composite embedder tests to accommodate longer model download times (60 seconds) |
tests/index/test_index_search_media.py |
New test suite for the search_with_media method using mocked HTTP responses to validate parameter handling |
tests/index/test_index.py |
Added test for the new compact() method that verifies document count preservation and indexing state |
tests/client/test_client_experimental_features.py |
Complete test coverage for experimental features API including get, update, enable/disable, and idempotency tests |
tests/conftest.py |
Added enable_multimodal fixture, mock_embedder_server fixture with HTTP server, and index_with_rest_embedder fixture for testing |
meilisearch/models/embedders.py |
Extended RestEmbedder model with indexing_fragments and search_fragments fields for multimodal support |
meilisearch/index.py |
Added search_with_media() method for media-based searches and compact() method for index compaction |
meilisearch/config.py |
Added experimental_features path to Paths configuration |
meilisearch/client.py |
Implemented experimental features management methods for enabling/disabling multimodal functionality |
meilisearch/version.py |
Bumped version to 0.38.0 to reflect new features |
.code-samples.meilisearch.yaml |
Added compact_index_1 code sample for documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| update_an_index_1: |- | ||
| client.index('movies').update(primary_key='id') | ||
| compact_index_1: |- | ||
| client.index('movies').compact() |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation of the code sample is inconsistent with other entries in this YAML file. The code should start with 2 spaces (like other entries) but it starts with 4 spaces. This should be:
compact_index_1: |-
client.index('movies').compact()instead of:
compact_index_1: |-
client.index('movies').compact()| client.index('movies').compact() | |
| client.index('movies').compact() |
|
|
||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are extra blank lines at the end of this file. The file should end with a single newline (line 56 is already blank), so lines 57-58 should be removed.
|
|
||
| assert isinstance(response, dict) | ||
| assert "hits" in response | ||
| # This validates that SDK correctly sends media without requiring q parameter |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on this line is incomplete. It starts with "# This validates that SDK correctly sends media without requiring q parameter" but appears to be cut off. Consider completing the comment or removing it if no additional explanation is needed.
| # This validates that SDK correctly sends media without requiring q parameter | |
| # This validates that the SDK correctly sends media without requiring the 'q' parameter. |
| except Exception: | ||
| # If it fails, that's also acceptable as the feature might require enabling | ||
| pass |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bare except Exception: clause at line 192 is too broad and could mask unexpected errors. Consider catching a specific exception type (e.g., MeilisearchApiError) or at least logging/asserting something about the exception to ensure the test is failing for the expected reason. The current implementation makes it impossible to distinguish between different failure modes.
| except Exception: | |
| # If it fails, that's also acceptable as the feature might require enabling | |
| pass | |
| except Exception as e: | |
| # If it fails, that's also acceptable as the feature might require enabling | |
| pytest.fail(f"Fragments configuration failed with exception: {e}") |
| Returns | ||
| ------- | ||
| task_info: TaskInfo | ||
| Contains information to track the progress of the compaction task. |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring for the compact method is missing a "Raises" section. Similar methods in this file (e.g., search, update_localized_attributes) document that they can raise MeilisearchApiError. For consistency and completeness, this method should also document potential exceptions:
Raises
------
MeilisearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors| Contains information to track the progress of the compaction task. | |
| Contains information to track the progress of the compaction task. | |
| Raises | |
| ------ | |
| MeilisearchApiError | |
| An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors |
| import pytest | ||
|
|
||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'pytest' is not used.
| import pytest |
| """ | ||
| from http.server import HTTPServer, BaseHTTPRequestHandler | ||
| import threading | ||
| import json |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import of module json is redundant, as it was previously imported on line 2.
| import json |
We want to update this SDK to allow using indexing and search fragments to enable multi-modal search. This feature is introduced in Meilisearch 1.16.
For more information, see the embedder settings API.
NB: As of Meilisearch 1.16, this feature is experimental. This might require updating the API related to experimental features.
Tasks
Update settings methods to allow configuring indexingFraments and searchFragments
Add new tests cases
Add code sample in .code-samples.meilisearch.yaml under the search_parameter_reference_media_1 key. The example should be similar to this CURL example