Class CoreContextProvider

java.lang.Object
uno.anahata.asi.agi.context.core.CoreContextProvider
All Implemented Interfaces:
ContextProvider

public class CoreContextProvider extends Object implements ContextProvider
Provides the foundational system instructions and metadata awareness for the Anahata ASI.
Author:
anahata
  • Field Details

    • agi

      private final Agi agi
      The parent agi session.
    • providing

      private boolean providing
      Whether this provider is currently active.
  • Constructor Details

    • CoreContextProvider

      public CoreContextProvider(@NonNull @NonNull Agi agi)
      Constructs a new CoreContextProvider for a specific agi session.
      Parameters:
      agi - The parent agi session. Must not be null.
  • Method Details

    • getId

      public String getId()
      Gets the unique identifier for this context provider.
      Specified by:
      getId in interface ContextProvider
      Returns:
      The provider's ID.
    • getName

      public String getName()
      Gets the human-readable name of this context provider.
      Specified by:
      getName in interface ContextProvider
      Returns:
      The provider's name.
    • getDescription

      public String getDescription()
      Gets a detailed description of what this context provider does.
      Specified by:
      getDescription in interface ContextProvider
      Returns:
      The provider's description.
    • getSystemInstructions

      public List<String> getSystemInstructions() throws Exception
      Gets a list of system instruction strings provided by this context provider. These are typically prepended to the conversation as high-level guidance.
      Specified by:
      getSystemInstructions in interface ContextProvider
      Returns:
      A list of system instruction strings.
      Throws:
      Exception - if an error occurs during instruction generation.
    • populateMessage

      public void populateMessage(RagMessage ragMessage) throws Exception
      Populates the given RagMessage with dynamic, just-in-time context parts. These parts are appended to the end of the user's prompt (RAG).

      Populates mission-critical, live temporal and environment metadata into the RAG message on every turn. Guarantees that the AI model maintains precise awareness of time, time zone, OS, user, and runtime environment even when all tools/toolkits are disabled.

      Specified by:
      populateMessage in interface ContextProvider
      Parameters:
      ragMessage - The message to be augmented with context.
      Throws:
      Exception - if an error occurs during context generation.