# Class OutputSchema

java.lang.Object
com.google.adk.flows.llmflows.OutputSchema

All Implemented Interfaces:
  `RequestProcessor`

public final class OutputSchema extends Object implements RequestProcessor
Processor that handles output schema for agents with tools.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface RequestProcessor

  `RequestProcessor.RequestProcessingResult`
  Modifier and Type
  Interface
  Description
  `static class`
  `RequestProcessor.RequestProcessingResult`
  Result of request processing.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OutputSchema()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Event`
  `createFinalModelResponseEvent(InvocationContext context, String jsonResponse)`
  Create a final model response event from set_model_response JSON.
  `static Optional<String>`
  `getStructuredModelResponse(Event functionResponseEvent)`
  Check if function response contains set_model_response and extract JSON.
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  `processRequest(InvocationContext context, LlmRequest request)`
  Process the LLM request as part of the pre-processing stage.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### OutputSchema

    public OutputSchema()

- ## Method Details

  - ### processRequest

    public io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult> processRequest(InvocationContext context, LlmRequest request)
    Description copied from interface: `RequestProcessor`
    Process the LLM request as part of the pre-processing stage.
    Specified by:
      `processRequest` in interface `RequestProcessor`
    Parameters:
      `context` - the invocation context.
      `request` - the LLM request to process.
    Returns:
      a list of events generated during processing (if any).

  - ### getStructuredModelResponse

    public static Optional<String> getStructuredModelResponse(Event functionResponseEvent)
    Check if function response contains set_model_response and extract JSON.
    Parameters:
      `functionResponseEvent` - The function response event to check.
    Returns:
      JSON response string if set_model_response was called, Optional.empty() otherwise.

  - ### createFinalModelResponseEvent

    public static Event createFinalModelResponseEvent(InvocationContext context, String jsonResponse)
    Create a final model response event from set_model_response JSON.
    Parameters:
      `context` - The invocation context.
      `jsonResponse` - The JSON response from set_model_response tool.
    Returns:
      A new Event that looks like a normal model response.