Class PlannerModelResponse
java.lang.Object
dev.langchain4j.agentic.observability.PlannerModelResponse
The response of a model called by the planner of an agent, like the one a supervisor asks which subagent to invoke
next or the decision model of a decision router, with its token usage and its model name, reported to
AgentListener.onPlannerModelResponse(PlannerModelResponse) when the planner receives that response. These
are the model calls that the planner makes itself and reports through
reportChatModelResponse or
reportDecisionModelResponse, and not the ones of its subagents,
which are reported by their own invocations.
A response reported by a planner is either a chat response or a
decision response, the other one being null, while the
token usage and the model name are available for both.
-
Constructor Summary
ConstructorsConstructorDescriptionPlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, ChatResponse chatResponse) Creates the notification of the response of a chat model, with the token usage and the model name of that response.PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, DecisionResponse decisionResponse) Creates the notification of the response of a decision model, with the token usage and the model name of that response.PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, @Nullable TokenUsage tokenUsage, @Nullable String modelName) Creates a notification with the token usage and the model name only, without the response of the model. -
Method Summary
Modifier and TypeMethodDescriptionagent()agentId()@Nullable ChatResponseReturns the response of the chat model called by the planner, ornullif it called a decision model or if this notification was created without the response.@Nullable DecisionResponseReturns the response of the decision model called by the planner, with its answers and their probabilities, ornullif it called a chat model or if this notification was created without the response.booleaninthashCode()@Nullable StringReturns the name of the model that answered this call, ornullif the provider didn't report it.@Nullable TokenUsageReturns the token usage of this model call, ornullif the provider didn't report it.toString()
-
Constructor Details
-
PlannerModelResponse
public PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, @Nullable TokenUsage tokenUsage, @Nullable String modelName) Creates a notification with the token usage and the model name only, without the response of the model.- Parameters:
agenticScope- the scope of the agentic system running the planneragent- the agent whose planner called the modeltokenUsage- the token usage of this model call, ornullif the provider didn't report itmodelName- the name of the model that answered this call, ornullif the provider didn't report it
-
PlannerModelResponse
public PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, ChatResponse chatResponse) Creates the notification of the response of a chat model, with the token usage and the model name of that response.- Parameters:
agenticScope- the scope of the agentic system running the planneragent- the agent whose planner called the modelchatResponse- the response of the chat model called by the planner
-
PlannerModelResponse
public PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, DecisionResponse decisionResponse) Creates the notification of the response of a decision model, with the token usage and the model name of that response.- Parameters:
agenticScope- the scope of the agentic system running the planneragent- the agent whose planner called the modeldecisionResponse- the response of the decision model called by the planner, with its answers and their probabilities
-
-
Method Details
-
agenticScope
-
agent
-
tokenUsage
Returns the token usage of this model call, ornullif the provider didn't report it. -
modelName
Returns the name of the model that answered this call, ornullif the provider didn't report it. -
chatResponse
Returns the response of the chat model called by the planner, ornullif it called a decision model or if this notification was created without the response. -
decisionResponse
Returns the response of the decision model called by the planner, with its answers and their probabilities, ornullif it called a chat model or if this notification was created without the response. -
agentName
-
agentId
-
equals
-
hashCode
-
toString
-