Skip to content

Add code samples instead of raw examples with curl only#3473

Merged
curquiza merged 8 commits into
mainfrom
create-code-samples
Feb 24, 2026
Merged

Add code samples instead of raw examples with curl only#3473
curquiza merged 8 commits into
mainfrom
create-code-samples

Conversation

@curquiza

@curquiza curquiza commented Feb 24, 2026

Copy link
Copy Markdown
Member

Create code samples to be able to display examples with different SDKs examples

Summary by CodeRabbit

  • Documentation
    • Expanded docs with many new code samples for AI-powered search: embeddings, user-provided embeddings, vector & hybrid queries, multimodal (image) search, chat completions, personalization, and federated multi-search
    • Added examples for experimental features (chat completions, containsFilter, multimodal) and REST embedder configuration
    • Replaced numerous inline curl snippets with reusable code-sample components and normalized HTTP header casing
    • Removed an outdated security cURL example from docs

@curquiza curquiza requested a review from a team as a code owner February 24, 2026 18:37
@curquiza curquiza added tooling and maintenance Maintenance (CI, tooling...) fix/improvement labels Feb 24, 2026
@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaced many inline curl examples with reusable MDX code-sample components across docs, added numerous new MDX/YAML code samples for embedders, embeddings, multimodal, chat, federated search and experimental flags, and normalized HTTP header casing in several snippets.

Changes

Cohort / File(s) Summary
YAML Code Samples
.code-samples.meilisearch.yaml
Large additions (+328/-9): many new code-sample entries for embedders, AI search, multimodal, chat, federated search, experimental features; removed one basic security listing sample; normalized header flags/casing (-x-X, -h-H, content-typeContent-Type).
AI-powered Search docs
learn/ai_powered_search/configure_rest_embedder.mdx, learn/ai_powered_search/getting_started_with_ai_search.mdx, learn/ai_powered_search/image_search_with_multimodal_embeddings.mdx, learn/ai_powered_search/image_search_with_user_provided_embeddings.mdx, learn/ai_powered_search/search_with_user_provided_embeddings.mdx
Replaced inline curl/code blocks with imported <CodeSamples... /> MDX components for embedder configuration, embedding workflows, vector and multimodal searches; added snippet imports.
Chat docs
learn/chat/getting_started_with_chat.mdx, learn/chat/chat_tooling_reference.mdx
Replaced experimental/chat-related curl snippets with MDX code-sample components; added imports and new chat-related snippet usages (completions, keys, settings, index chat settings).
Security & Tenant token docs
learn/security/basic_security.mdx, learn/security/generate_tenant_token_scratch.mdx, learn/security/generate_tenant_token_sdk.mdx, learn/security/generate_tenant_token_third_party.mdx
Swapped previously used listing snippet for CodeSamplesAuthorizationHeader1, replaced inline API-key curl examples with the authorization-header snippet, and updated wording referencing the API keys endpoint.
Multi-search & Personalization
learn/multi_search/performing_federated_search.mdx, learn/personalization/making_personalized_search_queries.mdx
Replaced inline multi-search and personalization curl examples with <CodeSamples... /> components demonstrating federation, weighting, and personalization context.
Async, Indexing & Migration
learn/async/task_webhook.mdx, learn/indexing/optimize_indexing_performance.mdx, learn/update_and_migration/migrating_cloud.mdx, learn/update_and_migration/updating.mdx
Replaced document add/replace, facet-search, dump/snapshot code blocks with corresponding <CodeSamples... /> components; updated example index names (books→movies) in task webhook.
Filtering & Engine docs
learn/filtering_and_sorting/filter_expression_reference.mdx, learn/engine/datatypes.mdx
Inserted CodeSamplesUpdateExperimentalFeaturesContains1 component for containsFilter example; escaped single quotes in a JSON filter example.
Generated MDX snippets (new)
snippets/generated-code-samples/code_samples_*.mdx (many files, e.g. code_samples_ai_search_getting_started_*.mdx, code_samples_image_search_multimodal_*.mdx, code_samples_chat_*.mdx, code_samples_federated_search_*.mdx, code_samples_user_provided_embeddings_*.mdx, code_samples_configure_rest_embedder_1.mdx, etc.)
Added numerous new snippet files containing curl examples for: embedders (REST, providers), document embedding, vector searches/filters, user-provided embeddings, multimodal image/text search, chat completions/settings, experimental feature toggles, federated multi-search, personalization, and snapshots/dumps. Also applied minor header-casing fixes and removed one inline curl sample in a security snippet.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped through snippets, swapped curl for shows,
Components nest where one-liners rose,
Embeddings, images, chat,—all in a row,
Docs stitched tidy so readers may go,
A rabbit’s small cheer for samples that grow. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The pull request title accurately summarizes the main objective: replacing raw curl examples with reusable code sample components throughout the documentation to enable SDK-agnostic examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch create-code-samples

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
snippets/generated-code-samples/code_samples_date_guide_index_1.mdx (2)

31-31: ⚠️ Potential issue | 🟡 Minor

Invalid Java import syntax

import com.meilisearch.sdk; is not valid Java — you must import a specific class or use a wildcard.

🐛 Proposed fix
-import com.meilisearch.sdk;
+import com.meilisearch.sdk.*;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` at line
31, The import statement `import com.meilisearch.sdk;` is invalid Java; replace
it with a proper class or wildcard import such as `import
com.meilisearch.sdk.*;` or import the specific class you need (e.g., `import
com.meilisearch.sdk.Client;`) so the compiler can resolve types used in this
file.

62-64: ⚠️ Potential issue | 🟡 Minor

C# snippet deserializes into Movie for a games collection

JsonSerializer.Deserialize<IEnumerable<Movie>> and AddDocumentsAsync<Movie> appear to be copy-pasted from a movies example. The type should match the games domain used throughout this snippet.

🐛 Proposed fix
-var games = JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options);
-var index = client.Index("games");
-await index.AddDocumentsAsync<Movie>(games);
+var games = JsonSerializer.Deserialize<IEnumerable<Game>>(jsonString, options);
+var index = client.Index("games");
+await index.AddDocumentsAsync<Game>(games);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` around
lines 62 - 64, The snippet deserializes and indexes the wrong type: replace
usages of the Movie type with the correct games domain type (e.g., Game) so the
deserialization and indexing match; update
JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options) to
JsonSerializer.Deserialize<IEnumerable<Game>>(...) and change
AddDocumentsAsync<Movie>(games) to AddDocumentsAsync<Game>(games) (locate the
calls to JsonSerializer.Deserialize, the Movie symbol, and AddDocumentsAsync on
the index obtained via client.Index("games") and swap Movie -> Game).
🧹 Nitpick comments (4)
snippets/generated-code-samples/code_samples_chat_completions_1.mdx (1)

16-31: Consider aligning tool definitions with the official tooling reference.

The official Meilisearch chat tooling reference shows _meiliSearchSources with a parameters schema (including call_id and documents properties). The docs instruct users to "include these tools in your request's tools array to enable enhanced functionality," so the server accepts the simplified form shown here. However, omitting parameters from both tools while the official reference includes them for _meiliSearchSources may cause confusion for readers cross-referencing the docs.

If the intent is to keep the sample minimal, that's fine. Otherwise, consider adding the parameters block to _meiliSearchSources to match the reference docs.

✏️ Proposed update to align with the official tooling reference
       {
         "type": "function",
         "function": {
           "name": "_meiliSearchSources",
-          "description": "Provides sources and references for the information"
+          "description": "Provides sources and references for the information",
+          "parameters": {
+            "type": "object",
+            "properties": {
+              "call_id": {
+                "type": "string",
+                "description": "The call ID to track the original search associated to those sources"
+              },
+              "documents": {
+                "type": "object",
+                "description": "The documents associated with the search (call_id)"
+              }
+            }
+          }
         }
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_chat_completions_1.mdx` around
lines 16 - 31, The sample's tools array omits the parameters schema for
_meiliSearchSources, which differs from the Meilisearch chat tooling reference;
update the tool definition for "_meiliSearchSources" (in the "tools" array) to
include a "parameters" object matching the reference (e.g., properties like
call_id and documents with appropriate types and required fields) so the example
aligns with the official docs while keeping _meiliSearchProgress minimal if
desired.
snippets/generated-code-samples/code_samples_user_provided_embeddings_settings_1.mdx (1)

3-14: Prefer an index placeholder for reuse across docs.

Hard-coding movies makes the snippet less portable.

♻️ Suggested tweak
-  -X PATCH 'MEILISEARCH_URL/indexes/movies/settings' \
+  -X PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings' \
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@snippets/generated-code-samples/code_samples_user_provided_embeddings_settings_1.mdx`
around lines 3 - 14, Replace the hard-coded index name "movies" in the curl
PATCH URL with a reusable placeholder (e.g., {INDEX_NAME} or INDEX_NAME) so the
snippet is portable; update the request URL
'MEILISEARCH_URL/indexes/movies/settings' to use that placeholder and leave
EMBEDDER_NAME and MODEL_DIMENSIONS as-is to indicate variables that users must
substitute. Ensure the example still shows the embedders block with "source":
"userProvided" and "dimensions": MODEL_DIMENSIONS so readers understand which
parts to replace.
snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx (1)

3-10: Use a generic index placeholder and a concrete vector example for quick copy/paste.

This keeps the snippet reusable across docs and immediately runnable.

♻️ Suggested tweak
-  -X POST 'MEILISEARCH_URL/indexes/products/search' \
+  -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \
   -H 'Content-Type: application/json' \
   --data-binary '{
-    "vector": VECTORIZED_QUERY,
+    "vector": [0.12, 0.98],
     "hybrid": { "embedder": "EMBEDDER_NAME" }
   }'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx`
around lines 3 - 10, Replace the hard-coded "products" index and abstract
VECTORIZED_QUERY with a generic index placeholder and a concrete numeric vector
so the snippet is copy/paste runnable; specifically, change the URL fragment
that currently contains "indexes/products/search" to use a placeholder like
"indexes/INDEX_NAME/search", and replace the "vector": VECTORIZED_QUERY and
"hybrid": { "embedder": "EMBEDDER_NAME" } values with a concrete example numeric
array (e.g., [0.01, 0.23, ...]) and keep EMBEDDER_NAME as a clear placeholder so
users can run the curl immediately while still substituting their embedder.
.code-samples.meilisearch.yaml (1)

1736-1745: chat_get_settings_1 / chat_patch_settings_1 use double quotes for -H args; every other sample uses single quotes.

Lines 1739 and 1743–1744 use "Authorization: Bearer ..." / "Content-Type: ..." with double quotes, while the entire rest of the file uses single quotes for -H arguments. Both forms work, but the inconsistency is noticeable.

♻️ Proposed normalisation
 chat_get_settings_1: |-
   curl \
     -X GET 'MEILISEARCH_URL/chats/WORKSPACE_NAME/settings' \
-    -H "Authorization: Bearer MEILISEARCH_KEY"
+    -H 'Authorization: Bearer MEILISEARCH_KEY'
 chat_patch_settings_1: |-
   curl \
     -X PATCH 'MEILISEARCH_URL/chats/WORKSPACE_NAME/settings' \
-    -H "Authorization: Bearer MEILISEARCH_KEY" \
-    -H "Content-Type: application/json" \
+    -H 'Authorization: Bearer MEILISEARCH_KEY' \
+    -H 'Content-Type: application/json' \
     --data-binary '{ "apiKey": "your-valid-api-key" }'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.code-samples.meilisearch.yaml around lines 1736 - 1745, The samples
chat_get_settings_1 and chat_patch_settings_1 use double quotes for the -H
header args while the rest of the file uses single quotes; update the header
flags in these two snippets to use single quotes (e.g., change "Authorization:
Bearer MEILISEARCH_KEY" and "Content-Type: application/json" to use single
quotes) so the header quoting is consistent across the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.code-samples.meilisearch.yaml:
- Around line 1838-1849: The PATCH curl sample for
ai_search_getting_started_embedders_1 contains an invalid attempt to embed
single quotes around {{doc.name}} using '' inside a single-quoted --data-binary
string; fix by using a proper bash escape for a single quote (replace '' with
'\''), or switch the payload to a here-doc or double-quoted string and escape
accordingly so the JSON field documentTemplate ends up containing literal quotes
around {{doc.name}}; update the curl command payload in
ai_search_getting_started_embedders_1 and the documentTemplate value to use the
chosen escaping method.
- Around line 1256-1260: The curl example under date_guide_index_1 uses the
proxy flag "-x POST" instead of the HTTP method flag "-X POST"; update the curl
invocation in the date_guide_index_1 block so the option is "-X POST"
(preserving the surrounding URL, headers, and --data-binary `@games.json`) to
ensure the command performs an HTTP POST rather than setting a proxy named
"POST".

In `@learn/chat/chat_tooling_reference.md`:
- Line 6: The file chat_tooling_reference.md contains an ES module import (e.g.,
"import CodeSamplesUpdateExperimentalFeaturesChat1 ...") which requires an .mdx
extension; rename chat_tooling_reference.md to chat_tooling_reference.mdx,
update any references to that filename elsewhere in the repo (links, imports, or
navigation) so they point to the new .mdx name, and ensure the import statement
remains unchanged inside the renamed file so Mintlify can process the component
import correctly.

In `@learn/security/generate_tenant_token_scratch.mdx`:
- Line 7: The file imports the wrong component (CodeSamplesAuthorizationHeader1)
but renders <CodeSamplesTenantTokenGuideGetKey1 />; update the import so the
component used in the JSX is actually imported — replace or add the import for
CodeSamplesTenantTokenGuideGetKey1 (the same component used in
generate_tenant_token_sdk.mdx) so the rendered
<CodeSamplesTenantTokenGuideGetKey1 /> has a matching import.

In `@snippets/generated-code-samples/code_samples_chat_completions_1.mdx`:
- Around line 16-31: Add the required "parameters" objects to both tool
definitions so they pass Meilisearch's strict schema validation: for the tool
named "_meiliSearchProgress" add a parameters schema requiring "call_id"
(string), "function_name" (string), and "function_parameters" (string); for the
tool named "_meiliSearchSources" add a parameters schema requiring "call_id"
(string) and "documents" (object). Ensure each parameters object declares the
required property names and their types and sets additionalProperties: false so
only those fields are allowed.

In `@snippets/generated-code-samples/code_samples_chat_patch_settings_1.mdx`:
- Around line 5-8: The Authorization header in the PATCH example uses a literal
placeholder "Authorization: Bearer MEILISEARCH_KEY" which triggers secret
scanners; update the example to reference an environment variable (e.g., use an
env placeholder like MEILISEARCH_API_KEY) and add an allowlist/no-scan inline
comment so CI scanners ignore it; specifically change the header in the curl
PATCH example and include a short allowlist comment (e.g., nosec/allowlist)
adjacent to the header to prevent false positives while keeping the env-var
pattern clear.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx`:
- Line 5: The curl example uses the proxy flag "-x" instead of the
request-method flag, so change the "-x POST
'MEILISEARCH_URL/indexes/games/documents' \\" occurrence to use "-X" (i.e.,
replace "-x POST" with "-X POST") so the HTTP method is set correctly when
calling the endpoint in the generated-code-samples snippet; locate the line
containing "-x POST 'MEILISEARCH_URL/indexes/games/documents' \\" and update the
flag accordingly.

In
`@snippets/generated-code-samples/code_samples_image_search_multimodal_settings_1.mdx`:
- Around line 3-7: The cURL example for the PATCH /indexes/INDEX_NAME/settings
request is missing the required Authorization header causing a 401; update the
snippet that issues the curl PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings'
to include the Authorization: Bearer MEILISEARCH_KEY header (matching the
companion code_samples_chat_index_settings_1.mdx) so the request authenticates
correctly.

In
`@snippets/generated-code-samples/code_samples_search_parameter_reference_retrieve_vectors_1.mdx`:
- Line 5: The PHP example in the MDX snippet uses invalid array syntax (uses ":"
instead of the PHP array key operator), so update the PHP associative arrays to
use "=>" for key/value pairs (e.g., replace 'key': 'value' with 'key' =>
'value') for all PHP arrays in the snippet (including the other occurrences
referenced), ensure commas and string quoting remain valid, and re-run the
snippet to verify it parses and runs as valid PHP.

---

Outside diff comments:
In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx`:
- Line 31: The import statement `import com.meilisearch.sdk;` is invalid Java;
replace it with a proper class or wildcard import such as `import
com.meilisearch.sdk.*;` or import the specific class you need (e.g., `import
com.meilisearch.sdk.Client;`) so the compiler can resolve types used in this
file.
- Around line 62-64: The snippet deserializes and indexes the wrong type:
replace usages of the Movie type with the correct games domain type (e.g., Game)
so the deserialization and indexing match; update
JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options) to
JsonSerializer.Deserialize<IEnumerable<Game>>(...) and change
AddDocumentsAsync<Movie>(games) to AddDocumentsAsync<Game>(games) (locate the
calls to JsonSerializer.Deserialize, the Movie symbol, and AddDocumentsAsync on
the index obtained via client.Index("games") and swap Movie -> Game).

---

Nitpick comments:
In @.code-samples.meilisearch.yaml:
- Around line 1736-1745: The samples chat_get_settings_1 and
chat_patch_settings_1 use double quotes for the -H header args while the rest of
the file uses single quotes; update the header flags in these two snippets to
use single quotes (e.g., change "Authorization: Bearer MEILISEARCH_KEY" and
"Content-Type: application/json" to use single quotes) so the header quoting is
consistent across the file.

In `@snippets/generated-code-samples/code_samples_chat_completions_1.mdx`:
- Around line 16-31: The sample's tools array omits the parameters schema for
_meiliSearchSources, which differs from the Meilisearch chat tooling reference;
update the tool definition for "_meiliSearchSources" (in the "tools" array) to
include a "parameters" object matching the reference (e.g., properties like
call_id and documents with appropriate types and required fields) so the example
aligns with the official docs while keeping _meiliSearchProgress minimal if
desired.

In
`@snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx`:
- Around line 3-10: Replace the hard-coded "products" index and abstract
VECTORIZED_QUERY with a generic index placeholder and a concrete numeric vector
so the snippet is copy/paste runnable; specifically, change the URL fragment
that currently contains "indexes/products/search" to use a placeholder like
"indexes/INDEX_NAME/search", and replace the "vector": VECTORIZED_QUERY and
"hybrid": { "embedder": "EMBEDDER_NAME" } values with a concrete example numeric
array (e.g., [0.01, 0.23, ...]) and keep EMBEDDER_NAME as a clear placeholder so
users can run the curl immediately while still substituting their embedder.

In
`@snippets/generated-code-samples/code_samples_user_provided_embeddings_settings_1.mdx`:
- Around line 3-14: Replace the hard-coded index name "movies" in the curl PATCH
URL with a reusable placeholder (e.g., {INDEX_NAME} or INDEX_NAME) so the
snippet is portable; update the request URL
'MEILISEARCH_URL/indexes/movies/settings' to use that placeholder and leave
EMBEDDER_NAME and MODEL_DIMENSIONS as-is to indicate variables that users must
substitute. Ensure the example still shows the embedders block with "source":
"userProvided" and "dimensions": MODEL_DIMENSIONS so readers understand which
parts to replace.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19228f9 and a526d28.

📒 Files selected for processing (48)
  • .code-samples.meilisearch.yaml
  • learn/ai_powered_search/configure_rest_embedder.mdx
  • learn/ai_powered_search/getting_started_with_ai_search.mdx
  • learn/ai_powered_search/image_search_with_multimodal_embeddings.mdx
  • learn/ai_powered_search/image_search_with_user_provided_embeddings.mdx
  • learn/ai_powered_search/search_with_user_provided_embeddings.mdx
  • learn/async/task_webhook.mdx
  • learn/chat/chat_tooling_reference.md
  • learn/chat/getting_started_with_chat.mdx
  • learn/engine/datatypes.mdx
  • learn/filtering_and_sorting/filter_expression_reference.mdx
  • learn/indexing/optimize_indexing_performance.mdx
  • learn/multi_search/performing_federated_search.mdx
  • learn/personalization/making_personalized_search_queries.mdx
  • learn/security/basic_security.mdx
  • learn/security/generate_tenant_token_scratch.mdx
  • learn/security/generate_tenant_token_sdk.mdx
  • learn/security/generate_tenant_token_third_party.mdx
  • learn/update_and_migration/migrating_cloud.mdx
  • learn/update_and_migration/updating.mdx
  • snippets/generated-code-samples/code_samples_ai_search_getting_started_embedders_1.mdx
  • snippets/generated-code-samples/code_samples_ai_search_getting_started_search_1.mdx
  • snippets/generated-code-samples/code_samples_ai_search_user_embeddings_documents_1.mdx
  • snippets/generated-code-samples/code_samples_ai_search_user_embeddings_search_vector_filter_1.mdx
  • snippets/generated-code-samples/code_samples_authorization_header_1.mdx
  • snippets/generated-code-samples/code_samples_basic_security_tutorial_listing_1.mdx
  • snippets/generated-code-samples/code_samples_chat_completions_1.mdx
  • snippets/generated-code-samples/code_samples_chat_create_key_1.mdx
  • snippets/generated-code-samples/code_samples_chat_get_settings_1.mdx
  • snippets/generated-code-samples/code_samples_chat_index_settings_1.mdx
  • snippets/generated-code-samples/code_samples_chat_patch_settings_1.mdx
  • snippets/generated-code-samples/code_samples_configure_rest_embedder_1.mdx
  • snippets/generated-code-samples/code_samples_date_guide_index_1.mdx
  • snippets/generated-code-samples/code_samples_federated_search_multi_search_1.mdx
  • snippets/generated-code-samples/code_samples_federated_search_multi_search_weight_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_multimodal_search_image_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_multimodal_search_text_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_multimodal_settings_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_q_1.mdx
  • snippets/generated-code-samples/code_samples_personalization_search_1.mdx
  • snippets/generated-code-samples/code_samples_search_parameter_guide_hybrid_1.mdx
  • snippets/generated-code-samples/code_samples_search_parameter_guide_vector_1.mdx
  • snippets/generated-code-samples/code_samples_search_parameter_reference_retrieve_vectors_1.mdx
  • snippets/generated-code-samples/code_samples_update_experimental_features_chat_1.mdx
  • snippets/generated-code-samples/code_samples_update_experimental_features_contains_1.mdx
  • snippets/generated-code-samples/code_samples_update_experimental_features_multimodal_1.mdx
  • snippets/generated-code-samples/code_samples_user_provided_embeddings_settings_1.mdx
💤 Files with no reviewable changes (2)
  • snippets/generated-code-samples/code_samples_authorization_header_1.mdx
  • snippets/generated-code-samples/code_samples_basic_security_tutorial_listing_1.mdx

Comment thread .code-samples.meilisearch.yaml
Comment thread .code-samples.meilisearch.yaml
Comment thread learn/chat/chat_tooling_reference.mdx
Comment thread learn/security/generate_tenant_token_scratch.mdx
Comment thread snippets/generated-code-samples/code_samples_chat_completions_1.mdx
Comment thread snippets/generated-code-samples/code_samples_date_guide_index_1.mdx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
learn/chat/chat_tooling_reference.mdx (1)

145-145: ⚠️ Potential issue | 🟡 Minor

Typo in role property description — role should be user.

The description reads "either \role` or `assistant`", but roleis the property *name*, not a valid value. Per line 60 of the same file, the valid values are"user"and"assistant"`.

✏️ Proposed fix
-              "description": "The role of the messages author, either `role` or `assistant`"
+              "description": "The role of the messages author, either `user` or `assistant`"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@learn/chat/chat_tooling_reference.mdx` at line 145, The description for the
message object's role currently says "either `role` or `assistant`" which
incorrectly uses the property name; update the description for the `role`
property (the string shown in the diff: "description": "The role of the messages
author, either `role` or `assistant`") to list the actual valid values "user"
and "assistant" (e.g., "The role of the message's author, either `user` or
`assistant`") so it matches the valid values referenced earlier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@learn/chat/chat_tooling_reference.mdx`:
- Line 145: The description for the message object's role currently says "either
`role` or `assistant`" which incorrectly uses the property name; update the
description for the `role` property (the string shown in the diff:
"description": "The role of the messages author, either `role` or `assistant`")
to list the actual valid values "user" and "assistant" (e.g., "The role of the
message's author, either `user` or `assistant`") so it matches the valid values
referenced earlier.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6cfcd5 and 9d737d8.

📒 Files selected for processing (2)
  • .code-samples.meilisearch.yaml
  • learn/chat/chat_tooling_reference.mdx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
snippets/generated-code-samples/code_samples_date_guide_index_1.mdx (3)

99-103: ⚠️ Potential issue | 🟡 Minor

Commented-out required imports make the Dart snippet non-functional as written.

File requires dart:io. If these are intentionally commented out as guidance hints, they should at minimum be uncommented so readers can copy-paste and run the snippet without modification.

🐛 Proposed fix
-//import 'dart:io';
-//import 'dart:convert';
+import 'dart:io';
+import 'dart:convert';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` around
lines 99 - 103, Uncomment the required Dart imports so the example runs as-is:
restore the dart:io and dart:convert imports at the top of the snippet so File
and JSON handling work (e.g., make sure the File(...) call and `json` variable
usage, and the `client.index('games').addDocumentsJson(json)` line, have the
necessary imports available). Ensure the snippet includes the two imports
instead of commented lines so readers can copy-paste and execute it directly.

62-64: ⚠️ Potential issue | 🟠 Major

Wrong type — Movie used in a games example (copy-paste error).

Both the deserialization and AddDocumentsAsync use Movie, but this snippet is for a games index. The Rust block in the same file uses Game as the document type, which is consistent with the context.

🐛 Proposed fix
-var games = JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options);
+var games = JsonSerializer.Deserialize<IEnumerable<Game>>(jsonString, options);
 var index = client.Index("games");
-await index.AddDocumentsAsync<Movie>(games);
+await index.AddDocumentsAsync<Game>(games);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` around
lines 62 - 64, The snippet incorrectly uses the Movie type for a games index:
update the deserialization and add-call to use Game instead of Movie by changing
JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options) to
JsonSerializer.Deserialize<IEnumerable<Game>>(jsonString, options) and
index.AddDocumentsAsync<Movie>(games) to index.AddDocumentsAsync<Game>(games) so
the document type (Game) matches the games index and the Rust example.

31-31: ⚠️ Potential issue | 🔴 Critical

Fix invalid Java import syntax — code will not compile.

import com.meilisearch.sdk; is not valid Java. You cannot import a package directly; use either a wildcard import or import specific classes. The code snippet also uses the Index class without importing it.

Proposed fix
-import com.meilisearch.sdk;
+import com.meilisearch.sdk.*;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` at line
31, The import statement `import com.meilisearch.sdk;` is invalid Java and
prevents compilation; replace it with proper class or wildcard imports (e.g.,
import the Client and Index classes or use import com.meilisearch.sdk.*;) so the
code references to Index (and any other SDK classes) resolve correctly, and
ensure any fully-qualified usages are updated to rely on the imported types
(look for symbols: Index, Client, etc.).
🧹 Nitpick comments (1)
snippets/generated-code-samples/code_samples_date_guide_index_1.mdx (1)

18-20: File handle json_file is never closed.

Using a bare open() without a with block leaves the file handle open until garbage collection. Prefer a context manager.

♻️ Proposed fix
-json_file = open('./games.json', encoding='utf-8')
-games = json.load(json_file)
-client.index('games').add_documents(games)
+with open('./games.json', encoding='utf-8') as json_file:
+    games = json.load(json_file)
+client.index('games').add_documents(games)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx` around
lines 18 - 20, The file handle opened as json_file when loading './games.json'
is never closed; wrap the open call in a context manager so the handle is closed
automatically: use a with open('./games.json', encoding='utf-8') as json_file:
block, load games via json.load(json_file), then call
client.index('games').add_documents(games) inside/after that block to preserve
behavior while ensuring the file is closed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx`:
- Around line 99-103: Uncomment the required Dart imports so the example runs
as-is: restore the dart:io and dart:convert imports at the top of the snippet so
File and JSON handling work (e.g., make sure the File(...) call and `json`
variable usage, and the `client.index('games').addDocumentsJson(json)` line,
have the necessary imports available). Ensure the snippet includes the two
imports instead of commented lines so readers can copy-paste and execute it
directly.
- Around line 62-64: The snippet incorrectly uses the Movie type for a games
index: update the deserialization and add-call to use Game instead of Movie by
changing JsonSerializer.Deserialize<IEnumerable<Movie>>(jsonString, options) to
JsonSerializer.Deserialize<IEnumerable<Game>>(jsonString, options) and
index.AddDocumentsAsync<Movie>(games) to index.AddDocumentsAsync<Game>(games) so
the document type (Game) matches the games index and the Rust example.
- Line 31: The import statement `import com.meilisearch.sdk;` is invalid Java
and prevents compilation; replace it with proper class or wildcard imports
(e.g., import the Client and Index classes or use import com.meilisearch.sdk.*;)
so the code references to Index (and any other SDK classes) resolve correctly,
and ensure any fully-qualified usages are updated to rely on the imported types
(look for symbols: Index, Client, etc.).

---

Nitpick comments:
In `@snippets/generated-code-samples/code_samples_date_guide_index_1.mdx`:
- Around line 18-20: The file handle opened as json_file when loading
'./games.json' is never closed; wrap the open call in a context manager so the
handle is closed automatically: use a with open('./games.json',
encoding='utf-8') as json_file: block, load games via json.load(json_file), then
call client.index('games').add_documents(games) inside/after that block to
preserve behavior while ensuring the file is closed.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d737d8 and 7cd8071.

📒 Files selected for processing (2)
  • snippets/generated-code-samples/code_samples_ai_search_getting_started_embedders_1.mdx
  • snippets/generated-code-samples/code_samples_date_guide_index_1.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • snippets/generated-code-samples/code_samples_ai_search_getting_started_embedders_1.mdx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_q_1.mdx`:
- Around line 7-11: The JSON payload contains an invalid placeholder for the
"vector" field ("vector": VECTORIZED_QUERY) which breaks copy/paste; replace
that placeholder with a JSON-valid value (e.g., a numeric array placeholder or a
concrete example vector) so the request body is valid JSON while keeping the
"hybrid" and "q" fields unchanged; update the snippet around the "vector" key to
use a syntactically valid JSON array or value instead of the bare identifier.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd8071 and 8d8b62e.

📒 Files selected for processing (3)
  • .code-samples.meilisearch.yaml
  • snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx
  • snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_q_1.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • snippets/generated-code-samples/code_samples_image_search_user_embeddings_search_1.mdx

@curquiza curquiza changed the title Add code samples instead of raw exanmples with curl only Add code samples instead of raw examples with curl only Feb 24, 2026
@curquiza curquiza merged commit abeb561 into main Feb 24, 2026
2 of 3 checks passed
@curquiza curquiza deleted the create-code-samples branch February 24, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix/improvement tooling and maintenance Maintenance (CI, tooling...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant