Inngest Launch Week kicks off September 23rd. Follow along with all of our updates!

✨ AI-Personalized Documentation ✨

Learn how to use the Inngest SDK with personalized code examples.

Powered by OpenAICreate your function

Or use an example:

LLM Summarization

OpenAIParallelism

Weekly reminders

CronFan-out

Delivery app order flow

ComplexEvent coordinationExample: Doordash app

DisclaimerThe outputs of this system may be unpredictable and are not guaranteed to be perfect code or morally conscious.

Your history

You haven't submitted anything yet. Either use the form above, or check out one of our examples.

Prompt

Create a function that uses OpenAI to summarize text. It should take a long string of text, splits the text into chunks, uses openAI to summarize the chunks in parallel, then summarizes all summaries.

Generated Inngest function

function.ts
inngest.createFunction(
  { id: "summarize-text" },
  { event: "app/text.summarize" },
  async ({ event, step }) => {
    const chunks = splitTextIntoChunks(event.data.text);

    const summaries = await Promise.all(
      chunks.map((chunk) =>
        step.run("summarize-chunk", () => summarizeChunk(chunk))
      )
    );

    await step.run("summarize-summaries", () => summarizeSummaries(summaries));
  }
);

Here we create a function called "Summarize text" that takes a long string of text, splits the text into chunks, uses openAI to summarize the chunks in parallel, then summarizes all summaries. We use step tooling to run as many actions in parallel as possible and provide retries and durability to each.

References: