Skip to content
Packages Examples Agents Blog Get started

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


AI feedback collection and continuous-learning loop for the Oridecon 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.

Full documentation: oridecon.dev

Terminal window
uv add oridecon-ai-feedback
from oridecon import Application
from oridecon.di.module import Module, module
from oridecon.ai.feedback import FeedbackModule
from oridecon.ai.feedback.config import FeedbackConfig
@module(
imports=[
FeedbackModule.configure(
FeedbackConfig(
enabled=True,
async_processing=True,
store_raw_payloads=False,
)
)
]
)
class AppModule(Module):
pass
async with Application.boot(modules=[AppModule]) as app:
# use app.container to resolve services
...

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 ORI_AI_FEEDBACK__ENABLED=true
# Environment variables for each field
from oridecon.ai.feedback.config import FeedbackConfig
from oridecon.ai.feedback import FeedbackModule
config = FeedbackConfig(
enabled=True,
async_processing=True,
store_raw_payloads=False,
)
FeedbackModule.configure(config)
FieldDefaultEnv varDescription
enabledTrueORI_AI_FEEDBACK__ENABLEDMaster on/off switch for all feedback collection
async_processingTrueORI_AI_FEEDBACK__ASYNC_PROCESSINGProcess feedback handlers asynchronously in the background
store_raw_payloadsFalseORI_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

Submitted feedback is validated at the submission chokepoints (FeedbackCollector._store() for the middleware/processor pipeline and the collect_* API; FeedbackService.submit_feedback() for the programmatic service). Oversized payloads are rejected with FeedbackTooLargeError (never silently truncated); boundary values (exactly at the limit) pass.

LimitConstantApplied to
10,000 charactersMAX_FEEDBACK_TEXT_LENGTHTEXT feedback values and submit_feedback(comment=...)
50,000 characters (serialized JSON)MAX_CONTEXT_SIZEcontext and metadata dicts

create_feedback_endpoint() performs no identity check by default — an endpoint mounted without an authorize callback accepts feedback from anyone who can reach it; that is an explicit, informed choice, not an enforced control. Pass an authorization callback to gate submissions:

from oridecon.ai.feedback import FeedbackCollector, FeedbackMiddleware
def authorize(ctx) -> bool:
# ctx.context_id is the context being submitted against;
# ctx.metadata carries what the host framework supplied (e.g. user)
return ctx.metadata.get("user_id") is not None
middleware = FeedbackMiddleware(
collector=FeedbackCollector(),
authorize=authorize,
)
app.post("/feedback", middleware.create_feedback_endpoint())

Sync and async (bool | Awaitable[bool]) callables are supported. A denied submission raises FeedbackAuthorizationError before any processing.

async with Application.boot(modules=[FeedbackModule.stub()]) as app:
# your test code
...
FileWhat it contains
src/oridecon/ai/feedback/module.pyFeedbackModule.configure(), .stub()
src/oridecon/ai/feedback/config.pyFeedbackConfig
src/oridecon/ai/feedback/services/collector.pyFeedbackCollector core service
src/oridecon/ai/feedback/storage/database.pyDatabaseFeedbackStore
src/oridecon/ai/feedback/storage/cache.pyCachedFeedbackStore
src/oridecon/ai/feedback/processors/processor_registry.pyFeedbackProcessorRegistry
src/oridecon/ai/feedback/di/provider.pyFeedbackProvider boot and registration