Interface HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder
- All Superinterfaces:
ComponentBuilder<org.apache.camel.component.huggingface.HuggingFaceComponent>
- All Known Implementing Classes:
HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilderImpl
- Enclosing interface:
HuggingfaceComponentBuilderFactory
public static interface HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder
extends ComponentBuilder<org.apache.camel.component.huggingface.HuggingFaceComponent>
Builder for the Hugging Face component.
-
Method Summary
Modifier and TypeMethodDescriptionHF API token for private models.autoSelect(boolean autoSelect) If true, auto-select the best label (highest score) for zero-shot classification.autowiredEnabled(boolean autowiredEnabled) Whether autowiring is enabled.configuration(org.apache.camel.component.huggingface.HuggingFaceConfiguration configuration) The configuration.Device for inference (cpu, gpu, auto).healthCheckConsumerEnabled(boolean healthCheckConsumerEnabled) Used for enabling or disabling all consumer based health checks from this component.healthCheckProducerEnabled(boolean healthCheckProducerEnabled) Used for enabling or disabling all producer based health checks from this component.lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message).maxTokens(int maxTokens) Max tokens for generation tasks.memoryIdHeader(String memoryIdHeader) Header name for conversation memory ID (for multi-user chats).minLength(int minLength) Min tokens for summarization tasks.Hugging Face model ID (e.g., distilbert-base-uncased-finetuned-sst-2-english).modelLoadingTimeout(int modelLoadingTimeout) Model loading timeout in seconds, if negative then use default (240 seconds).multiLabel(boolean multiLabel) Allow multi-label classifications for zero-shot tasks.oauthProfile(String oauthProfile) OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant.pooling(boolean pooling) Whether to pool the predictor (keep the Python process alive) or create a new one for each request.predictorBean(String predictorBean) Bean name of a custom TaskPredictor implementation (for tasks not covered by built-in predictors).predictTimeout(int predictTimeout) Predict timeout in seconds, if negative then use default (120 seconds).Model revision or branch (default: main).systemPrompt(String systemPrompt) Initial system prompt for chat tasks (e.g., 'You are a helpful assistant named Alan.').temperature(float temperature) Temperature for sampling (0.0-1.0).topK(int topK) Top-k parameter for classification tasks.Role for user messages in chat history (e.g., 'user' or 'human').Methods inherited from interface ComponentBuilder
build, build, doSetProperty, register
-
Method Details
-
authToken
HF API token for private models. The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
authToken- the value to set- Returns:
- the dsl builder
-
autoSelect
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder autoSelect(boolean autoSelect) If true, auto-select the best label (highest score) for zero-shot classification. The option is a: <code>boolean</code> type. Default: true Group: producer- Parameters:
autoSelect- the value to set- Returns:
- the dsl builder
-
configuration
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder configuration(org.apache.camel.component.huggingface.HuggingFaceConfiguration configuration) The configuration. The option is a: <code>org.apache.camel.component.huggingface.HuggingFaceConfiguration</code> type. Group: producer- Parameters:
configuration- the value to set- Returns:
- the dsl builder
-
device
Device for inference (cpu, gpu, auto). The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
device- the value to set- Returns:
- the dsl builder
-
lazyStartProducer
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. The option is a: <code>boolean</code> type. Default: false Group: producer- Parameters:
lazyStartProducer- the value to set- Returns:
- the dsl builder
-
maxTokens
Max tokens for generation tasks. The option is a: <code>int</code> type. Group: producer- Parameters:
maxTokens- the value to set- Returns:
- the dsl builder
-
memoryIdHeader
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder memoryIdHeader(String memoryIdHeader) Header name for conversation memory ID (for multi-user chats). The option is a: <code>java.lang.String</code> type. Default: CamelChatMemoryId Group: producer- Parameters:
memoryIdHeader- the value to set- Returns:
- the dsl builder
-
minLength
Min tokens for summarization tasks. The option is a: <code>int</code> type. Group: producer- Parameters:
minLength- the value to set- Returns:
- the dsl builder
-
modelId
Hugging Face model ID (e.g., distilbert-base-uncased-finetuned-sst-2-english). The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
modelId- the value to set- Returns:
- the dsl builder
-
modelLoadingTimeout
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder modelLoadingTimeout(int modelLoadingTimeout) Model loading timeout in seconds, if negative then use default (240 seconds). The option is a: <code>int</code> type. Group: producer- Parameters:
modelLoadingTimeout- the value to set- Returns:
- the dsl builder
-
multiLabel
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder multiLabel(boolean multiLabel) Allow multi-label classifications for zero-shot tasks. The option is a: <code>boolean</code> type. Default: false Group: producer- Parameters:
multiLabel- the value to set- Returns:
- the dsl builder
-
pooling
Whether to pool the predictor (keep the Python process alive) or create a new one for each request. The option is a: <code>boolean</code> type. Default: true Group: producer- Parameters:
pooling- the value to set- Returns:
- the dsl builder
-
predictorBean
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder predictorBean(String predictorBean) Bean name of a custom TaskPredictor implementation (for tasks not covered by built-in predictors). The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
predictorBean- the value to set- Returns:
- the dsl builder
-
predictTimeout
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder predictTimeout(int predictTimeout) Predict timeout in seconds, if negative then use default (120 seconds). The option is a: <code>int</code> type. Group: producer- Parameters:
predictTimeout- the value to set- Returns:
- the dsl builder
-
revision
Model revision or branch (default: main). The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
revision- the value to set- Returns:
- the dsl builder
-
systemPrompt
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder systemPrompt(String systemPrompt) Initial system prompt for chat tasks (e.g., 'You are a helpful assistant named Alan.'). The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
systemPrompt- the value to set- Returns:
- the dsl builder
-
temperature
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder temperature(float temperature) Temperature for sampling (0.0-1.0). The option is a: <code>float</code> type. Group: producer- Parameters:
temperature- the value to set- Returns:
- the dsl builder
-
topK
Top-k parameter for classification tasks. The option is a: <code>int</code> type. Default: 5 Group: producer- Parameters:
topK- the value to set- Returns:
- the dsl builder
-
userRole
Role for user messages in chat history (e.g., 'user' or 'human'). The option is a: <code>java.lang.String</code> type. Default: user Group: producer- Parameters:
userRole- the value to set- Returns:
- the dsl builder
-
autowiredEnabled
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder autowiredEnabled(boolean autowiredEnabled) Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. The option is a: <code>boolean</code> type. Default: true Group: advanced- Parameters:
autowiredEnabled- the value to set- Returns:
- the dsl builder
-
healthCheckConsumerEnabled
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder healthCheckConsumerEnabled(boolean healthCheckConsumerEnabled) Used for enabling or disabling all consumer based health checks from this component. The option is a: <code>boolean</code> type. Default: true Group: health- Parameters:
healthCheckConsumerEnabled- the value to set- Returns:
- the dsl builder
-
healthCheckProducerEnabled
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder healthCheckProducerEnabled(boolean healthCheckProducerEnabled) Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. The option is a: <code>boolean</code> type. Default: true Group: health- Parameters:
healthCheckProducerEnabled- the value to set- Returns:
- the dsl builder
-
oauthProfile
default HuggingfaceComponentBuilderFactory.HuggingfaceComponentBuilder oauthProfile(String oauthProfile) OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider and used as authToken. Requires camel-oauth on the classpath. The option is a: <code>java.lang.String</code> type. Group: security- Parameters:
oauthProfile- the value to set- Returns:
- the dsl builder
-