User Feedback
How to send the user feedback from your app to phospho?
Logging user feedback is a crucial part of evaluating an LLM app. Even though user feedback is subjective and biased towards negative, it is a valuable source of information to improve the quality of your app.
Setup user feedback in your app to log the user feedback to phospho, review it in the webapp, improve the automatic evaluations, and make your app better.
Architecture: what’s the task_id?
In your app, you should collect user feedback after having logged a task to phospho. Every task logged to phospho is identified by a unique task_id.
For phospho to know what task the user is giving feedback on, you need to keep track of the task_id.
There are two ways to manage the task_id: frontend or backend.
Any way you chose, there are helpers in the phospho package to make it easier.
Option 1: Task id managed by Frontend
You pass this task id to your backend. The backend executes the task and log the task to phospho with this task id.
In your frontend, you collect user feedback based on this task id.
Option 2: Task id managed by Backend
The backend generates a task id using UUID V4, and logs the task to phospho with this task id.
In your frontend, you collect user feedback based on this task id.
Backend: Log to phospho with a known task_id
The phospho package provides multiple helpers to manage the task_id.
Make sure you have initialized the phospho package with your project_id and api_key somewhere in your app.
You can fetch the task_id generated by phospho.log
:
To generate a new task_id, you can use the new_task
function.
To get the latest task_id, you can use the latest_task_id
variable.
Frontend: Collect user feedback
Once your backend has executed the task and logged it to phospho with a known task_id, send the task_id back to your frontend.
In your frontend, using the task_id, you can collect user feedback and send it to phospho.
Backend: Manage user feedback collection
If you don’t want to collect user feedback in the frontend, you can instead create an endpoint in your backend and collect user feedback there.
The phospho python package provides a user_feedback
function to log user feedback.
Was this page helpful?