Hugging Face
Run text generation, classification, and image classification models on Hugging Face.
On this page
Connect
Auth type: API key (secret_text). Pass the provider's API key or token as the connection's credential. It is sealed at rest and only opened on the server when an action runs.
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("hugging_face", action, input) resolves with the provider's answer and rejects when Hugging Face isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "hugging_face"} says whether yours can call it.
// workflows/notify.ts: call Hugging Face when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellHuggingFace = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when Hugging Face isn't connected.
const output = await step.run("Hugging Face", () =>
step.ctx.integrations.invoke("hugging_face", "image_classification", {
"classificationMode": "standard",
"useCase": "moderation",
"model": "<model>",
"imageSource": "upload",
"imageFile": "<image file>",
"imageUrl": "<image url>",
"customCategories": []
}),
);
step.ctx.log("Hugging Face answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "hugging_face",
"piece_action": "image_classification",
"input": {
"classificationMode": "standard",
"useCase": "moderation",
"model": "<model>",
"imageSource": "upload",
"imageFile": "<image file>",
"imageUrl": "<image url>",
"customCategories": []
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/hugging_face/image_classification" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"classificationMode":"standard","useCase":"moderation","model":"<model>","imageSource":"upload","imageFile":"<image file>","imageUrl":"<image url>","customCategories":[]}}'Actions
image_classification
Image Classification. Classify images with pre-trained models or custom categories - perfect for content moderation, automated tagging, and smart asset management
| Input | Type | Description |
|---|---|---|
classificationModerequired | one of "standard" | "zero_shot" | How do you want to classify your images? |
useCaserequired | one of "moderation" | "general" | "people" | "creative" | "business" | "search" | What type of image classification do you need? |
modelrequired | id (picked from your account) | Select the best model for your use case |
imageSourcerequired | one of "upload" | "url" | How do you want to provide the image? |
imageFilerequired | file | Upload an image file for classification (JPG, PNG, WebP) |
imageUrlrequired | text | URL of the image to classify |
customCategoriesrequired | array | Enter the categories you want to classify the image into (e.g., "dog", "cat", "bird") |
hypothesisTemplateoptional | text | Template for classification (advanced). Default: "This image shows {}" |
topKoptional | number | Maximum number of classification results to return (1-20) |
confidenceThresholdoptional | number | Minimum confidence score for results (0.0-1.0) |
outputFormatoptional | one of "business" | "technical" | "analytics" | "comprehensive" | How to structure the classification results |
text_classification
Text Classification. Classify text into categories using Hugging Face models - includes zero-shot classification for custom categories
| Input | Type | Description |
|---|---|---|
classificationModerequired | one of "zero-shot" | "pretrained" | "search" | Choose your classification approach |
zeroShotModeloptional | one of "facebook/bart-large-mnli" | "sileod/deberta-v3-base-tasksource-nli" | "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli" | "lxyuan/distilbert-base-multilingual-cased-sentiments-student" | Model for classifying into your custom categories |
customLabelsoptional | long text | Enter categories separated by commas (e.g., "customer support, sales inquiry, spam, billing question") |
pretrainedModeloptional | one of "cardiffnlp/twitter-roberta-base-sentiment-latest" | "distilbert/distilbert-base-uncased-finetuned-sst-2-english" | "nlptown/bert-base-multilingual-uncased-sentiment" | "ProsusAI/finbert" | "yiyanghkust/finbert-tone" | "facebook/roberta-hate-speech-dynabench-r4-target" | "tomh/toxigen_hatebert" | "Xuhui/ToxDect-roberta-large" | "atulgupta002/banking_customer_service_query_intent_classifier" | "wesleyacheng/sms-spam-classification-with-bert" | Select a specialized pre-trained classification model |
searchModeloptional | id (picked from your account) | Search from all available text classification models |
textrequired | long text | The text content you want to classify |
topKoptional | number | Number of top predictions to return |
functionToApplyoptional | one of "softmax" | "sigmoid" | "none" | How to calculate confidence scores |
useCacheoptional | boolean | Use cached results for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
chat_completion
Chat Completion. Generate assistant replies using chat-style LLMs - perfect for FAQ bots, support agents, and content generation
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "faq" | "content" | "chat" | "search" | What type of chat assistant are you building? |
modelrequired | id (picked from your account) | Select the best model for your use case |
conversationModerequired | one of "single" | "multi" | "template" | How do you want to build the conversation? |
userMessageoptional | long text | The user message or question to respond to |
systemPromptoptional | long text | Instructions for how the assistant should behave |
conversationHistoryoptional | array | Previous messages in the conversation (for multi-turn chat) |
templateoptional | one of "support" | "faq" | "writer" | "email" | "ecommerce" | Pre-built templates for common business scenarios |
responseLengthoptional | one of "brief" | "normal" | "detailed" | "custom" | How long should the response be? |
customMaxTokensoptional | number | Maximum number of tokens to generate |
temperatureoptional | number | How creative should responses be? (0.1 = focused, 1.0 = creative) |
topPoptional | number | Controls response diversity (0.1 = focused, 1.0 = varied) |
stopSequencesoptional | array | Text sequences that will stop generation |
frequencyPenaltyoptional | number | Reduce repetitive responses (-2.0 to 2.0) |
presencePenaltyoptional | number | Encourage diverse topics (-2.0 to 2.0) |
useCacheoptional | boolean | Use cached responses for identical requests |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
create_image
Create Image. Generate stunning images from text prompts using state-of-the-art diffusion models - perfect for marketing, product design, and creative content
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "speed" | "quality" | "business" | "search" | What type of image generation do you need? |
modelrequired | id (picked from your account) | Select the best model for your use case |
promptrequired | long text | Describe the image you want to generate. Be specific about style, colors, composition, and details. |
aspectRatiooptional | one of "portrait" | "landscape" | "square" | "wide" | "custom" | Choose the dimensions for your image |
customWidthoptional | number | Width in pixels (64-1024) |
customHeightoptional | number | Height in pixels (64-1024) |
negativePromptoptional | long text | Describe what you DON'T want in the image (blur, low quality, distorted, etc.) |
qualitySettingsoptional | one of "fast" | "balanced" | "quality" | "maximum" | "custom" | Balance between image quality and generation time |
customStepsoptional | number | Number of denoising steps (1-100) |
guidanceScaleoptional | number | How closely to follow the prompt (1-20). Higher values = more prompt adherence but may reduce creativity. |
seedoptional | number | Set a seed for reproducible results. Leave empty for random generation. |
scheduleroptional | one of "DPM++2MKarras" | "EulerA" | "DDIM" | "LMS" | Advanced: Choose the noise scheduler algorithm |
document_question_answering
Document Question Answering. Answer questions from document images using Hugging Face models
| Input | Type | Description |
|---|---|---|
modelrequired | one of "impira/layoutlm-document-qa" | "microsoft/layoutlmv3-base" | "nielsr/layoutlmv2-finetuned-docvqa" | Hugging Face document question answering model |
imagerequired | file | Image of the document to analyze (invoice, contract, etc.) |
questionrequired | text | Question to ask about the document (e.g., 'What is the invoice total?') |
top_koptional | number | Number of top answers to return |
max_answer_lenoptional | number | Maximum length of predicted answers |
handle_impossible_answeroptional | boolean | Whether to accept 'impossible' as an answer when no answer is found |
langoptional | one of "en" | "es" | "fr" | "de" | "it" | "pt" | Language to use for OCR text extraction |
use_cacheoptional | boolean | Use cached results if available |
wait_for_modeloptional | boolean | Wait for model to load if not ready |
language_translation
Language Translation. Translate text between languages using specialized Hugging Face translation models
| Input | Type | Description |
|---|---|---|
modelrequired | id (picked from your account) | Select a translation model or search from 7000+ available models |
customModeloptional | text | Alternative: Enter any Hugging Face translation model ID directly (e.g., Helsinki-NLP/opus-mt-ja-en) |
textrequired | long text | The text content you want to translate |
sourceLanguageoptional | text | Source language code (e.g., "en", "es", "fr"). Only needed for multilingual models that support multiple language pairs. |
targetLanguageoptional | text | Target language code (e.g., "fr", "de", "zh"). Only needed for multilingual models that support multiple language pairs. |
cleanUpSpacesoptional | boolean | Remove potential extra spaces in the translation output |
maxLengthoptional | number | Maximum length of the translated text (leave empty for default) |
useCacheoptional | boolean | Use cached results if available for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
object_detection
Object Detection. Detect and locate objects in images with precise bounding boxes - perfect for inventory management, content moderation, and automated tagging
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "general" | "documents" | "security" | "business" | "search" | What type of object detection do you need? |
modelrequired | id (picked from your account) | Select the best model for your detection task |
imagerequired | file | Upload an image for object detection. Supports JPG, PNG, WebP formats. |
confidenceThresholdoptional | number | Minimum confidence score for detections (0.1-0.9). Higher values = fewer but more accurate detections. |
maxDetectionsoptional | number | Maximum number of objects to detect (1-100) |
filterSettingsoptional | one of "high_confidence" | "balanced" | "all_results" | "custom" | How to handle detection results |
outputFormatoptional | one of "business" | "technical" | "analytics" | "comprehensive" | How to structure the detection results |
text_summarization
Text Summarization. Generate abstractive summaries of long text using Hugging Face models - optimized for business content
| Input | Type | Description |
|---|---|---|
contentTyperequired | one of "news" | "email" | "meeting" | "general" | "medical" | "multilingual" | "search" | What type of content are you summarizing? |
modelrequired | id (picked from your account) | Select the best model for your content type |
textrequired | long text | The long text content you want to summarize (most models work best with 512-1024 tokens) |
summaryLengthoptional | one of "brief" | "medium" | "detailed" | "custom" | How long should the summary be? |
customMinLengthoptional | number | Minimum number of tokens for the summary |
customMaxLengthoptional | number | Maximum number of tokens for the summary |
cleanUpSpacesoptional | boolean | Remove extra spaces and clean up formatting |
truncationStrategyoptional | one of "do_not_truncate" | "longest_first" | "only_first" | "only_second" | How to handle text that exceeds model limits |
useCacheoptional | boolean | Use cached results for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
Details
- Id
hugging_face- Category
- AI and ML
- Tags
- ai, huggingface, ml, open-source, models
- Package
@activepieces/piece-hugging-face@0.1.3- Runs
- Through the integration runner