roboto.ai.agent_session.feedback#
Module Contents#
- class roboto.ai.agent_session.feedback.AdminUpdateFeedbackRequest(/, **data)#
Bases:
pydantic.BaseModelTriage fields editable by Roboto admins.
Fields omitted from the request (
NotSet) are left unchanged. Fields explicitly set toNoneclear the column back toNULL. Fields set to a value overwrite the column.Setting
resolvedtoTrueadditionally stampsresolved_atandresolved_byserver-side; setting it back toFalseclears them.- Parameters:
data (Any)
- admin_label: str | None | roboto.sentinels.NotSetType#
- admin_note: str | None | roboto.sentinels.NotSetType#
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- resolved: bool | roboto.sentinels.NotSetType#
- class roboto.ai.agent_session.feedback.FeedbackCategory#
Bases:
roboto.compat.StrEnumTaxonomy of feedback categories.
Which categories are valid depends on
sentiment(seecategory_is_valid_for_sentiment()).OTHERis always permitted; whenOTHERis among the selected categories,notesis required.- CORRECT = 'correct'#
- FORMATTING = 'formatting'#
- GOOD_TOOL_USE = 'good_tool_use'#
- HELPFUL = 'helpful'#
- INCOMPLETE = 'incomplete'#
- INCORRECT = 'incorrect'#
- OTHER = 'other'#
- REFUSED_VALID_REQUEST = 'refused_valid_request'#
- SLOW = 'slow'#
- TOOL_FAILURE = 'tool_failure'#
- UNSAFE = 'unsafe'#
- class roboto.ai.agent_session.feedback.FeedbackSentiment#
Bases:
roboto.compat.StrEnumOverall rating direction for a piece of AI-chat feedback.
- NEGATIVE = 'negative'#
- POSITIVE = 'positive'#
- roboto.ai.agent_session.feedback.NEGATIVE_CATEGORIES: frozenset[FeedbackCategory]#
- roboto.ai.agent_session.feedback.POSITIVE_CATEGORIES: frozenset[FeedbackCategory]#
- class roboto.ai.agent_session.feedback.SubmitFeedbackRequest(/, **data)#
Bases:
pydantic.BaseModelRequest body for submitting feedback on an assistant message.
One row per (session, message, user); resubmitting replaces the previous sentiment/categories/notes rather than adding a new row.
- Parameters:
data (Any)
- categories: list[FeedbackCategory] = None#
duplicates are dropped and the persisted order is enum-value sort, not request order.
- Type:
Categories describing what was good or bad. Semantically a set
- notes: str | None = None#
Free-text notes. Whitespace-only input is normalised to
Nonebefore persistence. Required whenFeedbackCategory.OTHERis selected.
- sentiment: FeedbackSentiment#
Overall rating direction.
- class roboto.ai.agent_session.feedback.UserFeedbackRecord(/, **data)#
Bases:
pydantic.BaseModelCustomer-facing projection of
AgentFeedbackRecord.Excludes every admin-only column (
admin_label,admin_note,resolved,resolved_by,resolved_at) so routes that serve an end user never return internal triage state. Use this as the return type of any non-admin endpoint that surfaces feedback, including the response to the submitter’s own submit call.The admin endpoints continue to return
AgentFeedbackRecorddirectly.- Parameters:
data (Any)
- categories: list[FeedbackCategory] = None#
Categories describing the feedback. May be empty.
- created: datetime.datetime#
When this feedback was first submitted.
- created_by: str#
User id of the submitter.
- feedback_id: str#
Unique identifier for this feedback entry.
- classmethod from_admin_record(record)#
Project an
AgentFeedbackRecorddown to the user-facing shape.Use at the boundary of any non-admin route that materialises a full admin record from persistence — the projection guarantees no admin triage column accidentally escapes to a customer response.
The projection is driven by
cls.model_fieldsrather than a hand list of columns: a new submitter-controlled column added to both records flows through automatically, and a new admin-only column onAgentFeedbackRecordis silently dropped here (which is what we want for privacy). The matching test asserts the admin-only field set has not drifted unexpectedly.- Parameters:
record (AgentFeedbackRecord)
- Return type:
- message_sequence_num: int#
Zero-indexed position of the assistant message within the session.
- modified: datetime.datetime#
When the submitter last updated this feedback.
- modified_by: str#
User id of the submitter’s last edit.
- notes: str | None = None#
Free-text notes from the submitter, if any.
- org_id: str#
Org the session belonged to at the time of submission.
- sentiment: FeedbackSentiment#
Overall rating direction.
- session_id: str#
Session the feedback was submitted against.
- roboto.ai.agent_session.feedback.category_is_valid_for_sentiment(category, sentiment)#
Report whether
categoryis a permitted choice undersentiment.FeedbackCategory.OTHERis always permitted.- Parameters:
category (FeedbackCategory)
sentiment (FeedbackSentiment)
- Return type:
bool