Skip to content
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

I need webhook calling feature #227

Open
offchan42 opened this issue Mar 3, 2024 · 4 comments
Open

I need webhook calling feature #227

offchan42 opened this issue Mar 3, 2024 · 4 comments
Assignees

Comments

@offchan42
Copy link

offchan42 commented Mar 3, 2024

This example code is for running SDXL from this page: https://www.baseten.co/library/stable-diffusion-xl/

const axios = require('axios');
const os = require('os');

const BASETEN_API_KEY = process.env.BASETEN_API_KEY;
const modelId = ''; // Replace with your model id

const data = {
  prompt: 'a little boy looking through a large magical portal, the boy sees a futuristic human civilization in that portal, extremely detailed, trending on artstation, 8k',
};

// Call model endpoint
axios.post(`https://model-${modelId}.api.baseten.co/production/predict`, data, {
  headers: {
    Authorization: `Api-Key ${BASETEN_API_KEY}`,
  },
})
  .then((response) => {
    const output = response.data.data;
    // Process the output as needed
    console.log('Output:', output);
  })
  .catch((error) => {
    console.error('Error:', error.message || error);
  });

I found that it's an async request that only works for long running servers. I am using Vercel and it's a serverless function that has short timeout span so I need a way to pass a webhook route to the request somehow.

I need baseten to notify my webhook route when the prediction finishes because I cannot keep polling the data on short-lived functions.

This is an example of the webhook feature from runpod: https://docs.runpod.io/serverless/endpoints/send-requests#--webhook

When can I get this feature and if not, what is the workaround?

@squidarth
Copy link
Contributor

Hi @offchan42 , sorry for the late response here.

We are working on this feature now, and will have it done by the end of April.

@usman61
Copy link

usman61 commented May 16, 2024

Hello @squidarth
Is this webhook feature available now?
I also need it for whisper to translate lengthy videos and notified to my web end point whenever translation completes.

@spal1
Copy link
Contributor

spal1 commented May 17, 2024

Hey @usman61 thanks for reaching out! We've just launched async inference on Baseten for beta testing and we'd love for you to try it out. Check out our docs on async inference here https://docs.baseten.co/invoke/async and the docs on the webhook integration here https://docs.baseten.co/invoke/async-secure. Feel free to reach out via our in-app chat or [email protected] with questions and feedback!

@usman61
Copy link

usman61 commented May 25, 2024

thanks for the very useful resources @spal1.
One minor issue in documentation which needs to be fixed. please update the node js code snippet for the Async Inference API endpoint from predict to async_predict.
@squidarth could you please inform the concerned person to update this documentation.
given below is the documentation link and the reference image.
https://docs.baseten.co/api-reference/production-async-predictbaseten

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

No branches or pull requests

4 participants