Package com.tnsai.llm.providers
Class AbstractLLMClient
java.lang.Object
com.tnsai.llm.providers.AbstractLLMClient
- All Implemented Interfaces:
com.tnsai.llm.LLMClient
- Direct Known Subclasses:
AbstractOpenAICompatibleClient,AnthropicClient,CohereClient,GeminiClient,MiniMaxClient,OllamaClient,OpenAIClient,ReplicateClient,VertexAIClient,WatsonxClient,ZhipuAIClient
Abstract base class for LLM client implementations.
Provides common functionality for all LLM providers:
- Retry configuration with standard defaults
- Common retriable error detection
- Injectable HTTP client (defaults to shared instance)
- Standard model configuration fields
Usage
public class MyLLMClient extends AbstractLLMClient {
public MyLLMClient(String model, float temperature, Integer maxTokens, String apiKey) {
super(model, temperature, maxTokens, apiKey, "MY_API_KEY", "https://api.example.com");
}
@Override
public ChatResponse chat(String message, Optional<String> systemPrompt, ...) {
// Implementation
}
}
- Author:
- TnsAI Team
-
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.llm.LLMClient
chat, chat, chat, chat, chat, chat, getCapabilities, getProviderName, listModels, streamChat, streamChat, streamChat, streamChatWithHandler, streamChatWithHandler, streamChatWithSpec, streamChatWithSpec
-
Method Details
-
getBaseUrl
-
getCallTimeoutMs
public int getCallTimeoutMs() -
getModel
- Specified by:
getModelin interfacecom.tnsai.llm.LLMClient
-
getTemperature
public float getTemperature()- Specified by:
getTemperaturein interfacecom.tnsai.llm.LLMClient
-
getTopP
- Specified by:
getTopPin interfacecom.tnsai.llm.LLMClient
-
getMaxTokens
- Specified by:
getMaxTokensin interfacecom.tnsai.llm.LLMClient
-