Class HuggingfaceChatModel
java.lang.Object
org.springframework.ai.huggingface.HuggingfaceChatModel
- All Implemented Interfaces:
ChatModel, StreamingChatModel, Model<Prompt, ChatResponse>, StreamingModel<Prompt, ChatResponse>
-
Constructor Summary
ConstructorsConstructorDescriptionHuggingfaceChatModel(String apiToken, String basePath) Constructs a new HuggingfaceChatModel with the specified API token and base path. -
Method Summary
Modifier and TypeMethodDescriptionGenerate text based on the provided prompt.intGets the maximum number of new tokens to be generated.voidsetMaxNewTokens(int maxNewTokens) Sets the maximum number of new tokens to be generated.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChatModel
call, call, getDefaultOptions, streamMethods inherited from interface StreamingChatModel
stream, stream
-
Constructor Details
-
HuggingfaceChatModel
-
-
Method Details
-
call
Generate text based on the provided prompt. -
getMaxNewTokens
public int getMaxNewTokens()Gets the maximum number of new tokens to be generated.- Returns:
- The maximum number of new tokens.
-
setMaxNewTokens
public void setMaxNewTokens(int maxNewTokens) Sets the maximum number of new tokens to be generated.- Parameters:
maxNewTokens- The maximum number of new tokens.
-