Documentation Index
Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt
Use this file to discover all available pages before exploring further.
Pass user feedback to the API
You can pass user feedback to the API as a positive_feedback field in the request.
Logging API
LLM gateway
Update an existing log
If you are using the Logging API, you can pass the positive_feedback field in the request to record if the user liked the output.positive_feedback is a boolean field that indicates if the user liked the output.payload = {
"model": "gpt-4o",
# ...
"positive_feedback": True, # means the user liked the output
}
If you are using the LLM gateway, you can pass the positive_feedback field in the request to record if the user liked the output.positive_feedback is a boolean field that indicates if the user liked the output. If you’re using other LLM provider SDKs, see the integration docs here.{
"model": "gpt-4o",
# ...
"positive_feedback": True, # means the user liked the output
}
In most cases, you will want to update an existing log with the positive_feedback field. In this case, you can use the Update Log API.https://api.keywordsai.co/api/request-logs/batch-update/
Here’s the example that updates the positive_feedback field for a log with id xxxxxx. P.S. You can find the log id in the unique_id field in the response of the Get logs or get it directly from the Logs in the UI.import requests
url = "https://api.keywordsai.co/api/request-logs/batch-update/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"logs": [
{ "unique_id": "xxxxxx",
"positive_feedback": True
# other fields to update
}
# other logs to update
]
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
After you pass the positive_feedback field, you can see it in the side panel of the Logs.