Class SimpleLoggerAdvisor
java.lang.Object
org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor
- All Implemented Interfaces:
Advisor,CallAdvisor,StreamAdvisor,org.springframework.core.Ordered
A simple logger advisor that logs the request and response messages.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from interface org.springframework.ai.chat.client.advisor.api.Advisor
DEFAULT_CHAT_MEMORY_PRECEDENCE_ORDERFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionSimpleLoggerAdvisor(int order) SimpleLoggerAdvisor(Function<ChatClientRequest, String> requestToString, Function<org.springframework.ai.chat.model.ChatResponse, String> responseToString, int order) -
Method Summary
Modifier and TypeMethodDescriptionadviseCall(ChatClientRequest chatClientRequest, CallAdvisorChain callAdvisorChain) reactor.core.publisher.Flux<ChatClientResponse>adviseStream(ChatClientRequest chatClientRequest, StreamAdvisorChain streamAdvisorChain) static SimpleLoggerAdvisor.Builderbuilder()getName()Return the name of the advisor.intgetOrder()toString()
-
Field Details
-
DEFAULT_REQUEST_TO_STRING
-
DEFAULT_RESPONSE_TO_STRING
-
-
Constructor Details
-
SimpleLoggerAdvisor
public SimpleLoggerAdvisor() -
SimpleLoggerAdvisor
public SimpleLoggerAdvisor(int order) -
SimpleLoggerAdvisor
public SimpleLoggerAdvisor(@Nullable Function<ChatClientRequest, String> requestToString, @Nullable Function<org.springframework.ai.chat.model.ChatResponse, String> responseToString, int order)
-
-
Method Details
-
adviseCall
public ChatClientResponse adviseCall(ChatClientRequest chatClientRequest, CallAdvisorChain callAdvisorChain) - Specified by:
adviseCallin interfaceCallAdvisor
-
adviseStream
public reactor.core.publisher.Flux<ChatClientResponse> adviseStream(ChatClientRequest chatClientRequest, StreamAdvisorChain streamAdvisorChain) - Specified by:
adviseStreamin interfaceStreamAdvisor
-
getName
Description copied from interface:AdvisorReturn the name of the advisor. -
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
toString
-
builder
-