API reference
API reference
Select your platform
No SDKs available
No versions available

HuggingFaceProvider Class

HuggingFace cloud provider – supports chat/VLM (IChatTask) and object detection (IObjectDetectionTask).
Normalized detections shape: [{ "score":float, "label":string, "box":[xmin,ymin,xmax,ymax] }, ...]

Properties

Indicates whether this provider prepares and sends image inputs for supported multimodal models.
Disable for pure-text models to reduce request overhead and validation checks.See IChatTask and your model's capabilities on the provider dashboard.
override InferenceType DefaultSupportedTypes[Get]
Unique identifier for this provider type (e.g., "OpenAI", "LlamaApi").
Used to store and retrieve credentials from the central CredentialStorage.
When true, this provider asset uses its own API key instead of the central storage.

Member Functions

Sends a chat turn to a Hugging Face Inference endpoint and returns assistant text.
Supports optional image inputs when the selected model is multimodal.See IChatTask. HF Inference: https://huggingface.co/docs/api-inference/index
Parameters
req
Message payload and (optionally) images prepared by the editor or runtime.
stream
Optional progress receiver for partial tokens; final text is always delivered.
ct
Cancellation token for request assembly and HTTP.
Returns
ChatResponse with assistant text and raw payload for diagnostics.
Runs object detection using a Hugging Face model and returns structured detections.
Handles tensor or JSON outputs depending on the model’s task definition.See IObjectDetectionTask. HF Tasks: https://huggingface.co/docs/inference-providers/tasks/object-detection
Parameters
imageJpgOrPng
Encoded image data (e.g., JPG/PNG). Must be non-empty.
ct
Cancellation token to abort pre-processing or HTTP.
Returns
Normalized detection set (boxes, scores, class ids) for downstream visualization.
Performs object detection on a RenderTexture by encoding it to JPEG and calling the byte[] overload.
This provides compatibility with the IObjectDetectionTask interface while adapting to cloud providers.
Parameters
src
Source RenderTexture to analyze.
ct
Cancellation token for aborting the operation.
Returns
UTF-8 encoded JSON string as byte array containing detection results.