Skip to content

Conversation

@kumarUjjawal
Copy link
Contributor

@kumarUjjawal kumarUjjawal commented Oct 14, 2025

Pull Request

Related issue

Fixes #696

What does this PR do?

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features

    • Chat workspaces: list (with query/pagination), retrieve, and view/update/reset workspace settings.
    • Builder-style configurable prompts and workspace settings.
    • Optional streaming endpoint for real-time chat completions.
  • Documentation

    • Added introductory docs for the new chats module.
  • Tests

    • Integration-style test covering full chat workspace lifecycle and builders.
  • Chores

    • Added crate-private accessor for the optional HTTP client integration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds a new chats module implementing chat-workspace data models, builders for prompts and settings, a query builder, client CRUD-like methods and optional reqwest-gated streaming for chat completions; includes networking helper and tests; exports chats in lib.rs and adds a crate-private reqwest accessor.

Changes

Cohort / File(s) Summary
Chats module & API surface
src/chats.rs
Adds chat workspace models (ChatWorkspace, ChatWorkspacesResults, ChatPrompts, ChatWorkspaceSettings) with builder-style setters, ChatWorkspacesQuery query builder, client methods for list/get/settings CRUD (list_chat_workspaces, list_chat_workspaces_with, get_chat_workspace, get_chat_workspace_settings, update_chat_workspace_settings, reset_chat_workspace_settings), optional stream_chat_completion (cfg feature = "reqwest"), streaming request builder, and tests (lifecycle + builders).
Library export
src/lib.rs
Adds pub mod chats and a module doc comment.
Reqwest client accessor
src/reqwest.rs
Adds pub(crate) fn inner(&self) -> &reqwest::Client to expose the internal reqwest client within the crate.
Client tests import
src/client.rs
Narrows test imports: removes glob import of client items and imports only Action and qualified_version.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Client as Client<Http>
  participant API as Meilisearch API

  Dev->>Client: list_chat_workspaces()
  Client->>API: GET /chats
  API-->>Client: ChatWorkspacesResults
  Client-->>Dev: ChatWorkspacesResults

  Dev->>Client: get_chat_workspace(uid)
  Client->>API: GET /chats/{uid}
  API-->>Client: ChatWorkspace
  Client-->>Dev: ChatWorkspace

  Dev->>Client: get_chat_workspace_settings(uid)
  Client->>API: GET /chats/{uid}/settings
  API-->>Client: ChatWorkspaceSettings
  Client-->>Dev: ChatWorkspaceSettings

  Dev->>Client: update_chat_workspace_settings(uid, settings)
  Client->>API: PATCH /chats/{uid}/settings (JSON)
  API-->>Client: ChatWorkspaceSettings
  Client-->>Dev: ChatWorkspaceSettings

  Dev->>Client: reset_chat_workspace_settings(uid)
  Client->>API: DELETE /chats/{uid}/settings
  API-->>Client: ChatWorkspaceSettings
  Client-->>Dev: ChatWorkspaceSettings
Loading
sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Client as Client<reqwest> (feature)
  participant API as Meilisearch API

  Dev->>Client: stream_chat_completion(uid, body)
  Client->>API: POST /chats/{uid}/chat/completions\nAccept: text/event-stream
  Note over API,Client: Server streams JSON/event chunks
  API-->>Client: Streaming response (reqwest::Response)
  Client-->>Dev: reqwest::Response (stream)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect serde attribute names and flattened extra on ChatPrompts (searchQParam, searchIndexUidParam).
  • Verify stream_chat_completion signature, headers, and token handling under reqwest feature and build_stream_chat_request.
  • Review tests in src/chats.rs for network assumptions and proper assertions.

Suggested labels

enhancement

Poem

I twitch my whiskers at fresh chat lands,
New burrows mapped with careful hands.
Prompts tucked in pockets neat,
Settings stitched and tidy-sweet.
Hop, stream, list — a rabbit's beat. 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Add support for conversational search' is vague and doesn't clearly describe the specific implementation details: it should mention the chats API or chat workspace endpoints. Consider a more specific title like 'Add chat workspaces API support' or 'Implement chats API client methods' to better reflect the actual code changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed All requirements from issue #696 are met: new chats API client methods implemented (list, get, update, reset workspaces/settings), query builder provided, streaming support added, and comprehensive tests included.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #696 requirements: chat workspace CRUD operations, settings/prompts handling, optional streaming, and test coverage; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79357b0 and 5e05670.

📒 Files selected for processing (1)
  • src/lib.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration-tests

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 91.13924% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.16%. Comparing base (5e84bdf) to head (eaeb2e8).

Files with missing lines Patch % Lines
src/chats.rs 91.05% 28 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #716      +/-   ##
==========================================
+ Coverage   85.90%   86.16%   +0.25%     
==========================================
  Files          19       20       +1     
  Lines        6079     6395     +316     
==========================================
+ Hits         5222     5510     +288     
- Misses        857      885      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

🧹 Nitpick comments (1)
src/chats.rs (1)

144-147: Consider accepting impl Into<ChatPrompts> for consistency.

The set_prompts method takes ChatPrompts by value, while other setters use impl Into<String>. For consistency and flexibility, consider accepting impl Into<ChatPrompts> or cloning a reference.

Apply this diff:

-    pub fn set_prompts(&mut self, prompts: ChatPrompts) -> &mut Self {
-        self.prompts = Some(prompts);
+    pub fn set_prompts(&mut self, prompts: impl Into<ChatPrompts>) -> &mut Self {
+        self.prompts = Some(prompts.into());
         self
     }

Then implement:

impl From<ChatPrompts> for ChatPrompts {
    fn from(p: ChatPrompts) -> Self { p }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02993ad and c985ee4.

📒 Files selected for processing (1)
  • src/chats.rs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/chats.rs (3)
src/reqwest.rs (3)
  • new (24-51)
  • new (148-155)
  • qualified_version (131-135)
src/client.rs (3)
  • new (53-65)
  • None (1283-1283)
  • None (1362-1362)
src/request.rs (2)
  • body (49-56)
  • parse_response (110-146)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration-tests
🔇 Additional comments (5)
src/chats.rs (5)

12-47: LGTM! Well-designed data models.

The structs properly use serde attributes for JSON serialization. The ChatPrompts.extra field with flatten allows provider-specific extensions while maintaining type safety for known fields.


49-79: LGTM! Clean builder pattern.

The implementation follows Rust builder conventions with must_use and method chaining support.


150-184: LGTM! Well-designed query builder.

The query builder properly manages the client reference with lifetimes and excludes it from serialization. The builder pattern is correctly implemented.


186-268: LGTM! Solid CRUD implementation.

The methods follow REST conventions and use AsRef<str> for flexible string parameters. The HTTP method choices align with RESTful design.


336-413: LGTM! Comprehensive integration test.

The test thoroughly exercises the chats API lifecycle:

  • Settings CRUD operations
  • Workspace retrieval
  • Query builder with pagination
  • API key masking verification (lines 380-385)

The test structure is clear and covers the key use cases.

@kumarUjjawal
Copy link
Contributor Author

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #718

coderabbitai bot added a commit that referenced this pull request Oct 15, 2025
Docstrings generation was requested by @kumarUjjawal.

* #716 (comment)

The following files were modified:

* `src/chats.rs`
* `src/reqwest.rs`
@curquiza curquiza changed the title feat: Add support for conversational search Add support for conversational search Nov 21, 2025
curquiza
curquiza previously approved these changes Nov 21, 2025
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Nov 21, 2025

Canceled.

curquiza
curquiza previously approved these changes Nov 21, 2025
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

bors merge

meili-bors bot added a commit that referenced this pull request Nov 21, 2025
716: Add support for conversational search r=curquiza a=kumarUjjawal

# Pull Request


## Related issue
Fixes #696

## What does this PR do?


## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Chat workspaces management: list (with pagination), retrieve, and view/update/reset workspace settings.
  * Configurable prompts included in workspace settings with builder-style configuration.
  * Optional streaming API for real-time chat completions.

* **Documentation**
  * Added introductory documentation for the new chats module.

* **Tests**
  * Integration test covering full chat workspace lifecycle (list, retrieve, configure prompts, update/reset).

* **Chores**
  * Added a crate-private accessor for the HTTP client used by the optional reqwest integration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Kumar Ujjawal <[email protected]>
Co-authored-by: Clémentine <[email protected]>
@meili-bors
Copy link
Contributor

meili-bors bot commented Nov 21, 2025

Build failed:

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

bors merge

@curquiza curquiza merged commit 2449b6a into meilisearch:main Nov 26, 2025
7 of 8 checks passed
@curquiza curquiza added the enhancement New feature or request label Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v1.15.1] Add support for conversational search

2 participants