Package io.quarkiverse.langchain4j.audit
Class Audit
java.lang.Object
io.quarkiverse.langchain4j.audit.Audit
Abstract class to be implemented in order to keep track of whatever information is useful for the application auditing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInformation about the AiService that is being audited -
Constructor Summary
ConstructorsConstructorDescriptionAudit(Audit.CreateInfo createInfo) Invoked byAuditServicewhen an AiService is invoked -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicationToLLMMessage(dev.langchain4j.data.message.ToolExecutionResultMessage toolExecutionResultMessage) Invoked with a response from an LLM.voidaddLLMToApplicationMessage(dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> response) Invoked with a response from an LLM.voidaddRelevantDocument(List<dev.langchain4j.data.segment.TextSegment> segments, dev.langchain4j.data.message.UserMessage userMessage) Invoked if a relevant document was added to the messages to be sent to the LLMvoidinitialMessages(Optional<dev.langchain4j.data.message.SystemMessage> systemMessage, dev.langchain4j.data.message.UserMessage userMessage) Invoked when the original user and system messages have been createdvoidonCompletion(Object result) Invoked when the final result of the AiService method has been computedvoidInvoked when there was an exception computing the result of the AiService method
-
Constructor Details
-
Audit
Invoked byAuditServicewhen an AiService is invoked
-
-
Method Details
-
getCreateInfo
- Returns:
- information about the AiService that is being audited
-
initialMessages
public void initialMessages(Optional<dev.langchain4j.data.message.SystemMessage> systemMessage, dev.langchain4j.data.message.UserMessage userMessage) Invoked when the original user and system messages have been created -
addRelevantDocument
public void addRelevantDocument(List<dev.langchain4j.data.segment.TextSegment> segments, dev.langchain4j.data.message.UserMessage userMessage) Invoked if a relevant document was added to the messages to be sent to the LLM -
addLLMToApplicationMessage
public void addLLMToApplicationMessage(dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> response) Invoked with a response from an LLM. It is important to note that this can be invoked multiple times when tools exist. -
addApplicationToLLMMessage
public void addApplicationToLLMMessage(dev.langchain4j.data.message.ToolExecutionResultMessage toolExecutionResultMessage) Invoked with a response from an LLM. It is important to note that this can be invoked multiple times when tools exist. -
onCompletion
Invoked when the final result of the AiService method has been computed -
onFailure
Invoked when there was an exception computing the result of the AiService method
-