Class ReactiveContextStage
java.lang.Object
bg.codexio.ai.openai.api.sdk.chat.ChatConfigurationStage
bg.codexio.ai.openai.api.sdk.chat.ReactiveContextStage
- All Implemented Interfaces:
RuntimeExecutor
Reactive context to choose between raw response or just
a simple string answer.
Strongly recommended to use this only if a true
reactive runtime is present, such as
Reactor Netty.
-
Field Summary
Fields inherited from class bg.codexio.ai.openai.api.sdk.chat.ChatConfigurationStage
executor, requestBuilder -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<String> Sends async request to OpenAI API.OpenAIHttpExecutor.ReactiveExecution<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> Sends async request to OpenAI API.
-
Method Details
-
askRaw
public OpenAIHttpExecutor.ReactiveExecution<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> askRaw(String... questions) Sends async request to OpenAI API. Notifies theOpenAIHttpExecutor.ReactiveExecution.lines()andOpenAIHttpExecutor.ReactiveExecution.response()when parts (and the whole) of the response is received. Do not subscribe simultaneously for both, as you may experience bugs with multiplexing.- Parameters:
questions- user supplied prompt- Returns:
OpenAIHttpExecutor.ReactiveExecution<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse>
-
ask
Sends async request to OpenAI API. Notifies theOpenAIHttpExecutor.ReactiveExecution.response()the whole response is received. Maps it only to the string answer.- Parameters:
questions- user supplied prompt- Returns:
reactor.core.publisher.Mono<String>holding the answer as a string
-