| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public List | Returns: A list of model names, or an empty list if the fetch failsThe AI provider aiProvider, String The base URL for the API apiBaseUrl, @Nullable String The API key for authentication (may be null) apiKey)Synchronously fetches the list of available models from the API. |
| public List | Returns: A list of available model namesThe AI provider aiProvider, String The base URL for the API apiBaseUrl, @Nullable String The API key for authentication (may be null) apiKey)Gets the list of available models for the given provider. |
| public List | Returns: A list of available model namesThe AI provider aiProvider)Gets the list of available models for the given provider, using only hardcoded values. |
| public static boolean | isModelNotFound(Exception exception)
Servers report a model they do not have with a "not found" message, e.g., Ollama: |
| public String | Returns: the reply of the modelSends a minimal chat request, which verifies provider, model name, API key, and API base URL in one call. |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| modelProviders | back to summary |
|---|---|
| private final List<AiModelProvider> modelProviders | |
| AiModelService | back to summary |
|---|---|
| public AiModelService() | |
| fetchModelsSynchronously | back to summary |
|---|---|
| public List Synchronously fetches the list of available models from the API. This method will block until the fetch completes or the HTTP client times out. | |
| getAvailableModels | back to summary |
|---|---|
| public List Gets the list of available models for the given provider. First attempts to fetch models dynamically from the API. If that fails or times out, falls back to the hardcoded list. | |
| getStaticModels | back to summary |
|---|---|
| public List Gets the list of available models for the given provider, using only hardcoded values.
| |
| isModelNotFound | back to summary |
|---|---|
| public static boolean isModelNotFound(Exception exception) Servers report a model they do not have with a "not found" message, e.g., Ollama: | |
| testConnection | back to summary |
|---|---|
| public String testConnection(AiProvider aiProvider, String modelName, String apiKey, double temperature, String apiBaseUrl, int contextWindowSize, TokenEstimatorKind tokenEstimatorKind) Sends a minimal chat request, which verifies provider, model name, API key, and API base URL in one call. A chat request is used instead of listing models, because it works for every provider.
| |