Quickstart
Install
Section titled “Install”uv add lexigram-ai-feedbackMinimal Example
Section titled “Minimal Example”from lexigram import Application, LexigramConfigfrom lexigram.ai.feedback import FeedbackModule
async def main() -> None: app = Application(name="feedback-app", config=LexigramConfig.from_yaml()) app.add_module(FeedbackModule.configure()) await app.start() # FeedbackProtocol is registered — ready to submit feedback await app.stop()Collect Your First Rating
Section titled “Collect Your First Rating”from lexigram.ai.feedback import FeedbackCollector
collector: FeedbackCollector # resolved from containerfeedback_id = await collector.collect_rating( rating=4.5, context={"model": "gpt-4o", "session_id": "session-123"},)print(f"Stored feedback: {feedback_id}")What Just Happened
Section titled “What Just Happened”FeedbackProviderregisteredFeedbackCollector,FeedbackProcessorRegistry, andFeedbackService(asFeedbackProtocol) in the container.- During
boot(), the provider detectedDatabaseProviderProtocoland optionallyCacheBackendProtocolto wire a durableDatabaseFeedbackStore(and optionally aCachedFeedbackStore). FeedbackCollectoris now ready to persist feedback through the wired store.
Wiring with Database Storage
Section titled “Wiring with Database Storage”from lexigram import Application, LexigramConfigfrom lexigram.ai.feedback import FeedbackModulefrom lexigram.sql import DatabaseModule
app = Application(name="my-app")app.add_module(DatabaseModule.configure("postgresql://localhost/mydb"))app.add_module(FeedbackModule.configure())await app.start()# FeedbackCollector now persists to Postgres via DatabaseFeedbackStoreNext Steps
Section titled “Next Steps”- Guide — collecting, storing, and querying feedback
- How-Tos — practical recipes
- Configuration — every config key