Package com.tnsai.feedback
Interface FeedbackCollector
public interface FeedbackCollector
SPI for collecting and learning from tool execution feedback.
When discovered via FeedbackCollector.Factory.discover(), the agent automatically:
- Records tool execution outcomes (success/failure/latency)
- Accepts explicit user feedback (corrections, preferences)
- Provides learned preferences for prompt augmentation
If tnsai-intelligence is not on the classpath, the agent operates without feedback collection (graceful degradation).
Implementation is provided by tnsai-intelligence module.
- Since:
- 0.1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFactory for creating FeedbackCollector instances.static final recordImmutable record of a tool execution outcome. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of recorded feedback items.Returns learned preferences from accumulated feedback.Returns prompt adjustments derived from corrections and negative feedback.static FeedbackCollectornoOp()Returns a no-op implementation that silently ignores all operations.voidRecords the outcome of a tool execution.voidRecords explicit user feedback (thumbs up/down, correction, preference).
-
Method Details
-
noOp
Returns a no-op implementation that silently ignores all operations. Used as a null-object when tnsai-intelligence is not on the classpath.- Returns:
- a no-op FeedbackCollector (singleton)
-
recordToolOutcome
Records the outcome of a tool execution. Called automatically by the agent after each tool call.- Parameters:
outcome- the tool execution outcome
-
recordUserFeedback
Records explicit user feedback (thumbs up/down, correction, preference).- Parameters:
type- feedback type (POSITIVE, NEGATIVE, CORRECTION, PREFERENCE)content- the feedback contentmetadata- optional metadata (tool name, session id, etc.)
-
getLearnedPreferences
Returns learned preferences from accumulated feedback. Used by the agent to augment the system prompt.- Returns:
- list of preference strings (never null, may be empty)
-
getPromptAdjustments
Returns prompt adjustments derived from corrections and negative feedback. Used by the agent to augment the system prompt.- Returns:
- list of prompt adjustment rules (never null, may be empty)
-
getFeedbackCount
int getFeedbackCount()Returns the number of recorded feedback items.- Returns:
- feedback count
-