Annotation Interface SystemMessageProviderSupplier
Marks a method as a system message provider for an agent.
The annotated method must be static on the agent type, accept an
Object parameter (the memoryId),
and return a String (the system message).
Besides the memoryId, it can declare parameters resolved through a SupplierParameterResolver.
This provides a declarative alternative to programmatically calling
AgentBuilder.systemMessageProvider(java.util.function.Function),
and is useful when the system message needs to be dynamically computed at runtime.
Example:
public interface DynamicAgent {
@Agent("An agent with a dynamic system message")
String chat(@V("request") String request);
@SystemMessageProviderSupplier
static String systemMessageProvider(Object memoryId) {
return "You are an assistant for user " + memoryId;
}
}
Like every helper method, it can be an instance method of a helper object of the agent instead of a static method
of the agent type: see the "Helper objects" section of the agentic tutorial and
AgenticServices.AgentConfigurator.