Package org.springframework.ai.model
Interface Model<TReq extends ModelRequest<?>,TRes extends ModelResponse<?>>
- Type Parameters:
TReq
- the generic type of the request to the AI modelTRes
- the generic type of the response from the AI model
- All Known Subinterfaces:
ChatModel
,DocumentEmbeddingModel
,EmbeddingModel
,ImageModel
,ModerationModel
,SpeechModel
- All Known Implementing Classes:
AbstractEmbeddingModel
,AnthropicChatModel
,AzureOpenAiAudioTranscriptionModel
,AzureOpenAiChatModel
,AzureOpenAiEmbeddingModel
,AzureOpenAiImageModel
,BedrockAi21Jurassic2ChatModel
,BedrockAnthropic3ChatModel
,BedrockAnthropicChatModel
,BedrockCohereChatModel
,BedrockCohereEmbeddingModel
,BedrockLlamaChatModel
,BedrockTitanChatModel
,BedrockTitanEmbeddingModel
,HuggingfaceChatModel
,MiniMaxChatModel
,MiniMaxEmbeddingModel
,MistralAiChatModel
,MistralAiEmbeddingModel
,MoonshotChatModel
,OCIEmbeddingModel
,OllamaChatModel
,OllamaEmbeddingModel
,OpenAiAudioSpeechModel
,OpenAiAudioTranscriptionModel
,OpenAiChatModel
,OpenAiEmbeddingModel
,OpenAiImageModel
,OpenAiModerationModel
,PostgresMlEmbeddingModel
,QianFanChatModel
,QianFanEmbeddingModel
,QianFanImageModel
,StabilityAiImageModel
,TransformersEmbeddingModel
,VertexAiGeminiChatModel
,VertexAiMultimodalEmbeddingModel
,VertexAiPaLm2ChatModel
,VertexAiPaLm2EmbeddingModel
,VertexAiTextEmbeddingModel
,WatsonxAiChatModel
,WatsonxAiEmbeddingModel
,ZhiPuAiChatModel
,ZhiPuAiEmbeddingModel
,ZhiPuAiImageModel
public interface Model<TReq extends ModelRequest<?>,TRes extends ModelResponse<?>>
The Model interface provides a generic API for invoking AI models. It is designed to
handle the interaction with various types of AI models by abstracting the process of
sending requests and receiving responses. The interface uses Java generics to
accommodate different types of requests and responses, enhancing flexibility and
adaptability across different AI model implementations.
- Since:
- 0.8.0
- Author:
- Mark Pollack
-
Method Summary
-
Method Details
-
call
Executes a method call to the AI model.- Parameters:
request
- the request object to be sent to the AI model- Returns:
- the response from the AI model
-