genkitx-temporal
    Preparing search index...

    Function defineTemporalFlow

    • Defines a Genkit flow and registers it so it can be executed inside a Temporal Workflow.

      The returned value is a normal Genkit flow — callable locally with await flow(input) — but it is also available to the bundled Temporal Workflow defined in genkitx-temporal/workflows via the activity layer.

      Type Parameters

      • I extends ZodTypeAny
      • O extends ZodTypeAny

      Parameters

      Returns Action<I, O>

      export const jokeFlow = defineTemporalFlow(
      ai,
      {
      name: 'jokeFlow',
      inputSchema: z.string(),
      outputSchema: z.string(),
      },
      async (subject) => {
      const { text } = await ai.generate(`Tell me a joke about ${subject}`);
      return text;
      },
      );