Query
Allows you to send an HTML document and a custom prompt to OpenAI for processing.
NodeJS
const html = await getHTML("https://www.amazon.com/dp/B01LR5S6HK");
if (!html) return;
const ai = new AIService(cloudBrowserToken, {
openAIConfiguration: { apiKey: openAiToken },
});
// Response format can be created manually but it is easier to use a type
// await ai.query({
// html: html,
// prompt: "Give me the lowest price",
// responseFormat: JSON.stringify({ response: "number", required: ["response"] })
// });
const rpai = await ai.query({
html: html,
prompt: "Give me the lowest price",
});
console.log("The lowest price is:", rpai);
.NET
var html = await GetHTML("http://www.cloudbrowser.ai").ConfigureAwait(false);
if (html == null) return;
using AIService ai = new(cloudBrowserToken, openAiToken);
var rpai = await ai.Query<decimal>(new() {
Html = html,
Prompt = "Give me the lowest price"
}).ConfigureAwait(false);
Console.WriteLine("The lowest price is: {0}", rpai);
/api/v1/ai/Query – Process an HTML Document and Prompt
Method:
POST
Parameters:
html
: (string) – The HTML document you want to process.prompt
: (string) – The custom instruction or task for processing the HTML content.responseFormat
: (string) – The desired format of the response (e.g.,text
,json
).
Request Example:
curl -X POST https://production.cloudbrowser.ai/api/v1/ai/Query \
-H "Content-Type: application/json" \
-d '{
"html": "<html>...</html>",
"prompt": "Extract the title and summarize the content",
"responseFormat": "text"
}'
Last updated