> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adaptive-ml.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Feedback

> Log metrics and preferences to train and evaluate models

Feedback lets you annotate completions with scalar values, boolean ratings, or pairwise preferences. Use feedback for monitoring, evaluation, and as training objectives.

<Tabs>
  <Tab title="SDK" icon="code">
    ## Register a feedback key

    Before logging feedback, register a key:

    ```python theme={null}
    adaptive.feedback.register_key(
        key="quality",
        kind="scalar",  # or "bool"
        scoring_type="higher_is_better",
    )
    ```

    | Parameter      | Type | Required | Description                                           |
    | -------------- | ---- | -------- | ----------------------------------------------------- |
    | `key`          | str  | Yes      | Unique identifier                                     |
    | `kind`         | str  | No       | `"scalar"` (default) or `"bool"`                      |
    | `scoring_type` | str  | No       | `"higher_is_better"` (default) or `"lower_is_better"` |

    ## Log metric feedback

    Log a rating for a completion using its `completion_id` from the inference response:

    ```python theme={null}
    # Get completion_id from inference
    response = adaptive.chat.create(
        messages=[{"role": "user", "content": "Hello"}]
    )
    completion_id = response.choices[0].completion_id

    # Log feedback
    adaptive.feedback.log_metric(
        value=5,
        completion_id=completion_id,
        feedback_key="quality",
    )
    ```

    Feedback is associated with the completion's [Interaction](/v0.12/core/interactions) record.

    ## Log preference feedback

    Log a pairwise comparison between two completions:

    ```python theme={null}
    adaptive.feedback.log_preference(
        feedback_key="quality",
        preferred_completion=completion_id_a,
        other_completion=completion_id_b,
    )
    ```

    Use preferences for RLHF/DPO training when you can judge which completion is better but can't assign absolute scores.

    See [SDK Reference](/v0.12/reference/sdk) for all feedback methods.
  </Tab>

  <Tab title="UI" icon="mouse-pointer">
    ## View feedback

    Navigate to your use case and open the **Feedback** tab to see linked metrics and their values over time.

    <Frame caption="Track feedback metrics across time">
      <img src="https://mintcdn.com/adaptiveml/nxrXfjE5HXjTB4Su/static/metric-plots.png?fit=max&auto=format&n=nxrXfjE5HXjTB4Su&q=85&s=d4b9bea3540f8d8a487ee1062f3ecd00" width="2450" height="1050" data-path="static/metric-plots.png" />
    </Frame>

    ## Link a metric

    Link a feedback key to a use case to display its statistics in the UI. Go to **Feedback** → **Link Metric** and select the key.
  </Tab>
</Tabs>
