Skip to content
GitHubDiscord

AI Feedback (lexigram-ai-feedback)

AI feedback collection for the Lexigram Framework — collection, processing, and storage


AI feedback collection and continuous-learning loop for the Lexigram Framework. Captures user ratings, corrections, text feedback, and ground-truth labels from LLM interactions and routes them through an extensible processor pipeline to configurable storage backends. Zero-config usage starts with sensible defaults.

Terminal window
uv add lexigram-ai-feedback
from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.ai.feedback import FeedbackModule
from lexigram.ai.feedback.config import FeedbackConfig
@module(imports=[
FeedbackModule.configure(
FeedbackConfig(
enabled=True,
async_processing=True,
store_raw_payloads=False,
)
)
])
class AppModule(Module):
pass
app = Application(modules=[AppModule])
if __name__ == "__main__":
app.run()

Zero-config usage: Call FeedbackModule.configure() with no arguments to use defaults.

application.yaml
ai_feedback:
enabled: true
async_processing: true
store_raw_payloads: false
Section titled “Option 2 — Profiles + Environment Variables (recommended)”
Terminal window
export LEX_AI_FEEDBACK__ENABLED=true
# Environment variables for each field
from lexigram.ai.feedback.config import FeedbackConfig
from lexigram.ai.feedback import FeedbackModule
config = FeedbackConfig(
enabled=True,
async_processing=True,
store_raw_payloads=False,
)
FeedbackModule.configure(config)
FieldDefaultEnv varDescription
enabledTrueLEX_AI_FEEDBACK__ENABLEDMaster on/off switch for all feedback collection
async_processingTrueLEX_AI_FEEDBACK__ASYNC_PROCESSINGProcess feedback handlers asynchronously in the background
store_raw_payloadsFalseLEX_AI_FEEDBACK__STORE_RAW_PAYLOADSPersist raw incoming feedback payloads for auditing
MethodDescription
FeedbackModule.configure(config)Configure with explicit config
FeedbackModule.stub()Minimal config for testing
  • Four feedback types: Rating, free-text, correction (original → corrected), and ground-truth labels
  • Extensible processor pipeline: Custom processors via FeedbackProcessorRegistry
  • Storage backends: In-memory, database (DatabaseFeedbackStore), and cache (CachedFeedbackStore)
  • Middleware integration: FeedbackMiddleware and FeedbackContext for request/response capture
  • Lifecycle hooks: FeedbackSubmittedHook, FeedbackProcessedHook, FeedbackStoredHook
async with Application.boot(modules=[FeedbackModule.stub()]) as app:
# your test code
...
FileWhat it contains
src/lexigram/ai/feedback/module.pyFeedbackModule.configure(), .stub()
src/lexigram/ai/feedback/config.pyFeedbackConfig
src/lexigram/ai/feedback/services/collector.pyFeedbackCollector core service
src/lexigram/ai/feedback/storage/database.pyDatabaseFeedbackStore
src/lexigram/ai/feedback/storage/cache.pyCachedFeedbackStore
src/lexigram/ai/feedback/processors/processor_registry.pyFeedbackProcessorRegistry
src/lexigram/ai/feedback/di/provider.pyFeedbackProvider boot and registration