File tree Expand file tree Collapse file tree 1 file changed +31
-5
lines changed
src/content/docs/browser-rendering/rest-api Expand file tree Collapse file tree 1 file changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -233,14 +233,40 @@ Below is an example using the TypeScript SDK:
233233import Cloudflare from " cloudflare" ;
234234
235235const client = new Cloudflare ({
236- apiEmail: process .env [" CLOUDFLARE_EMAIL" ], // This is the default and can be omitted
237- apiKey: process .env [" CLOUDFLARE_API_KEY" ], // This is the default and can be omitted
236+ apiToken: process .env [" CLOUDFLARE_API_TOKEN" ], // This is the default and can be omitted
238237});
239238
240239const json = await client .browserRendering .json .create ({
241- account_id: " account_id" ,
242- });
243-
240+ account_id: process .env [" CLOUDFLARE_ACCOUNT_ID" ],
241+ url: " https://developers.cloudflare.com/" ,
242+ prompt: " Get me the list of AI products" ,
243+ response_format: {
244+ type: " json_schema" ,
245+ schema: {
246+ type: " object" ,
247+ properties: {
248+ products: {
249+ type: " array" ,
250+ items: {
251+ type: " object" ,
252+ properties: {
253+ name: {
254+ type: " string"
255+ },
256+ link: {
257+ type: " string"
258+ }
259+ },
260+ required: [
261+ " name"
262+ ]
263+ }
264+ }
265+ }
266+ }
267+ }
268+ }
269+ );
244270console .log (json );
245271```
246272
You can’t perform that action at this time.
0 commit comments