Lytix supports capturing feedback directly from users, similar to ๐/๐ mechanisms.
Note: You likely want to be using the proxy integration to capture feedback. This is because you need the modelIOEventId
to be able to capture feedback.
Make A Query
First lets make a query, following is an example using OpenAI, but the same pattern will work for any of the integrations.
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant. "},
{"role": "user", "content": [{ "type": "text", "text": "Just say hello "}]},
],
)
Capture Feedback
Now we can extract the ioEventId
and send it to the feedback endpoint.
import requests
import json
# Extract the IO Event ID
ioEventId = response.to_dict()['lytix-proxy-payload']['lytixEventId']
# Or if you are in the EU ๐ช๐บ: https://eu.api.lytix.co/v2/metrics/setUserFeedback
url = "https://api.lytix.co/v2/metrics/setUserFeedback"
payload = json.dumps({
"modelIOEventId": ioEventId,
"userFeedback": "POSITIVE" # OR NEGATIVE
})
headers = {
# Add your lytix api key
'lx-api-key': '$LYTIX_API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
View Feedback
You can view feedback in the Lytix platform when viewing specific IO Events.

Or you can view all feedback as a graph under the User Feedback page.
Responses are generated using AI and may contain mistakes.