Hugging Face

Run text generation, classification, and image classification models on Hugging Face.

AI and MLAPI key8 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (8)
  4. image_classification
  5. text_classification
  6. chat_completion
  7. create_image
  8. document_question_answering
  9. language_translation
  10. object_detection
  11. text_summarization
  12. Details

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.

Workflow
// 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);
});
Try it from your agent
{
  "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"
  }
}
From another backend (connector proxy)
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

InputTypeDescription
classificationModerequiredone of "standard" | "zero_shot"How do you want to classify your images?
useCaserequiredone of "moderation" | "general" | "people" | "creative" | "business" | "search"What type of image classification do you need?
modelrequiredid (picked from your account)Select the best model for your use case
imageSourcerequiredone of "upload" | "url"How do you want to provide the image?
imageFilerequiredfileUpload an image file for classification (JPG, PNG, WebP)
imageUrlrequiredtextURL of the image to classify
customCategoriesrequiredarrayEnter the categories you want to classify the image into (e.g., "dog", "cat", "bird")
hypothesisTemplateoptionaltextTemplate for classification (advanced). Default: "This image shows {}"
topKoptionalnumberMaximum number of classification results to return (1-20)
confidenceThresholdoptionalnumberMinimum confidence score for results (0.0-1.0)
outputFormatoptionalone 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

InputTypeDescription
classificationModerequiredone of "zero-shot" | "pretrained" | "search"Choose your classification approach
zeroShotModeloptionalone 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
customLabelsoptionallong textEnter categories separated by commas (e.g., "customer support, sales inquiry, spam, billing question")
pretrainedModeloptionalone 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
searchModeloptionalid (picked from your account)Search from all available text classification models
textrequiredlong textThe text content you want to classify
topKoptionalnumberNumber of top predictions to return
functionToApplyoptionalone of "softmax" | "sigmoid" | "none"How to calculate confidence scores
useCacheoptionalbooleanUse cached results for faster responses
waitForModeloptionalbooleanWait 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

InputTypeDescription
useCaserequiredone of "faq" | "content" | "chat" | "search"What type of chat assistant are you building?
modelrequiredid (picked from your account)Select the best model for your use case
conversationModerequiredone of "single" | "multi" | "template"How do you want to build the conversation?
userMessageoptionallong textThe user message or question to respond to
systemPromptoptionallong textInstructions for how the assistant should behave
conversationHistoryoptionalarrayPrevious messages in the conversation (for multi-turn chat)
templateoptionalone of "support" | "faq" | "writer" | "email" | "ecommerce"Pre-built templates for common business scenarios
responseLengthoptionalone of "brief" | "normal" | "detailed" | "custom"How long should the response be?
customMaxTokensoptionalnumberMaximum number of tokens to generate
temperatureoptionalnumberHow creative should responses be? (0.1 = focused, 1.0 = creative)
topPoptionalnumberControls response diversity (0.1 = focused, 1.0 = varied)
stopSequencesoptionalarrayText sequences that will stop generation
frequencyPenaltyoptionalnumberReduce repetitive responses (-2.0 to 2.0)
presencePenaltyoptionalnumberEncourage diverse topics (-2.0 to 2.0)
useCacheoptionalbooleanUse cached responses for identical requests
waitForModeloptionalbooleanWait 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

InputTypeDescription
useCaserequiredone of "speed" | "quality" | "business" | "search"What type of image generation do you need?
modelrequiredid (picked from your account)Select the best model for your use case
promptrequiredlong textDescribe the image you want to generate. Be specific about style, colors, composition, and details.
aspectRatiooptionalone of "portrait" | "landscape" | "square" | "wide" | "custom"Choose the dimensions for your image
customWidthoptionalnumberWidth in pixels (64-1024)
customHeightoptionalnumberHeight in pixels (64-1024)
negativePromptoptionallong textDescribe what you DON'T want in the image (blur, low quality, distorted, etc.)
qualitySettingsoptionalone of "fast" | "balanced" | "quality" | "maximum" | "custom"Balance between image quality and generation time
customStepsoptionalnumberNumber of denoising steps (1-100)
guidanceScaleoptionalnumberHow closely to follow the prompt (1-20). Higher values = more prompt adherence but may reduce creativity.
seedoptionalnumberSet a seed for reproducible results. Leave empty for random generation.
scheduleroptionalone 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

InputTypeDescription
modelrequiredone of "impira/layoutlm-document-qa" | "microsoft/layoutlmv3-base" | "nielsr/layoutlmv2-finetuned-docvqa"Hugging Face document question answering model
imagerequiredfileImage of the document to analyze (invoice, contract, etc.)
questionrequiredtextQuestion to ask about the document (e.g., 'What is the invoice total?')
top_koptionalnumberNumber of top answers to return
max_answer_lenoptionalnumberMaximum length of predicted answers
handle_impossible_answeroptionalbooleanWhether to accept 'impossible' as an answer when no answer is found
langoptionalone of "en" | "es" | "fr" | "de" | "it" | "pt"Language to use for OCR text extraction
use_cacheoptionalbooleanUse cached results if available
wait_for_modeloptionalbooleanWait for model to load if not ready

language_translation

Language Translation. Translate text between languages using specialized Hugging Face translation models

InputTypeDescription
modelrequiredid (picked from your account)Select a translation model or search from 7000+ available models
customModeloptionaltextAlternative: Enter any Hugging Face translation model ID directly (e.g., Helsinki-NLP/opus-mt-ja-en)
textrequiredlong textThe text content you want to translate
sourceLanguageoptionaltextSource language code (e.g., "en", "es", "fr"). Only needed for multilingual models that support multiple language pairs.
targetLanguageoptionaltextTarget language code (e.g., "fr", "de", "zh"). Only needed for multilingual models that support multiple language pairs.
cleanUpSpacesoptionalbooleanRemove potential extra spaces in the translation output
maxLengthoptionalnumberMaximum length of the translated text (leave empty for default)
useCacheoptionalbooleanUse cached results if available for faster responses
waitForModeloptionalbooleanWait 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

InputTypeDescription
useCaserequiredone of "general" | "documents" | "security" | "business" | "search"What type of object detection do you need?
modelrequiredid (picked from your account)Select the best model for your detection task
imagerequiredfileUpload an image for object detection. Supports JPG, PNG, WebP formats.
confidenceThresholdoptionalnumberMinimum confidence score for detections (0.1-0.9). Higher values = fewer but more accurate detections.
maxDetectionsoptionalnumberMaximum number of objects to detect (1-100)
filterSettingsoptionalone of "high_confidence" | "balanced" | "all_results" | "custom"How to handle detection results
outputFormatoptionalone 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

InputTypeDescription
contentTyperequiredone of "news" | "email" | "meeting" | "general" | "medical" | "multilingual" | "search"What type of content are you summarizing?
modelrequiredid (picked from your account)Select the best model for your content type
textrequiredlong textThe long text content you want to summarize (most models work best with 512-1024 tokens)
summaryLengthoptionalone of "brief" | "medium" | "detailed" | "custom"How long should the summary be?
customMinLengthoptionalnumberMinimum number of tokens for the summary
customMaxLengthoptionalnumberMaximum number of tokens for the summary
cleanUpSpacesoptionalbooleanRemove extra spaces and clean up formatting
truncationStrategyoptionalone of "do_not_truncate" | "longest_first" | "only_first" | "only_second"How to handle text that exceeds model limits
useCacheoptionalbooleanUse cached results for faster responses
waitForModeloptionalbooleanWait 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