Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 23, 2025

Summary by CodeRabbit

  • New Features

    • Added 200 OK synchronous responses for POST /predictions and POST /models/{model_owner}/{model_name}/predictions, enabling immediate final output when available. Existing 201/202 asynchronous behaviors remain unchanged.
  • Documentation

    • Corrected typos in prediction endpoint descriptions (e.g., “endpiont” to “endpoint”) across relevant paths.

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

Walkthrough

Added HTTP 200 responses with schemas_prediction_response to two POST prediction creation endpoints to allow synchronous final results, alongside existing 201/202 asynchronous responses. Corrected “endpiont” to “endpoint” in several prediction-related descriptions. No other structural or signature changes.

Changes

Cohort / File(s) Summary of Changes
Prediction creation response updates
src/libs/Replicate/openapi.yaml
Added 200 OK responses to POST /predictions (operationId: predictions.create) and POST /models/{model_owner}/{model_name}/predictions (operationId: models.predictions.create), both returning schemas_prediction_response. Existing 201/202 responses retained.
Description text corrections
src/libs/Replicate/openapi.yaml
Fixed typos in descriptions: “endpiont” → “endpoint” for prediction-related POST endpoints, including deployments, models, and generic predictions paths.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant A as API (POST /predictions)
  participant W as Prediction Worker

  rect rgb(235, 245, 255)
  note over C,A: New synchronous path (200 OK)
  C->>A: Create prediction (input)
  A->>W: Dispatch job
  W-->>A: Final output ready
  A-->>C: 200 OK with schemas_prediction_response
  end

  opt Existing asynchronous paths (201/202)
    C->>A: Create prediction (input)
    A-->>C: 201/202 Accepted + status URL
    loop Polling/Webhook
      C->>A: GET status (poll) / A->>C: In-progress
      A->>W: Check status
    end
    A-->>C: Final result when complete
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A nibble of specs, a hop through the docs,
Now 200s bloom where async clocks.
I twitch my whiskers—sync or queue?
Either path will see you through.
Carrots for typos fixed on sight—
Endpoint spelled just right. 🥕✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508230108

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) August 23, 2025 01:08
@HavenDV HavenDV merged commit 4bebdad into main Aug 23, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202508230108 branch August 23, 2025 01:09
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add 200 response to prediction POST endpoints; fix 'endpoint' typos Aug 23, 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/libs/Replicate/openapi.yaml (3)

850-872: Add 200 response for POST /predictions to match models endpoint and SDKs.

Per the PR intent and for parity with /models/{owner}/{name}/predictions, POST /predictions should also document a 200 “Success” response carrying schemas_prediction_response for cases where the model completes within the Prefer: wait window. Currently only 201/202 are defined here.

Apply this diff to add the missing 200 response:

       responses:
+        '200':
+          description: Success
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/schemas_prediction_response'
         '201':
           description: 'Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output.'
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'
         '202':
           description: Prediction has been created but does not yet have all outputs
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'

1278-1280: Doc bug: “url” should be “urls” (property name).

The deprecation note says the stream link appears under the prediction’s url property; the schema defines urls (plural). Fix in both request schema descriptions to avoid confusion.

Apply this diff in both locations:

-This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.
+This field is no longer needed as the returned prediction will always have a `stream` entry in its `urls` property if the model supports streaming.

Also applies to: 1505-1507


1549-1555: Regex allows wait=61..99; cap at 60.

The current pattern permits 10–99 (including 61–99). Tighten it to 1–60 as documented.

Apply this diff:

-        pattern: '^wait(=([1-9]|[1-9][0-9]|60))?$'
+        pattern: '^wait(=([1-9]|[1-5][0-9]|60))?$'
🧹 Nitpick comments (3)
src/libs/Replicate/openapi.yaml (3)

656-662: Good addition: 200 response enables synchronous success path.

The new 200 response for models.predictions.create looks correct and uses the same schemas_prediction_response as 201/202. Consider keeping response-code ordering consistent (200, 201, 202) across operations for readability.

Apply this diff to reorder (optional):

       responses:
-        '201':
+        '200':
+          description: Success
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/schemas_prediction_response'
+        '201':
           description: 'Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output.'
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'
         '202':
           description: Prediction has been created but does not yet have all outputs
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'
-        '200':
-          description: Successful
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/schemas_prediction_response'

246-279: Optional: consider documenting a 200 success path here too for symmetry.

If deployments-backed predictions can also complete within the Prefer: wait window, consider adding a 200 response like the models and predictions endpoints for consistency across SDKs and codegen.

Proposed diff (optional):

       responses:
+        '200':
+          description: Success
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/schemas_prediction_response'
         '201':
           description: 'Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output.'
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'
         '202':
           description: Prediction has been created but does not yet have all outputs
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/schemas_prediction_response'

657-657: Unify response descriptions (“Success” vs “Successful”).

You use both “Success” and “Successful”. Choose one (e.g., “Success”) for consistency across the spec. Not functionally critical, but it improves generated docs.

Example change:

-          description: Successful
+          description: Success

Also applies to: 885-886, 191-191, 284-286, 462-464, 484-487, 709-713, 766-771, 916-921, 978-982

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 38252dd and c262100.

⛔ Files ignored due to path filters (6)
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.DeploymentsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.PredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Replicate/openapi.yaml (3 hunks)

post:
summary: Create a prediction using an official model
description: "Create a prediction using an [official model](https://replicate.com/changelog/2025-01-29-official-models).\n\nIf you're _not_ running an official model, use the [`predictions.create`](#predictions.create) operation instead.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpiont.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n"
description: "Create a prediction using an [official model](https://replicate.com/changelog/2025-01-29-official-models).\n\nIf you're _not_ running an official model, use the [`predictions.create`](#predictions.create) operation instead.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpoint.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect cross-reference: should not point to deployments.predictions.create.

This is the models.predictions.create operation; the final sentence references deployments.predictions.create. Replace with models.predictions.create (or with predictions.create if you want a generic reference).

Apply this diff to the description text:

-For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.
+For a complete overview of the `models.predictions.create` API, see our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction), which covers a variety of use cases.
📝 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
description: "Create a prediction using an [official model](https://replicate.com/changelog/2025-01-29-official-models).\n\nIf you're _not_ running an official model, use the [`predictions.create`](#predictions.create) operation instead.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpoint.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n"
description: "Create a prediction using an [official model](https://replicate.com/changelog/2025-01-29-official-models).\n\nIf you're _not_ running an official model, use the [`predictions.create`](#predictions.create) operation instead.\n\nExample cURL request:\n\n
🤖 Prompt for AI Agents
In src/libs/Replicate/openapi.yaml around line 622, the description incorrectly
references deployments.predictions.create; update that final sentence to
reference models.predictions.create (or predictions.create for a generic link)
so it points to the correct operation for this models.predictions.create
endpoint, and ensure the wording matches the rest of the description.

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