Class BaseLlmFlow
java.lang.Object
com.google.adk.flows.llmflows.BaseLlmFlow
- All Implemented Interfaces:
BaseFlow
- Direct Known Subclasses:
SingleFlow
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final List<RequestProcessor> protected final List<ResponseProcessor> -
Constructor Summary
ConstructorsConstructorDescriptionBaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors) BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors, Optional<Integer> maxSteps) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.reactivex.rxjava3.core.Flowable<Event> postprocess(InvocationContext context, Event baseEventForLlmResponse, LlmRequest llmRequest, LlmResponse llmResponse) Post-processes the LLM response after receiving it from the LLM.protected io.reactivex.rxjava3.core.Flowable<Event> preprocess(InvocationContext context, AtomicReference<LlmRequest> llmRequestRef) Pre-processes the LLM request before sending it to the LLM.io.reactivex.rxjava3.core.Flowable<Event> run(InvocationContext invocationContext) Executes the full LLM flow by repeatedly callingrunOneStep(InvocationContext)until a final response is produced.io.reactivex.rxjava3.core.Flowable<Event> runLive(InvocationContext invocationContext) Executes the LLM flow in streaming mode.
-
Field Details
-
requestProcessors
-
responseProcessors
-
maxSteps
protected final int maxSteps
-
-
Constructor Details
-
BaseLlmFlow
public BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors) -
BaseLlmFlow
public BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors, Optional<Integer> maxSteps)
-
-
Method Details
-
preprocess
protected io.reactivex.rxjava3.core.Flowable<Event> preprocess(InvocationContext context, AtomicReference<LlmRequest> llmRequestRef) Pre-processes the LLM request before sending it to the LLM. Executes all registeredRequestProcessortransforming the providedllmRequestRefin-place, and emits the events generated by them. -
postprocess
protected io.reactivex.rxjava3.core.Flowable<Event> postprocess(InvocationContext context, Event baseEventForLlmResponse, LlmRequest llmRequest, LlmResponse llmResponse) Post-processes the LLM response after receiving it from the LLM. Executes all registeredResponseProcessorinstances. Emits events for the model response and any subsequent function calls. -
run
Executes the full LLM flow by repeatedly callingrunOneStep(InvocationContext)until a final response is produced. -
runLive
Executes the LLM flow in streaming mode.Handles sending history and live requests to the LLM, receiving responses, processing them, and managing agent transfers.
-