-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat:Add sorting params to models listing and adopt Cancel-After header #135
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
Conversation
WalkthroughIntroduces sorting parameters (sort_by, sort_direction) to the public models listing and replaces the max lifetime header parameter with Cancel-After across endpoints. Updates OpenAPI descriptions to document sorting behavior and new header usage within src/libs/Replicate/openapi.yaml. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as HTTP API
participant Models as Models Service
Note over Client,API: List public models with sorting
Client->>API: GET /models?sort_by=model_created_at&sort_direction=desc
API->>Models: Fetch models sorted by criteria
Models-->>API: Sorted model list
API-->>Client: 200 OK (JSON list)
rect rgb(245,250,255)
Note right of Client: Optional timeout control
Client->>API: Any endpoint with header Cancel-After: <seconds>
API->>API: Enforce cancellation if processing exceeds value
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/libs/Replicate/openapi.yaml (2)
481-501: Sorting params for /models: clear and consistent.Defaults and enums align with the docs. Nice addition.
- Consider adding x-enumDescriptions or brief inline notes to each enum value to improve SDK generation and IDE hints.
- Optionally add an example to each parameter for quick copy/paste:
- - name: sort_by + - name: sort_by in: query description: "Field to sort models by. Defaults to `latest_version_created_at`.\n" schema: enum: - model_created_at - latest_version_created_at type: string default: latest_version_created_at + example: latest_version_created_at - - name: sort_direction + - name: sort_direction in: query description: "Sort direction. Defaults to `desc` (descending, newest first).\n" schema: enum: - asc - desc type: string default: desc + example: desc
1812-1819: Enhance Cancel-After parameter with examples and clarify interaction with Prefer.Add concrete examples and note that Cancel-After (job lifetime) is independent of Prefer: wait (HTTP request wait).
parameters: parameters_cancel_after_header: name: Cancel-After in: header - description: "The maximum time the prediction can run before it is automatically canceled. The lifetime is measured from when the prediction is created.\n\nThe duration can be specified as string with an optional unit suffix:\n- `s` for seconds (e.g., `30s`, `90s`)\n- `m` for minutes (e.g., `5m`, `15m`)\n- `h` for hours (e.g., `1h`, `2h30m`)\n- defaults to seconds if no unit suffix is provided (e.g. `30` is the same as `30s`)\n\nYou can combine units for more precision (e.g., `1h30m45s`).\n\nThe minimum allowed duration is 5 seconds.\n" + description: "The maximum time the prediction can run before it is automatically canceled. The lifetime is measured from when the prediction is created.\n\nThe duration can be specified as string with an optional unit suffix:\n- `s` for seconds (e.g., `30s`, `90s`)\n- `m` for minutes (e.g., `5m`, `15m`)\n- `h` for hours (e.g., `1h`, `2h30m`)\n- defaults to seconds if no unit suffix is provided (e.g. `30` is the same as `30s`)\n\nYou can combine units for more precision (e.g., `1h30m45s`).\n\nThe minimum allowed duration is 5 seconds.\n\nNote: This header controls job cancellation and is independent of the `Prefer: wait` header, which only affects how long the HTTP request waits for completion.\n" schema: type: string example: 5m + examples: + seconds: + summary: 30 seconds + value: 30s + minutes: + summary: 5 minutes + value: 5m + hours_mixed: + summary: 1 hour, 30 minutes, 45 seconds + value: 1h30m45s
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (16)
src/libs/Replicate/Generated/Replicate..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.DeploymentsPredictionsCreate.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsPredictionsCreate.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.PredictionsCreate.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonConverters.ModelsListSortBy.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonConverters.ModelsListSortByNullable.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonConverters.ModelsListSortDirection.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonConverters.ModelsListSortDirectionNullable.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.ModelsListSortBy.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.ModelsListSortDirection.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Replicate/openapi.yaml(5 hunks)
🔇 Additional comments (1)
src/libs/Replicate/openapi.yaml (1)
262-263: No lingeringmax-lifetimereferences;Cancel-Afterheader adopted consistently.
rgsearch shows no occurrences ofmax[-_]lifetimeorparameters_max_lifetime_header.- Please confirm the backend accepts the
Cancel-Afterheader (exact casing and duration formats).
Summary by CodeRabbit