ADK for TypeScript: API Reference
    Preparing search index...

    Type Alias SingleBeforeModelCallback

    SingleBeforeModelCallback: (
        params: { context: Context; request: LlmRequest },
    ) => LlmResponse | undefined | Promise<LlmResponse | undefined>

    A callback that runs before a request is sent to the model.

    Type Declaration

      • (
            params: { context: Context; request: LlmRequest },
        ): LlmResponse | undefined | Promise<LlmResponse | undefined>
      • Parameters

        • params: { context: Context; request: LlmRequest }
          • context: Context

            The current callback context.

          • request: LlmRequest

            The raw model request. Callback can mutate the request.

        Returns LlmResponse | undefined | Promise<LlmResponse | undefined>

        The content to return to the user. When present, the model call will be skipped and the provided content will be returned to user.