Class OpenAiStreamingResponseBuilder
java.lang.Object
dev.langchain4j.model.openai.OpenAiStreamingResponseBuilder
This class needs to be thread safe because it is called when a streaming result comes back
and there is no guarantee that this thread will be the same as the one that initiated the request,
in fact it almost certainly won't be.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenAiStreamingResponseBuilder(boolean returnThinking) OpenAiStreamingResponseBuilder(boolean returnThinking, boolean accumulateToolCallId) -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(ChatCompletionResponse partialResponse) voidappend(CompletionResponse partialResponse) voidappend(ParsedAndRawResponse<ChatCompletionResponse> parsedAndRawResponse) build()Returns an error message if the provider sent an error inside the stream (e.g.
-
Constructor Details
-
OpenAiStreamingResponseBuilder
public OpenAiStreamingResponseBuilder() -
OpenAiStreamingResponseBuilder
public OpenAiStreamingResponseBuilder(boolean returnThinking) -
OpenAiStreamingResponseBuilder
public OpenAiStreamingResponseBuilder(boolean returnThinking, boolean accumulateToolCallId)
-
-
Method Details
-
append
-
append
-
append
-
errorMessage
Returns an error message if the provider sent an error inside the stream (e.g.data: {"error": {...}}), otherwisenull. -
build
-