Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 6, 2025

Summary by CodeRabbit

  • New Features

    • Added API support to update model metadata via PATCH on /models/{model_owner}/{model_name}.
  • Improvements

    • Predictions and trainings responses now include a metrics.total_time field to report total duration in seconds.
  • Documentation

    • Streamlined endpoint descriptions for GET /predictions/{prediction_id}, GET /trainings, and GET /trainings/{training_id} for clearer guidance.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

Added a PATCH operation to update model metadata at /models/{model_owner}/{model_name}. Extended prediction and training metrics schemas to include total_time. Streamlined descriptions for predictions and trainings GET endpoints. All changes are within src/libs/Replicate/openapi.yaml.

Changes

Cohort / File(s) Summary
Models update endpoint
src/libs/Replicate/openapi.yaml
Introduced PATCH /models/{model_owner}/{model_name} (operationId: models.update) with JSON body for description, readme, github_url, paper_url, weights_url, license_url; returns schemas_model_response.
Predictions metrics schema
src/libs/Replicate/openapi.yaml
Added metrics.total_time (number) to schemas_prediction_response.
Trainings metrics schema
src/libs/Replicate/openapi.yaml
Added metrics.total_time (number) to schemas_training_response.
Description text updates
src/libs/Replicate/openapi.yaml
Shortened descriptions for GET /predictions/{prediction_id}, GET /trainings, and GET /trainings/{training_id}; updated examples text accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API as Replicate API
  participant Store as Model Store

  rect rgba(230,245,255,0.6)
  note over Client,API: Update model metadata
  Client->>API: PATCH /models/{owner}/{name}<br/>JSON: {description, readme, github_url, paper_url, weights_url, license_url}
  API->>Store: Validate and persist metadata update
  Store-->>API: Updated model record
  API-->>Client: 200 OK (schemas_model_response)
  end
Loading
sequenceDiagram
  autonumber
  actor Client
  participant API as Replicate API
  participant Runner as Prediction/Training Runner

  rect rgba(240,255,240,0.6)
  note over Client,API: Retrieve state with total_time
  Client->>API: GET /predictions/{id}
  API->>Runner: Fetch status and metrics
  Runner-->>API: {metrics: {predict_time, total_time, ...}}
  API-->>Client: 200 OK (schemas_prediction_response)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop through YAML fields with glee,
A PATCH to models—metadata set free.
Clocks now tell the total time,
For trains and preds, a measured chime.
Shorter words, a cleaner view—
Thump-thump! The spec is fresh and new. 🐇⏱️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “feat:@coderabbitai” does not describe any of the API schema changes or new functionality in the pull request and is unrelated to the actual updates. It fails to summarize the primary addition of a PATCH /models endpoint and metrics enhancements. Rename the title to clearly reflect the main changes, for example “feat: add PATCH /models/{owner}/{name} endpoint and total_time field to prediction and training metrics.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202510061821

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.

@HavenDV HavenDV enabled auto-merge (squash) October 6, 2025 18:22
@HavenDV HavenDV merged commit b0df124 into main Oct 6, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202510061821 branch October 6, 2025 18:23
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add PATCH for model metadata; add total_time; update GET descriptions Oct 6, 2025
Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e46b6d and 0dc53b2.

⛔ Files ignored due to path filters (12)
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsUpdate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.PredictionsGet.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.TrainingsGet.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.ModelsUpdateRequest.Json.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.ModelsUpdateRequest.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.SchemasPredictionResponse.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.SchemasPredictionResponseMetrics.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.SchemasTrainingResponseMetrics.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsUpdate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsGet.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsGet.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Replicate/openapi.yaml (5 hunks)

Comment on lines 1493 to 1498
type: object
properties:
total_time:
type: number
description: 'The total time, in seconds, that the prediction took to complete'
description: Additional metrics associated with the prediction
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Restore predict_time in prediction metrics.

While adding total_time, the schema dropped the existing predict_time property, so client SDKs generated from this spec will lose the field definition. Add total_time alongside predict_time instead of replacing it.

         metrics:
           type: object
-          properties:
-            total_time:
-              type: number
-              description: 'The total time, in seconds, that the prediction took to complete'
+          properties:
+            predict_time:
+              type: number
+              description: 'The amount of CPU or GPU time, in seconds, that the prediction used while running'
+            total_time:
+              type: number
+              description: 'The total time, in seconds, that the prediction took to complete'
           description: Additional metrics associated with the prediction
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: object
properties:
total_time:
type: number
description: 'The total time, in seconds, that the prediction took to complete'
description: Additional metrics associated with the prediction
type: object
properties:
predict_time:
type: number
description: 'The amount of CPU or GPU time, in seconds, that the prediction used while running'
total_time:
type: number
description: 'The total time, in seconds, that the prediction took to complete'
description: Additional metrics associated with the prediction
🤖 Prompt for AI Agents
In src/libs/Replicate/openapi.yaml around lines 1493 to 1498 the schema for
prediction metrics replaced the existing predict_time field with total_time;
restore predict_time as a sibling property to total_time by adding a
predict_time entry of type: number with an appropriate description (e.g., 'The
time, in seconds, spent on the model prediction step') so both predict_time and
total_time are present under properties while keeping the description for the
object.

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.

2 participants