Class DefaultAroundAdvisorChain
java.lang.Object
org.springframework.ai.chat.client.advisor.DefaultAroundAdvisorChain
- All Implemented Interfaces:
AdvisorChain,BaseAdvisorChain,CallAdvisorChain,StreamAdvisorChain
Default implementation for the
BaseAdvisorChain. Used by the ChatClient
to delegate the call to the next CallAdvisor or StreamAdvisor in the
chain.- Since:
- 1.0.0
- Author:
- Christian Tzolov, Dariusz Jedrzejczyk, Thomas Vitale
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuilder(io.micrometer.observation.ObservationRegistry observationRegistry) Creates a newBaseAdvisorChain.Builderfor the defaultBaseAdvisorChainimplementation.copy(CallAdvisor after) Creates a new CallAdvisorChain copy that contains all advisors after the specified advisor.copy(StreamAdvisor after) Creates a new StreamAdvisorChain copy that contains all advisors after the specified advisor.Returns the list of all theCallAdvisorinstances included in this chain at the time of its creation.io.micrometer.observation.ObservationRegistryReturns the list of all theStreamAdvisorinstances included in this chain at the time of its creation.mutate()Returns a newBaseAdvisorChain.Builderinitialized with this chain's advisors and configuration, allowing it to be selectively modified before building a new chain.nextCall(ChatClientRequest chatClientRequest) Invokes the nextCallAdvisorin theCallAdvisorChainwith the given request.reactor.core.publisher.Flux<ChatClientResponse>nextStream(ChatClientRequest chatClientRequest) Invokes the nextStreamAdvisorin theStreamAdvisorChainwith the given request.
-
Field Details
-
DEFAULT_OBSERVATION_CONVENTION
-
-
Method Details
-
builder
public static DefaultAroundAdvisorChain.Builder builder(io.micrometer.observation.ObservationRegistry observationRegistry) Description copied from interface:BaseAdvisorChainCreates a newBaseAdvisorChain.Builderfor the defaultBaseAdvisorChainimplementation.- Parameters:
observationRegistry- the observation registry to use- Returns:
- a new
BaseAdvisorChain.Builder
-
nextCall
Description copied from interface:CallAdvisorChainInvokes the nextCallAdvisorin theCallAdvisorChainwith the given request.- Specified by:
nextCallin interfaceCallAdvisorChain
-
nextStream
public reactor.core.publisher.Flux<ChatClientResponse> nextStream(ChatClientRequest chatClientRequest) Description copied from interface:StreamAdvisorChainInvokes the nextStreamAdvisorin theStreamAdvisorChainwith the given request.- Specified by:
nextStreamin interfaceStreamAdvisorChain
-
copy
Description copied from interface:CallAdvisorChainCreates a new CallAdvisorChain copy that contains all advisors after the specified advisor.- Specified by:
copyin interfaceCallAdvisorChain- Parameters:
after- the CallAdvisor after which to copy the chain- Returns:
- a new CallAdvisorChain containing all advisors after the specified advisor
-
copy
Description copied from interface:StreamAdvisorChainCreates a new StreamAdvisorChain copy that contains all advisors after the specified advisor.- Specified by:
copyin interfaceStreamAdvisorChain- Parameters:
after- the StreamAdvisor after which to copy the chain- Returns:
- a new StreamAdvisorChain containing all advisors after the specified advisor
-
getCallAdvisors
Description copied from interface:CallAdvisorChainReturns the list of all theCallAdvisorinstances included in this chain at the time of its creation.- Specified by:
getCallAdvisorsin interfaceCallAdvisorChain
-
getStreamAdvisors
Description copied from interface:StreamAdvisorChainReturns the list of all theStreamAdvisorinstances included in this chain at the time of its creation.- Specified by:
getStreamAdvisorsin interfaceStreamAdvisorChain
-
getObservationRegistry
public io.micrometer.observation.ObservationRegistry getObservationRegistry()- Specified by:
getObservationRegistryin interfaceAdvisorChain
-
mutate
Description copied from interface:BaseAdvisorChainReturns a newBaseAdvisorChain.Builderinitialized with this chain's advisors and configuration, allowing it to be selectively modified before building a new chain.Concrete
BaseAdvisorChainclasses must override this to return the most concrete builder implementation.- Specified by:
mutatein interfaceBaseAdvisorChain- Returns:
- a pre-populated
BaseAdvisorChain.Builder
-