Class LocalAiStreamingChatModel
- All Implemented Interfaces:
StreamingChatModel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voidchat(ChatRequest chatRequest, StreamingChatResponseHandler handler) This is the main API to interact with the chat model.voiddoChat(ChatRequest chatRequest, StreamingChatResponseHandler handler) Provider-specific implementation ofStreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler), which wraps it withChatModelListenerinvocation and failure reporting.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StreamingChatModel
chat, chat, chat, chat, chat, chat, chat, defaultRequestParameters, doChat, listeners, provider, supportedCapabilities
-
Constructor Details
-
LocalAiStreamingChatModel
@Deprecated(forRemoval=true, since="1.5.0") public LocalAiStreamingChatModel(String baseUrl, String modelName, Double temperature, Double topP, Integer maxTokens, Duration timeout, Boolean logRequests, Boolean logResponses) Deprecated, for removal: This API element is subject to removal in a future version. -
LocalAiStreamingChatModel
public LocalAiStreamingChatModel(LocalAiStreamingChatModel.LocalAiStreamingChatModelBuilder builder)
-
-
Method Details
-
chat
Description copied from interface:StreamingChatModelThis is the main API to interact with the chat model.This method does not throw: every failure, including an invalid request, is reported to
StreamingChatResponseHandler.onError(Throwable).onErrormay be called on the calling thread, before this method returns. IfonErroritself throws while a failure is reported on the calling thread, before this method returns, that exception is thrown from this method. If it throws on another thread, or after this method returned, the exception is logged. If the model implementation throws after the handler already received the complete response or an error, that exception is logged instead of being reported.- Specified by:
chatin interfaceStreamingChatModel- Parameters:
chatRequest- aChatRequest, containing all the inputs to the LLMhandler- aStreamingChatResponseHandlerthat will handle streaming response from the LLM; must not benull, otherwise anIllegalArgumentExceptionis thrown before anything is sent
-
doChat
Description copied from interface:StreamingChatModelProvider-specific implementation ofStreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler), which wraps it withChatModelListenerinvocation and failure reporting.An implementation may throw a failure that it finds before the request is sent, for example an invalid request:
StreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler)then reports it toStreamingChatResponseHandler.onError(Throwable). Every later failure goes tohandler.onError(...). An implementation does not need to care about what the user'sonErrorthrows: it never reaches the implementation. Core throws it fromchat(...)when it happens on the calling thread beforechat(...)returns, and logs it otherwise.- Specified by:
doChatin interfaceStreamingChatModel- Parameters:
chatRequest- the request, with the default request parameters of this model appliedhandler- the handler to send the streamed response and failures to
-
builder
-