genkitx-azure-openai
    Preparing search index...

    Function anyOf

    • Tries context providers in order, returning the first one that succeeds. If all providers fail, throws the error from the last provider.

      Type Parameters

      • C extends ActionContext = ActionContext

      Parameters

      • ...providers: ContextProvider<ActionContext>[]

      Returns ContextProvider<C>

      // Accept either API key or Bearer token
      const callable = onCallGenkit(
      {
      contextProvider: anyOf(
      requireApiKey('X-API-Key', process.env.API_KEY!),
      requireBearerToken(async (token) => {
      const user = await verifyJWT(token);
      return { auth: { user } };
      })
      )
      },
      myFlow
      );