-
Notifications
You must be signed in to change notification settings - Fork 102
feat: Add support for conversational search #716
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
WalkthroughAdds a new chats module implementing chat-workspace data models, a query builder, CRUD-like client methods, optional reqwest-gated streaming for chat completions, an integration-style lifecycle test, exports the module in Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Client as Client<Http>
participant HTTP as Meilisearch API
Dev->>Client: list_chat_workspaces()
Client->>HTTP: GET /chats
HTTP-->>Client: ChatWorkspacesResults
Client-->>Dev: ChatWorkspacesResults
Dev->>Client: get_chat_workspace(uid)
Client->>HTTP: GET /chats/{uid}
HTTP-->>Client: ChatWorkspace
Client-->>Dev: ChatWorkspace
Dev->>Client: get_chat_workspace_settings(uid)
Client->>HTTP: GET /chats/{uid}/settings
HTTP-->>Client: ChatWorkspaceSettings
Client-->>Dev: ChatWorkspaceSettings
Dev->>Client: update_chat_workspace_settings(uid, settings)
Client->>HTTP: PATCH /chats/{uid}/settings (JSON)
HTTP-->>Client: ChatWorkspaceSettings
Client-->>Dev: ChatWorkspaceSettings
Dev->>Client: reset_chat_workspace_settings(uid)
Client->>HTTP: DELETE /chats/{uid}/settings
HTTP-->>Client: ChatWorkspaceSettings
Client-->>Dev: ChatWorkspaceSettings
sequenceDiagram
autonumber
actor Dev as Developer
participant Client as Client<reqwest> (feature)
participant HTTP as Meilisearch API
Dev->>Client: stream_chat_completion(uid, body)
Client->>HTTP: POST /chats/{uid}/chat/completions\nAccept: text/event-stream
Note over HTTP,Client: Server streams JSON chunks (SSE/stream)
HTTP-->>Client: Streaming response
Client-->>Dev: reqwest::Response (stream)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/chats.rs (1)
144-147
: Consider acceptingimpl Into<ChatPrompts>
for consistency.The
set_prompts
method takesChatPrompts
by value, while other setters useimpl Into<String>
. For consistency and flexibility, consider acceptingimpl 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
📒 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 withflatten
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.
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @kumarUjjawal. * #716 (comment) The following files were modified: * `src/chats.rs` * `src/reqwest.rs`
Pull Request
Related issue
Fixes #696
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit
New Features
Documentation
Tests
Chores