Repository navigation
Untagged Enum for FeedbackStrategy - #8171
Conversation
📝 WalkthroughWalkthroughThis pull request refactors the FeedbackStrategy schema structure across multiple layers. The OpenAPI schema extracts NaiveFeedbackStrategy and NaiveFeedbackStrategyParams as separate schema definitions instead of embedding them inline. Correspondingly, the Rust implementation changes FeedbackStrategy serialization from snake_case to untagged and wraps NaiveFeedbackStrategy parameters in a nested field. The From trait conversion is updated to destructure the new nested structure, and test assertions are adjusted to expect the updated nested error path. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
lib/api/src/rest/schema.rs (1)
914-920: Consider adding doc comments toNaiveFeedbackStrategyParamsThe new public struct and its fields lack documentation. Comparable nearby types (
Mmr,Rrf, etc.) carry per-field doc comments.📝 Suggested doc comments
+/// Coefficients for the naive feedback scoring formula. #[derive(Debug, Serialize, Deserialize, JsonSchema, Validate)] pub struct NaiveFeedbackStrategyParams { + /// Score scaling coefficient for positive feedback. pub a: f32, + /// Score scaling coefficient; must be non-negative. #[validate(range(min = 0.0))] pub b: f32, + /// Offset coefficient. pub c: f32, }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/api/src/rest/schema.rs` around lines 914 - 920, The public struct NaiveFeedbackStrategyParams and its fields (NaiveFeedbackStrategyParams, a, b, c) lack documentation; add doc comments for the struct and each field matching style of nearby types (e.g., Mmr, Rrf) describing what the struct represents and what each parameter controls/units/constraints (noting that b has a validation range), so code consumers and generated docs are informative and consistent.tests/openapi/test_relevance_feedback.py (1)
61-82: Consider adding coverage foraandcrange constraints.Only
b(must be ≥ 0) has a dedicated negative-value test. Ifaandcalso carry range constraints (e.g.,cbetween 0–1), a quick extra assertion per parameter would guard against silent regressions in those validators.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/openapi/test_relevance_feedback.py` around lines 61 - 82, Add negative tests for the remaining relevance_feedback parameters by invoking request_with_validation against the same endpoint ("/collections/{collection_name}/points/query") with modified body values for "a" and "c" that violate their expected ranges and assert the response is not ok and that response.json()["status"]["error"] contains the corresponding validation message; replicate the pattern used for "b" (the existing negative test using a=-1.0) but send an out-of-range value for "a" (e.g., below its minimum) and for "c" (e.g., outside 0–1 if that is the constraint) and assert the error text references internal.query.relevance_feedback.strategy.naive.a and ...naive.c respectively so regressions in those validators are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/api/src/rest/schema.rs`:
- Around line 914-920: The public struct NaiveFeedbackStrategyParams and its
fields (NaiveFeedbackStrategyParams, a, b, c) lack documentation; add doc
comments for the struct and each field matching style of nearby types (e.g.,
Mmr, Rrf) describing what the struct represents and what each parameter
controls/units/constraints (noting that b has a validation range), so code
consumers and generated docs are informative and consistent.
In `@tests/openapi/test_relevance_feedback.py`:
- Around line 61-82: Add negative tests for the remaining relevance_feedback
parameters by invoking request_with_validation against the same endpoint
("/collections/{collection_name}/points/query") with modified body values for
"a" and "c" that violate their expected ranges and assert the response is not ok
and that response.json()["status"]["error"] contains the corresponding
validation message; replicate the pattern used for "b" (the existing negative
test using a=-1.0) but send an out-of-range value for "a" (e.g., below its
minimum) and for "c" (e.g., outside 0–1 if that is the constraint) and assert
the error text references internal.query.relevance_feedback.strategy.naive.a and
...naive.c respectively so regressions in those validators are caught.
* [manual] make untagged enum for consistent API for FeedbackStrategy * add #[validate(nested)] --------- Co-authored-by: Luis Cossío <[email protected]>
* [manual] make untagged enum for consistent API for FeedbackStrategy * add #[validate(nested)] --------- Co-authored-by: Luis Cossío <[email protected]>
Should fix python client generation