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 pagination), retrieve, and view/update/reset workspace settings.
    • Configurable prompts in workspace settings with builder-style configuration.
    • Optional streaming endpoint for real-time chat completions.
  • Documentation

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

    • Integration test covering full chat workspace lifecycle.
  • 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

Warning

Rate limit exceeded

@curquiza has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

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

📒 Files selected for processing (1)
  • src/lib.rs (1 hunks)

Walkthrough

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

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 under reqwest feature, networking helpers for streaming requests, and integration-style tests (lifecycle and builders).
Library export
src/lib.rs
Exposes the new chats module via pub mod chats and adds 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 in tests and imports only Action and qualified_version.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor 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
  actor 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 chunks (streamed response)
  API-->>Client: Streaming response (reqwest::Response)
  Client-->>Dev: reqwest::Response (stream)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to serialization details and serde attribute names on ChatPrompts (renamed JSON keys and flattened extra).
  • Review stream_chat_completion and build_stream_chat_request for correct headers and token handling under reqwest feature.
  • Verify tests' expectations and any network mocking or fixture usage in the integration-style lifecycle test.

Suggested labels

enhancement

Poem

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

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for conversational search' directly aligns with the main PR objective to implement support for the Meilisearch chats API, which enables conversational search functionality.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #696: chat workspace CRUD methods, settings management, streaming completions, and comprehensive integration tests covering the full chat lifecycle.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the chats API: new chats module with workspace models and client methods, test infrastructure, and a minor utility accessor method for internal use.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 <ujjawalpathak6@gmail.com>
Co-authored-by: Clémentine <clementine@meilisearch.com>
@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

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.

[v1.15.1] Add support for conversational search

2 participants