Class SpringChatClientAiModelInvoker
java.lang.Object
com.flowable.agent.engine.impl.model.chatclient.SpringChatClientAiModelInvoker
- All Implemented Interfaces:
AiModelInvoker
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final AgentEngineConfigurationprotected final org.springframework.ai.chat.client.ChatClient -
Constructor Summary
ConstructorsConstructorDescriptionSpringChatClientAiModelInvoker(org.springframework.ai.chat.client.ChatClient chatClient, AgentEngineConfiguration engineConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPreviousChatExchanges(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) protected voidapplyTools(AgentInvocationContext agentInvocationContext, AgentEngineConfiguration agentEngineConfiguration, org.springframework.ai.model.tool.ToolCallingChatOptions.Builder optionsBuilder) protected intdetermineMaxNumberOfPreviousExchanges(AgentInvocationContext agentInvocationContext) protected org.springframework.ai.chat.client.ResponseEntity<org.springframework.ai.chat.model.ChatResponse, AgentInvocationResult> executeCallAndHandleOutput(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) protected org.springframework.ai.converter.StructuredOutputConverter<com.fasterxml.jackson.databind.JsonNode> getOutputConverter(AgentInvocationContext agentInvocationContext) protected List<AgentInvocationExchangePart> getPageOfExchangeParts(AgentInvocationContext agentInvocationContext) protected voidhandleUserAndSystemPrompts(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) invoke(AgentInvocationContext agentInvocationContext) protected AgentInvocationResultResponseImplprocessChatResponse(FlowableSpringChatClientObservationContext observationContext) protected static voidprocessExchanges(FlowableSpringChatClientObservationContext.ObservationExchange exchange, Consumer<FlowableSpringChatClientObservationContext.ObservationExchange> consumer) protected List<org.springframework.ai.tool.ToolCallback> resolveModelAndOperationToolCallbacks(AgentInvocationContext agentInvocationContext)
-
Field Details
-
AGENT_INSTANCE_EXCHANGE_PART_ID
- See Also:
-
chatClient
protected final org.springframework.ai.chat.client.ChatClient chatClient -
agentEngineConfiguration
-
-
Constructor Details
-
SpringChatClientAiModelInvoker
public SpringChatClientAiModelInvoker(org.springframework.ai.chat.client.ChatClient chatClient, AgentEngineConfiguration engineConfiguration)
-
-
Method Details
-
invoke
- Specified by:
invokein interfaceAiModelInvoker
-
processChatResponse
protected AgentInvocationResultResponseImpl processChatResponse(FlowableSpringChatClientObservationContext observationContext) -
applyTools
protected void applyTools(AgentInvocationContext agentInvocationContext, AgentEngineConfiguration agentEngineConfiguration, org.springframework.ai.model.tool.ToolCallingChatOptions.Builder optionsBuilder) -
resolveModelAndOperationToolCallbacks
protected List<org.springframework.ai.tool.ToolCallback> resolveModelAndOperationToolCallbacks(AgentInvocationContext agentInvocationContext) -
handleUserAndSystemPrompts
protected void handleUserAndSystemPrompts(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) -
addPreviousChatExchanges
protected void addPreviousChatExchanges(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) -
getPageOfExchangeParts
protected List<AgentInvocationExchangePart> getPageOfExchangeParts(AgentInvocationContext agentInvocationContext) -
determineMaxNumberOfPreviousExchanges
-
getOutputConverter
protected org.springframework.ai.converter.StructuredOutputConverter<com.fasterxml.jackson.databind.JsonNode> getOutputConverter(AgentInvocationContext agentInvocationContext) -
executeCallAndHandleOutput
protected org.springframework.ai.chat.client.ResponseEntity<org.springframework.ai.chat.model.ChatResponse,AgentInvocationResult> executeCallAndHandleOutput(AgentInvocationContext agentInvocationContext, org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec prompt) -
processExchanges
protected static void processExchanges(FlowableSpringChatClientObservationContext.ObservationExchange exchange, Consumer<FlowableSpringChatClientObservationContext.ObservationExchange> consumer)
-