Class ContextProvider
java.lang.Object
uno.anahata.ai.context.provider.ContextProvider
- Direct Known Subclasses:
ApplicationFramesContextProvider, ChatStatusProvider, ContextSummaryProvider, CoreSystemInstructionsMdFileProvider, EnvironmentVariablesProvider, StatefulResourcesProvider, SystemPropertiesProvider
An abstract base class for modules that contribute dynamic context or
instructions to the AI model's prompt.
Context providers are executed before each request to the model. They can provide system instructions, workspace information, or any other relevant data that should be included in the context.
This class manages the enabled/disabled state and the target position within the prompt.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ContextProvider with a specific target position. -
Method Summary
Modifier and TypeMethodDescriptionGets a brief, human-readable description of what this provider does.abstract StringGets the human-readable display name for this provider.abstract StringgetId()Gets the unique identifier for this provider.abstract List<com.google.genai.types.Part> Generates a list ofPartobjects to be included in the model's prompt.
-
Constructor Details
-
ContextProvider
Constructs a ContextProvider with a specific target position.- Parameters:
pos- The position in the prompt where this provider's content should be placed.
-
-
Method Details
-
getId
Gets the unique identifier for this provider.This ID is used for internal tracking, configuration, and persistence.
- Returns:
- A non-null, unique string ID (e.g., "core-context-summary").
-
getDisplayName
Gets the human-readable display name for this provider.- Returns:
- A non-null, descriptive name.
-
getDescription
Gets a brief, human-readable description of what this provider does.- Returns:
- The description.
-
getParts
Generates a list ofPartobjects to be included in the model's prompt.This method is called by the
ContentFactorybefore each request. Implementations should be efficient and avoid long-running operations.- Parameters:
chat- The current Chat instance, providing access to the session state.- Returns:
- A list of Parts, or an empty list if the provider has no content to add.
-
