Annotation Interface UserMessageProviderSupplier
Marks a method as a user message provider for an agent.
The annotated method must be static, accept an
Object parameter (the memoryId),
and return a String (the user message).
This provides a declarative alternative to programmatically calling
AgentBuilder.userMessageProvider(java.util.function.Function),
and is useful when the user message needs to be dynamically computed at runtime.
Example:
public interface DynamicAgent {
@Agent("An agent with a dynamic user message")
String chat(@V("request") String request);
@UserMessageProviderSupplier
static String userMessageProvider(Object memoryId) {
return "Process the request for session " + memoryId;
}
}