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
public class ReactiveContextStage extends ChatConfigurationStage implements 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<String>ask(String... questions)Sends async request to OpenAI API.OpenAIHttpExecutor.ReactiveExecution<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse>askRaw(String... questions)Sends async request to OpenAI API.
-
-
-
Method Detail
-
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
-
ask
public reactor.core.publisher.Mono<String> ask(String... questions)
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:
Monoholding the answer as a string
-
-