Class OutputSchema
java.lang.Object
com.google.adk.flows.llmflows.OutputSchema
- All Implemented Interfaces:
RequestProcessor
Processor that handles output schema for agents with tools.
-
Nested Class Summary
Nested classes/interfaces inherited from interface RequestProcessor
RequestProcessor.RequestProcessingResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EventcreateFinalModelResponseEvent(InvocationContext context, String jsonResponse) Create a final model response event from set_model_response JSON.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.
-
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:RequestProcessorProcess the LLM request as part of the pre-processing stage.- Specified by:
processRequestin interfaceRequestProcessor- Parameters:
context- the invocation context.request- the LLM request to process.- Returns:
- a list of events generated during processing (if any).
-
getStructuredModelResponse
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
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.
-