---
sidebar:
  hidden: true
title: roboto.ai.agent_thread.feedback
---
## Module Contents

### AdminUpdateFeedbackRequest

```python
class roboto.ai.agent_thread.feedback.AdminUpdateFeedbackRequest(/, **data: Any)
```

`from roboto.ai.agent_thread import AdminUpdateFeedbackRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L128-L167)

Bases: `pydantic.BaseModel`

Request body for `PUT /v1/admin/feedback/{feedback_id}`.

Only Roboto administrators may send it. No SDK method sends it.

A field left unset (`NotSet`) is unchanged. A request that sets no field raises `RobotoInvalidRequestException`. Building the model raises `pydantic.ValidationError` for a field it does not define, such as a misspelled field name.

**Parameters**

- **data** (`Any`)

**Attributes**

- **AdminUpdateFeedbackRequest.admin_label** (`str | None | roboto.sentinels.NotSetType`): Short label to sort the feedback by, such as `"follow up"` or `"duplicate"`.

  Stored with surrounding whitespace removed and its case kept, since labels are case-sensitive. `None` or a blank label clears it.

- **AdminUpdateFeedbackRequest.admin_note** (`str | None | roboto.sentinels.NotSetType`): Note on the feedback for Roboto administrators. `None` clears it.

- **AdminUpdateFeedbackRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

- **AdminUpdateFeedbackRequest.resolved** (`bool | roboto.sentinels.NotSetType`): Whether the feedback is resolved.

  `True` records the time and the administrator in `AgentFeedbackRecord.resolved_at` and `AgentFeedbackRecord.resolved_by`; `False` clears both.

### FeedbackCategory

```python
class roboto.ai.agent_thread.feedback.FeedbackCategory
```

`from roboto.ai.agent_thread import FeedbackCategory`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L23-L45)

Bases: `roboto.compat.StrEnum`

Category of feedback on a message from Roboto's AI: what about the message was good or bad.

Which categories feedback may carry depends on its sentiment; `category_is_valid_for_sentiment` checks one. `OTHER` is valid with either sentiment, and feedback that includes it needs notes.

**Attributes**

- **FeedbackCategory.CORRECT** = `'correct'`
- **FeedbackCategory.FORMATTING** = `'formatting'`
- **FeedbackCategory.GOOD_TOOL_USE** = `'good_tool_use'`
- **FeedbackCategory.HELPFUL** = `'helpful'`
- **FeedbackCategory.INCOMPLETE** = `'incomplete'`
- **FeedbackCategory.INCORRECT** = `'incorrect'`
- **FeedbackCategory.OTHER** = `'other'`
- **FeedbackCategory.REFUSED_VALID_REQUEST** = `'refused_valid_request'`
- **FeedbackCategory.SLOW** = `'slow'`
- **FeedbackCategory.TOOL_FAILURE** = `'tool_failure'`
- **FeedbackCategory.UNSAFE** = `'unsafe'`

### FeedbackSentiment

```python
class roboto.ai.agent_thread.feedback.FeedbackSentiment
```

`from roboto.ai.agent_thread import FeedbackSentiment`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L16-L20)

Bases: `roboto.compat.StrEnum`

Sentiment of feedback on a message from Roboto's AI: whether the rating is positive or negative.

**Attributes**

- **FeedbackSentiment.NEGATIVE** = `'negative'`
- **FeedbackSentiment.POSITIVE** = `'positive'`

### NEGATIVE_CATEGORIES

```python
roboto.ai.agent_thread.feedback.NEGATIVE_CATEGORIES: frozenset[FeedbackCategory]
```

`from roboto.ai.agent_thread import NEGATIVE_CATEGORIES`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L48-L58)

Categories valid only on feedback with negative sentiment. `FeedbackCategory.OTHER` is in neither set.

### POSITIVE_CATEGORIES

```python
roboto.ai.agent_thread.feedback.POSITIVE_CATEGORIES: frozenset[FeedbackCategory]
```

`from roboto.ai.agent_thread import POSITIVE_CATEGORIES`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L61-L67)

Categories valid only on feedback with positive sentiment. `FeedbackCategory.OTHER` is in neither set.

### SubmitFeedbackRequest

```python
class roboto.ai.agent_thread.feedback.SubmitFeedbackRequest(/, **data: Any)
```

`from roboto.ai.agent_thread import SubmitFeedbackRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L88-L125)

Bases: `pydantic.BaseModel`

Request body for [`submit_feedback()`](/docs/reference/python-sdk/roboto/ai/agent_thread/agent_thread#roboto.ai.agent_thread.agent_thread.AgentThread.submit_feedback).

A user has at most one feedback on each message, so submitting again replaces that user's `sentiment`, `categories` and `notes`. Building the model raises `pydantic.ValidationError` when a category is not valid for `sentiment`, or when `categories` includes `FeedbackCategory.OTHER` and `notes` is `None`, empty, or only whitespace.

**Parameters**

- **data** (`Any`)

**Attributes**

- **SubmitFeedbackRequest.categories** (`list[FeedbackCategory]`) = `None`: Categories describing what was good or bad about the message. Defaults to none.

  Building the model drops duplicates and sorts the rest by value, so the order given is not kept.

- **SubmitFeedbackRequest.notes** (`str | None`) = `None`: Free-text notes on the message. Required when `categories` includes `FeedbackCategory.OTHER`.

  Building the model turns notes that are empty or only whitespace into `None`.

- **SubmitFeedbackRequest.sentiment** (`FeedbackSentiment`): Sentiment of the feedback.

### UserFeedbackRecord

```python
class roboto.ai.agent_thread.feedback.UserFeedbackRecord(/, **data: Any)
```

`from roboto.ai.agent_thread import UserFeedbackRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L234-L288)

Bases: `pydantic.BaseModel`

Data record of feedback on a message in a thread, as Roboto returns it to the user who submitted it.

[`submit_feedback()`](/docs/reference/python-sdk/roboto/ai/agent_thread/agent_thread#roboto.ai.agent_thread.agent_thread.AgentThread.submit_feedback) returns it. Feedback is one user's rating of a message from Roboto's AI: a sentiment, categories, and optional notes. The record leaves out the fields Roboto administrators use to triage feedback.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UserFeedbackRecord.categories** (`list[FeedbackCategory]`) = `None`: Categories describing what was good or bad about the message, sorted by value. Empty when none were chosen.

- **UserFeedbackRecord.created** (`datetime.datetime`): Time the feedback was first submitted.

- **UserFeedbackRecord.created_by** (`str`): ID of the user who submitted the feedback.

- **UserFeedbackRecord.feedback_id** (`str`): Unique ID of the feedback, beginning with `fb_`.

- **UserFeedbackRecord.message_sequence_num** (`int`): Sequence number of the rated message: its zero-based position in the thread's messages.

- **UserFeedbackRecord.modified** (`datetime.datetime`): Time the feedback was last submitted, equal to `created` until its submitter submits it again.

- **UserFeedbackRecord.modified_by** (`str`): ID of the user who last submitted the feedback.

  Always equal to `created_by`, because submitting again replaces only the submitting user's own feedback.

- **UserFeedbackRecord.notes** (`str | None`) = `None`: Free-text notes on the message, or `None` if the submitter gave none.

- **UserFeedbackRecord.org_id** (`str`): ID of the organization that owns the thread. Fixed when the feedback is first submitted.

- **UserFeedbackRecord.sentiment** (`FeedbackSentiment`): Sentiment of the feedback.

- **UserFeedbackRecord.thread_id** (`str`): ID of the thread the rated message is in.

#### UserFeedbackRecord.from_admin_record()

```python
@classmethod
def from_admin_record(record: AgentFeedbackRecord) -> UserFeedbackRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L279-L288)

Build a record from `AgentFeedbackRecord`, leaving out the fields for Roboto administrators.

Roboto calls this when it returns feedback to anyone but a Roboto administrator. It copies only the fields this class defines, so a field added to `AgentFeedbackRecord` alone never reaches the result.

**Parameters**

- **record** (`AgentFeedbackRecord`): Record to copy the fields from.

**Returns**

- `UserFeedbackRecord`

### category_is_valid_for_sentiment()

```python
def roboto.ai.agent_thread.feedback.category_is_valid_for_sentiment(
    category: FeedbackCategory,
    sentiment: FeedbackSentiment,
) -> bool
```

`from roboto.ai.agent_thread import category_is_valid_for_sentiment`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent_thread/feedback.py#L71-L85)

Return whether feedback with `sentiment` may carry `category`.

`FeedbackCategory.OTHER` is valid with either sentiment. Every other category is valid with one, as `NEGATIVE_CATEGORIES` and `POSITIVE_CATEGORIES` list.

**Parameters**

- **category** (`FeedbackCategory`): Category to check.
- **sentiment** (`FeedbackSentiment`): Sentiment of the feedback.

**Returns**

- `bool`
