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
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/evaluations/add-human-feedback-api.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ sidebar:
7
7
8
8
This guide will walk you through the steps of adding human feedback to an AI Gateway request using the Cloudflare API. You will learn how to retrieve the relevant request logs, and submit feedback using the API.
9
9
10
-
## Step 1. Create an API Token
10
+
## 1. Create an API Token
11
11
12
12
1.[Create an API token](/fundamentals/api/get-started/create-token/) with the following permissions:
13
13
@@ -17,11 +17,11 @@ This guide will walk you through the steps of adding human feedback to an AI Gat
17
17
2. Get your [Account ID](/fundamentals/setup/find-account-and-zone-ids/).
18
18
3. Using that API token and Account ID, send a [`POST` request](/api/operations/aig-config-create-gateway) to the Cloudflare API.
19
19
20
-
## Step 2. Using the API Token
20
+
## 2. Using the API Token
21
21
22
22
Once you have the token, you can use it in API requests by adding it to the authorization header as a bearer token. Here is an example of how to use it in a request:
@@ -53,7 +53,7 @@ In the example below, the `cf-aig-log-id` is `01JADMCQQQBWH3NXZ5GCRN98DP`.
53
53
"cf-aig-log-id": "01JADMCQQQBWH3NXZ5GCRN98DP"
54
54
}
55
55
}
56
-
```
56
+
````
57
57
58
58
### Method 2: Retrieve the `cf-aig-log-id` via API (GET request)
59
59
@@ -119,7 +119,7 @@ In the example below, the `id` is `01JADMCQQQBWH3NXZ5GCRN98DP`.
119
119
}
120
120
```
121
121
122
-
## Step 4. Submit feedback via PATCH request
122
+
## 4. Submit feedback via PATCH request
123
123
124
124
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:
125
125
@@ -143,7 +143,7 @@ Add the following in the request body to submit negative feedback:
143
143
}
144
144
```
145
145
146
-
## Step 5. Verify the feedback submission
146
+
## 5. Verify the feedback submission
147
147
148
148
You can verify the feedback submission in two ways:
0 commit comments