You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update add-human-feedback-api.mdx
get log id using binding to submit human feedback via api
* Fix get cf-aig-log-id examples
* Update src/content/docs/ai-gateway/evaluations/add-human-feedback-api.mdx
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
* Fix typo
---------
Co-authored-by: Gabriel Massadas <[email protected]>
Co-authored-by: Gabriel Massadas <[email protected]>
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/evaluations/add-human-feedback-api.mdx
+30-4Lines changed: 30 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,21 +39,23 @@ The `cf-aig-log-id` is a unique identifier for the specific log entry to which y
39
39
40
40
### Method 1: Locate the `cf-aig-log-id` in the request response
41
41
42
-
This method allows you to directly find the `cf-aig-log-id` within the body of the response returned by the AI Gateway. This is the most straightforward approach if you have access to the original API response.
42
+
This method allows you to directly find the `cf-aig-log-id` within the header of the response returned by the AI Gateway. This is the most straightforward approach if you have access to the original API response.
43
43
44
44
The steps below outline how to do this.
45
45
46
46
1.**Make a Request to the AI Gateway**: This could be a request your application sends to the AI Gateway. Once the request is made, the response will contain various pieces of metadata.
47
-
2.**Check the Response Body**: The response body will include a field named `cf-aig-log-id`. This is the identifier you will need to submit feedback.
47
+
2.**Check the Response Headers**: The response will include a header named `cf-aig-log-id`. This is the identifier you will need to submit feedback.
48
48
49
49
In the example below, the `cf-aig-log-id` is `01JADMCQQQBWH3NXZ5GCRN98DP`.
50
50
51
51
```json
52
52
{
53
53
"status": "success",
54
-
"data": {
55
-
"response": "Sample response data",
54
+
"headers": {
56
55
"cf-aig-log-id": "01JADMCQQQBWH3NXZ5GCRN98DP"
56
+
},
57
+
"data": {
58
+
"response": "Sample response data"
57
59
}
58
60
}
59
61
```
@@ -122,6 +124,30 @@ In the example below, the `id` is `01JADMCQQQBWH3NXZ5GCRN98DP`.
122
124
}
123
125
```
124
126
127
+
### Method 3: Retrieve the `cf-aig-log-id` via a binding
128
+
129
+
You can also retrieve the `cf-aig-log-id` using a binding, which streamlines the process. Here's how to retrieve the log ID directly:
The `aiGatewayLogId` property, will only hold the last inference call log id.
147
+
148
+
149
+
:::
150
+
125
151
## 4. Submit feedback via PATCH request
126
152
127
153
Once you have both the API token and the `cf-aig-log-id`, you can send a PATCH request to submit feedback. Use the following URL format, replacing the `{account_id}`, `{gateway_id}`, and `{log_id}` with your specific details:
0 commit comments