Class AsyncRawPromise
java.lang.Object
bg.codexio.ai.openai.api.sdk.chat.ChatConfigurationStage
bg.codexio.ai.openai.api.sdk.chat.AsyncRawPromise
Promise abstraction.
Accepts callbacks which will be called
when response is received.
-
Field Summary
Fields inherited from class bg.codexio.ai.openai.api.sdk.chat.ChatConfigurationStage
executor, requestBuilder -
Method Summary
Modifier and TypeMethodDescriptionvoidonEachLine(Consumer<String> onEachLine) Subscribe to each line (whether streamed or from the whole response)voidSubscribe to the whole response when all lines are supplied.voidthen(Consumer<String> onEachLine, Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse) Subscribe both to each line (whether streamed or from the whole response) and to the whole response when all lines are supplied.
-
Method Details
-
then
public void then(Consumer<String> onEachLine, Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse) Subscribe both to each line (whether streamed or from the whole response) and to the whole response when all lines are supplied.- Parameters:
onEachLine- callback that accepts each response line as a stringonResponse- callback that accepts theChatMessageResponse
-
onEachLine
Subscribe to each line (whether streamed or from the whole response)- Parameters:
onEachLine- callback that accepts each response line as a string
-
then
public void then(Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse) Subscribe to the whole response when all lines are supplied.- Parameters:
onResponse- callback that accepts theChatMessageResponse
-