This example demonstrates advanced AI data processing using Upstash Workflow. The following example workflow downloads a large dataset, processes it in chunks using OpenAI’s GPT-4 model, aggregates the results and generates a report.
Our workflow will:
We start by retrieving the dataset URL and then downloading the dataset:
Note that we use context.call
for the download, a way to make HTTP requests that run for much longer than your serverless execution limit would normally allow.
We split the dataset into chunks and process each one using OpenAI’s GPT-4 model:
After processing our data in smaller chunks to avoid any function timeouts, we aggregate results every 10 chunks:
Finally, we generate a report based on the aggregated results and send it to the user:
Non-blocking HTTP Calls: We use context.call
for API requests so they don’t consume the endpoint’s execution time (great for optimizing serverless cost).
Long-running tasks: The dataset download can take up to 2 hours, though is realistically limited by function memory.
This example demonstrates advanced AI data processing using Upstash Workflow. The following example workflow downloads a large dataset, processes it in chunks using OpenAI’s GPT-4 model, aggregates the results and generates a report.
Our workflow will:
We start by retrieving the dataset URL and then downloading the dataset:
Note that we use context.call
for the download, a way to make HTTP requests that run for much longer than your serverless execution limit would normally allow.
We split the dataset into chunks and process each one using OpenAI’s GPT-4 model:
After processing our data in smaller chunks to avoid any function timeouts, we aggregate results every 10 chunks:
Finally, we generate a report based on the aggregated results and send it to the user:
Non-blocking HTTP Calls: We use context.call
for API requests so they don’t consume the endpoint’s execution time (great for optimizing serverless cost).
Long-running tasks: The dataset download can take up to 2 hours, though is realistically limited by function memory.