Introduction

User feedback is a crucial part of understanding user experience and intent. It helps you identify areas for improvement and make informed decisions to enhance your application’s performance and user satisfaction.

In case your LLM execution is split across a backend and frontend, then refer to the distributed tracing docs to make sure the feedback is set to the correct trace.

Prerequisites

You have already set tracing for your code as described in our quickstart guide.

Setting

You can set on both the trace level or the span level. If the applies to the entire trace, then set it on the trace level. If the applies to a specific span, then set it on the span level. For more details, refer to the enrich traces documentation.

In Python, you can use the enrich_session function to set on the trace level.

To pass to HoneyHive, pass it to the param in the enrich_session function. This function is used to enrich the session with additional information. Remember that enrich_session will update, not overwrite, the existing object on the trace.

Read more about the enrich_session function in the Python SDK reference.

Here’s an example of how to set on the trace level in Python:

Python
from honeyhive import HoneyHiveTracer, enrich_session

HoneyHiveTracer.init(
  api_key="my-api-key",
  project="my-project",
)

# ...

enrich_session(feedback={
  "rating": True,
  "comment": "The model hallucinated the capital of New York",
  # optionally adding reference ground truth
  "ground_truth": "The capital of New York is Albany",
  # optionally adding any arbitrary fields as you need
})

Concepts

What is User Feedback?

Any feedback that the end-user provides about their experience is considered user feedback. This can be of two types:

  1. Explicit Feedback: Any feedback provided by the user explicitly in your app. Examples include 👍/👎, ratings (1-n), etc.
  2. Implicit Feedback: Any actions within your app’s UI by your user that may indicate user experience and intent. Examples include clicking Copy, Regenerate, etc.
User Feedback vs Human Evaluator: User feedback field is used to track feedback provided by your end-users. Feedback from domain experts or other internal team members is considered a human evaluator in HoneyHive and is tracked on the metrics field.

Return Types

We accept all primary return types as user feedback. This includes:

Return TypeAvailable MeasurementsNotes
BooleanTrue/False
NumberPercentage, Sum, Avg, Median, Min, Max, P95, P98, P99
StringAny string valueUsed for filters and group by

For complex data types, we allow you to drill down to the nested fields or specific positions in the array.

So, for example, if you pass feedback like:

{
  "rating": 5,
  "comment": "Great experience",
  "step1": {
    "retry": true
  },
  "edits": [
    {
      "value": "New York"
    }
  ]
}

You can chart feedback.step1.retry as a boolean field or feedback.edits.0.value as a string field.

Nesting Limitations: For complex data types like objects and arrays, we allow max 5 levels of nested objects and max 2 levels of nested arrays.

Reserved Fields

The following fields are reserved for user feedback:

ground_truth - The ground truth value for the output of a trace or span. This is used to compare the actual output with the expected output. It is rendered differently in the UI.

Learn More

SDK Reference

Read more about the enrich_session function in the Python SDK reference.