Record Class ChatRetrievalContext
- Record Components:
scope- tenant and conversation-session isolationrunId- application run identity, if presentagentName- application agent or role identity, if presentsimulationState- application lifecycle state, if presentcurrentEpisode- current episode identity, if presentsourceRevision- application source revision, if presentcancellationToken- cooperative cancellation signaldeadline- absolute retrieval deadline, if presentmetadataFilters- additional document metadata filtersturnMessage- raw message of the turn, if presentconversationId- opaque conversation identity, if presentsourcePaths- run-time location of declared sources, by source name
The canonical chat fields are copied into
RetrievalRequest.metadataFilters() so live sources receive the
complete invocation context and cache keys isolate runs, episodes, owners,
and source revisions. They use a reserved namespace and are not document
predicates for materialized sources; ordinary entries in
metadataFilters() remain document filters.
turnMessage(), conversationId() and
sourcePaths() are copied into the matching
RetrievalRequest components, never into its metadata filters.
When a turn message is present, chat searches it instead of the message
the provider renders. Source paths move the declared sources of the chat's
knowledge to their location for this request: a source the map names reads
from the map's location, any other from its declared path, resolved
against the run's base directory when one is set.
- Since:
- 0.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for optional, request-local chat context. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChatRetrievalContext(RetrievalScope scope, Optional<String> runId, Optional<String> agentName, Optional<String> simulationState, Optional<String> currentEpisode, Optional<String> sourceRevision, CancellationToken cancellationToken, Optional<Instant> deadline, Map<String, String> metadataFilters, Optional<String> turnMessage, Optional<String> conversationId, Map<String, Path> sourcePaths) Validates and defensively copies the request context. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagentNamerecord component.static ChatRetrievalContext.Builderbuilder()Returns a builder with unscoped, non-cancellable defaults.Returns the value of thecancellationTokenrecord component.Returns the value of theconversationIdrecord component.Returns the value of thecurrentEpisoderecord component.deadline()Returns the value of thedeadlinerecord component.documentFilters(Map<String, String> filters) Returns only document predicates, excluding reserved chat lifecycle fields that exist for live-source dispatch and cache isolation.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themetadataFiltersrecord component.runId()Returns the value of therunIdrecord component.scope()Returns the value of thescoperecord component.Returns the value of thesimulationStaterecord component.Returns the value of thesourcePathsrecord component.Returns the value of thesourceRevisionrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theturnMessagerecord component.withIdentityDefaults(RetrievalScope fallbackScope, String fallbackAgentName) Fills missing scope components and agent identity from the active agent entry context without overriding values supplied by the application.
-
Field Details
-
OWNER_ID_FILTER
- See Also:
-
RUN_ID_FILTER
- See Also:
-
AGENT_NAME_FILTER
- See Also:
-
SIMULATION_STATE_FILTER
- See Also:
-
CURRENT_EPISODE_FILTER
- See Also:
-
SOURCE_REVISION_FILTER
- See Also:
-
BINDING_REVISION_FILTER
- See Also:
-
-
Constructor Details
-
ChatRetrievalContext
public ChatRetrievalContext(RetrievalScope scope, Optional<String> runId, Optional<String> agentName, Optional<String> simulationState, Optional<String> currentEpisode, Optional<String> sourceRevision, CancellationToken cancellationToken, Optional<Instant> deadline, Map<String, String> metadataFilters, Optional<String> turnMessage, Optional<String> conversationId, Map<String, Path> sourcePaths) Validates and defensively copies the request context.
-
-
Method Details
-
builder
Returns a builder with unscoped, non-cancellable defaults. -
withIdentityDefaults
public ChatRetrievalContext withIdentityDefaults(RetrievalScope fallbackScope, String fallbackAgentName) Fills missing scope components and agent identity from the active agent entry context without overriding values supplied by the application.- Parameters:
fallbackScope- active tenant/session scopefallbackAgentName- active agent identity- Returns:
- context with missing identity defaults filled
-
documentFilters
Returns only document predicates, excluding reserved chat lifecycle fields that exist for live-source dispatch and cache isolation.- Parameters:
filters- complete retrieval metadata filters- Returns:
- immutable document-filter subset
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
scope
Returns the value of thescoperecord component.- Returns:
- the value of the
scoperecord component
-
runId
Returns the value of therunIdrecord component.- Returns:
- the value of the
runIdrecord component
-
agentName
Returns the value of theagentNamerecord component.- Returns:
- the value of the
agentNamerecord component
-
simulationState
Returns the value of thesimulationStaterecord component.- Returns:
- the value of the
simulationStaterecord component
-
currentEpisode
Returns the value of thecurrentEpisoderecord component.- Returns:
- the value of the
currentEpisoderecord component
-
sourceRevision
Returns the value of thesourceRevisionrecord component.- Returns:
- the value of the
sourceRevisionrecord component
-
cancellationToken
Returns the value of thecancellationTokenrecord component.- Returns:
- the value of the
cancellationTokenrecord component
-
deadline
Returns the value of thedeadlinerecord component.- Returns:
- the value of the
deadlinerecord component
-
metadataFilters
Returns the value of themetadataFiltersrecord component.- Returns:
- the value of the
metadataFiltersrecord component
-
turnMessage
Returns the value of theturnMessagerecord component.- Returns:
- the value of the
turnMessagerecord component
-
conversationId
Returns the value of theconversationIdrecord component.- Returns:
- the value of the
conversationIdrecord component
-
sourcePaths
Returns the value of thesourcePathsrecord component.- Returns:
- the value of the
sourcePathsrecord component
-