Skip to content

Add a Webhook to handle Replicate's responses for large model #154

@bgmntmail

Description

@bgmntmail

Describe the feature

Problem Overview

  1. Asynchronous Processing:
  • Replicate API: When you make a request to the Replicate API to process some data, it doesn't give you the result immediately because the processing takes time.
  • Webhook: Instead, the Replicate API allows you to specify a webhook. A webhook is like a callback URL that the API will call once it finishes processing the data.
  1. Timeout Issues:
  • Vercel and Netlify: Our current hosting providers, Vercel and Netlify, will cut off any request that takes too long (25 seconds for Vercel, 10 seconds for Netlify). Since the processing by Replicate can take longer, we can't wait for the response directly in our initial API call.

Solution: Using Webhooks

  1. Initial Request:
  • When the user makes a request to our API to process data with the Replicate API, our API immediately returns a response saying the request has been accepted.
  • Our API also stores some information to track this request.
  1. Handling the Webhook:
  • We set up a new endpoint in our API to act as a webhook. The Replicate API will call this webhook once it has finished processing the data.
  • When our webhook endpoint receives the call, it updates the status of the original request with the result.

Additional context

No response

Participation

  • I am willing to submit a pull request for this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions