Class OpenAiChatModel
java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.spring.OpenAiChatModel
- All Implemented Interfaces:
org.springframework.ai.chat.model.ChatModel,org.springframework.ai.chat.model.StreamingChatModel,org.springframework.ai.model.Model<org.springframework.ai.chat.prompt.Prompt,,org.springframework.ai.chat.model.ChatResponse> org.springframework.ai.model.StreamingModel<org.springframework.ai.chat.prompt.Prompt,org.springframework.ai.chat.model.ChatResponse>
OpenAI Chat Model implementation that interacts with the OpenAI API to generate chat completions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.ai.chat.model.ChatResponsecall(org.springframework.ai.chat.prompt.Prompt prompt) protected static OpenAiChatCompletionRequestextractOptions(OpenAiChatCompletionRequest request, org.springframework.ai.chat.prompt.ChatOptions options) Adds options to the request.reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse> stream(org.springframework.ai.chat.prompt.Prompt prompt) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.chat.model.ChatModel
call, call, getDefaultOptionsMethods inherited from interface org.springframework.ai.chat.model.StreamingChatModel
stream, stream
-
Constructor Details
-
OpenAiChatModel
-
-
Method Details
-
call
@Nonnull public org.springframework.ai.chat.model.ChatResponse call(@Nonnull org.springframework.ai.chat.prompt.Prompt prompt) - Specified by:
callin interfaceorg.springframework.ai.chat.model.ChatModel- Specified by:
callin interfaceorg.springframework.ai.model.Model<org.springframework.ai.chat.prompt.Prompt,org.springframework.ai.chat.model.ChatResponse>
-
stream
@Nonnull public reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse> stream(@Nonnull org.springframework.ai.chat.prompt.Prompt prompt) - Specified by:
streamin interfaceorg.springframework.ai.chat.model.ChatModel- Specified by:
streamin interfaceorg.springframework.ai.chat.model.StreamingChatModel- Specified by:
streamin interfaceorg.springframework.ai.model.StreamingModel<org.springframework.ai.chat.prompt.Prompt,org.springframework.ai.chat.model.ChatResponse>
-
extractOptions
@Nonnull protected static OpenAiChatCompletionRequest extractOptions(@Nonnull OpenAiChatCompletionRequest request, @Nonnull org.springframework.ai.chat.prompt.ChatOptions options) Adds options to the request.- Parameters:
request- the request to modifyoptions- the options to extract- Returns:
- the modified request with options applied
-