Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,25 @@ get_batch_1: |-
client.get_batch(BATCH_UID)
get_similar_post_1: |-
client.index("INDEX_NAME").get_similar_documents({"id": "TARGET_DOCUMENT_ID", "embedder": "default"})
search_parameter_reference_media_1: |-
client.index('movies_fragments').search(
"a futuristic space movie",
{
"media": {
"textAndPoster": {
"text": "a futuristic space movie",
"image": {
"mime": "image/jpeg",
"data": "BASE64_ENCODED_IMAGE_DATA"
}
}
},
"hybrid": {
"embedder": "multimodal",
"semanticRatio": 1.0
},
}
)
webhooks_get_1: |-
client.get_webhooks()
webhooks_get_single_1: |-
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
# This value contains a list of modules to be mocked up.
autodoc_mock_imports = ["camel_converter"]

html_title = 'Meilisearch Python | Documentation'
html_title = "Meilisearch Python | Documentation"

# Add Fathom analytics script
html_js_files = [
("https://cdn.usefathom.com/script.js", { "data-site": "QNBPJXIV", "defer": "defer" })
("https://cdn.usefathom.com/script.js", {"data-site": "QNBPJXIV", "defer": "defer"})
]
38 changes: 38 additions & 0 deletions meilisearch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,3 +1110,41 @@ def _valid_uuid(uuid: str) -> bool:
)
match = uuid4hex.match(uuid)
return bool(match)

def get_experimental_features(self) -> Dict[str, Any]:
"""Retrieve the current settings for all experimental features.

Returns
-------
features:
A dictionary mapping feature names to their enabled/disabled state.
For example: {"multimodal": True, "vectorStore": False}

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
"""
return self.http.get(self.config.paths.experimental_features)

def update_experimental_features(self, features: Dict[str, bool]) -> Dict[str, Any]:
"""Update one or more experimental features.

Parameters
----------
features:
A dictionary mapping feature names to booleans.
For example, {"multimodal": True} to enable multimodal,
or {"multimodal": True, "vectorStore": False} to update multiple features.

Returns
-------
features:
The updated experimental features settings as a dictionary.

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
"""
return self.http.patch(self.config.paths.experimental_features, body=features)
1 change: 1 addition & 0 deletions meilisearch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Paths:
localized_attributes = "localized-attributes"
edit = "edit"
network = "network"
experimental_features = "experimental-features"
webhooks = "webhooks"

def __init__(
Expand Down
8 changes: 8 additions & 0 deletions meilisearch/models/embedders.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ class RestEmbedder(CamelBase):
Template defining the data Meilisearch sends to the embedder
document_template_max_bytes: Optional[int]
Maximum allowed size of rendered document template (defaults to 400)
indexing_fragments: Optional[Dict[str, Dict[str, Any]]]
Defines how to fragment documents for indexing (multi-modal search).
Fragments can contain complex nested structures (e.g., lists of objects).
search_fragments: Optional[Dict[str, Dict[str, Any]]]
Defines how to fragment search queries (multi-modal search).
Fragments can contain complex nested structures (e.g., lists of objects).
request: Dict[str, Any]
A JSON value representing the request Meilisearch makes to the remote embedder
response: Dict[str, Any]
Expand All @@ -185,6 +191,8 @@ class RestEmbedder(CamelBase):
dimensions: Optional[int] = None
document_template: Optional[str] = None
document_template_max_bytes: Optional[int] = None
indexing_fragments: Optional[Dict[str, Dict[str, Any]]] = None
search_fragments: Optional[Dict[str, Dict[str, Any]]] = None
request: Dict[str, Any]
response: Dict[str, Any]
headers: Optional[Dict[str, str]] = None
Expand Down
22 changes: 22 additions & 0 deletions tests/client/test_experimental_features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for experimental features API."""


def test_get_experimental_features(client):
"""Test getting experimental features."""
response = client.get_experimental_features()
assert isinstance(response, dict)
# Check that at least one known experimental feature is present
assert "multimodal" in response or "vectorStoreSetting" in response


def test_update_experimental_features(client):
"""Test updating experimental features."""
# Enable multimodal
response = client.update_experimental_features({"multimodal": True})
assert isinstance(response, dict)
assert response.get("multimodal") is True

# Disable multimodal
response = client.update_experimental_features({"multimodal": False})
assert isinstance(response, dict)
assert response.get("multimodal") is False
Loading
Loading