text_classification
Creates, updates, deletes, gets or lists a text_classification resource.
Overview
| Name | text_classification |
| Type | Resource |
| Id | cloudflare.ai.text_classification |
Set model_name to one of the following models:Text Classification (2 models)
@cf/huggingface/distilbert-sst-2-int8@cf/huggingface/nonomni-distilbert-sst-2-int8
Fields
The following fields are returned by SELECT queries:
- run
Model response
| Name | Datatype | Description |
|---|---|---|
contents | string | Raw response payload (binary or non-object results), used by contents-mode families. |
errors | array | |
messages | array | |
result | object | |
success | boolean |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
run | select | account_id, model_name | This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in Cloudflare Docs. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
model_name | string |
SELECT examples
- run
This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in Cloudflare Docs.
SELECT
contents
FROM cloudflare.ai.text_classification
WHERE account_id = '{{ account_id }}' -- required
AND model_name = '{{ model_name }}' -- required
AND text = '{{ text }}' -- model input
;