ChatModel instances.
Each call creates its own HttpClient and ExecutorService.
The returned model implements AutoCloseable; callers should close it
when it is no longer needed so the underlying resources are released.
Returns null when AI is disabled or the API key is empty.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Duration |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ChatModel | create(AiProvider provider, String modelName, String apiKey, double temperature, String baseUrl, int contextWindowSize, TokenEstimatorKind tokenEstimatorKind)
Creates a |
| public static ChatModel |
| CONNECTION_TIMEOUT | back to summary |
|---|---|
| private static final Duration CONNECTION_TIMEOUT | |
| ChatModelFactory | back to summary |
|---|---|
| private ChatModelFactory() | |
| create | back to summary |
|---|---|
| public static ChatModel create(AiProvider provider, String modelName, String apiKey, double temperature, String baseUrl, int contextWindowSize, TokenEstimatorKind tokenEstimatorKind) Creates a | |
| create | back to summary |
|---|---|
| public static ChatModel create(AiPreferences aiPreferences) | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final dev. | |
| private final ExecutorService | |
| private final HttpClient | |
| private final String | |
| private final AiProvider | |
| private final TokenEstimator |
| Access | Constructor and Description |
|---|---|
| pack-priv | ChatModelImpl(dev.
|
| Modifier and Type | Method and Description |
|---|---|
| public dev. | |
| public void | close()
Implements org. Closes this resource, relinquishing any underlying resources. |
| public AiProvider | |
| public int | |
| public String | |
| public TokenEstimator |
| contextWindowSize | back to summary |
|---|---|
| private final int contextWindowSize | |
| delegate | back to summary |
|---|---|
| private final dev. | |
| executorService | back to summary |
|---|---|
| private final ExecutorService executorService | |
| httpClient | back to summary |
|---|---|
| private final HttpClient httpClient | |
| name | back to summary |
|---|---|
| private final String name | |
| provider | back to summary |
|---|---|
| private final AiProvider provider | |
| tokenEstimator | back to summary |
|---|---|
| private final TokenEstimator tokenEstimator | |
| ChatModelImpl | back to summary |
|---|---|
| pack-priv ChatModelImpl(dev. | |
| chat | back to summary |
|---|---|
public dev.
| |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| getAiProvider | back to summary |
|---|---|
| public AiProvider getAiProvider() Implements org.
| |
| getContextWindowSize | back to summary |
|---|---|
| public int getContextWindowSize() Implements org.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements org.
| |
| getTokenizer | back to summary |
|---|---|
| public TokenEstimator getTokenizer() Implements org.
| |