`Class OutputSchema`
java.lang.Object
com.google.adk.flows.llmflows.OutputSchema
- All Implemented Interfaces:
RequestProcessor
该处理器负责处理使用相关工具的代理程序的输出数据结构(即输出数据格式)。
-
嵌套类概述
Nested classes/interfaces inherited from interface RequestProcessor
RequestProcessor.RequestProcessingResultModifier and TypeInterfaceDescriptionstatic class请求处理的结果。 -
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionstatic EventcreateFinalModelResponseEvent(InvocationContext context, String jsonResponse) 从 `set_model_response` JSON 数据中生成最终的模型响应事件。getStructuredModelResponse(Event functionResponseEvent) 提取已成功验证的数据。set_model_response将结果以 JSON 格式返回。io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult> processRequest(InvocationContext context, LlmRequest request) 将 LLM 请求作为预处理阶段的一部分进行处理。
-
构造函数详细信息
-
OutputSchema
public OutputSchema()
-
-
方法详细信息(Method Details)
-
processRequest
public io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult> processRequest(InvocationContext context, LlmRequest request) 描述内容复制自接口文档:RequestProcessor将 LLM 请求作为预处理阶段的一部分进行处理。- 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
提取已成功验证的数据。set_model_response将结果以 JSON 格式返回。只有通过了输出模式验证的结果才会被记录在事件操作中。
SetModelResponseTool返回的结果仅包含验证信息(即数据是否满足预设的条件)。发送给模型的验证反馈信息永远不会被纳入最终的、结构化的响应结果中。- Parameters:
functionResponseEvent- The function response event to check.- Returns:
- JSON response string if set_model_response succeeded, Optional.empty() otherwise.
-
createFinalModelResponseEvent
从 `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.
-