Class ChatModelRequestContext
java.lang.Object
dev.langchain4j.model.chat.listener.ChatModelRequestContext
The chat model request context.
It contains the
ChatRequest, ModelProvider and attributes.
The attributes can be used to pass data between methods of a ChatModelListener
or between multiple ChatModelListeners.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionChatModelRequestContext(ChatRequest chatRequest, ModelProvider modelProvider, Map<Object, Object> attributes) Deprecated. -
Method Summary
-
Constructor Details
-
ChatModelRequestContext
@Deprecated(since="1.24.0") public ChatModelRequestContext(ChatRequest chatRequest, ModelProvider modelProvider, Map<Object, Object> attributes) Deprecated.usebuilder()instead
-
-
Method Details
-
chatRequest
-
modelProvider
-
attributes
- Returns:
- The attributes map. It can be used to pass data between methods of a
ChatModelListeneror between multipleChatModelListeners.
-
invocationId
- Returns:
- the id of the AI Service invocation in which this call is made: the one passed with
ChatRequestOptions.Builder.invocationId(UUID)if any, otherwise the invocation that makes the call (the AI Service's own chat model calls, including those after tool executions, and the calls made by its tools, guardrails, retrieval, chat memory, ...), otherwisenull, for example when the model is called outside of an AI Service. It is theInvocationContext.invocationId()of the AI Service invocation, not an id of this model call. - Since:
- 1.24.0
-
builder
- Since:
- 1.24.0
-
builder()instead