Class AsyncRawPromise
- java.lang.Object
-
- bg.codexio.ai.openai.api.sdk.chat.ChatConfigurationStage
-
- bg.codexio.ai.openai.api.sdk.chat.AsyncRawPromise
-
public class AsyncRawPromise extends ChatConfigurationStage
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonEachLine(Consumer<String> onEachLine)Subscribe to each line (whether streamed or from the whole response)voidthen(Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse)Subscribe 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 Detail
-
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
public void onEachLine(Consumer<String> 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
-
-