Adds AnthropicClient with tool use, SSE streaming, and extended thinking behind an optional AnthropicDialect bean, plus ANTHROPIC model provider, request-shaping unit tests, and integration tests against an Anthropic-compatible server.
48 lines
1.4 KiB
Java
Executable File
48 lines
1.4 KiB
Java
Executable File
package de.extio.lmlib.profile;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
public record ModelProfile(
|
|
String prompt,
|
|
String tokenizer,
|
|
String tokenEncoding,
|
|
int maxTokens,
|
|
int maxContextLength,
|
|
double temperature,
|
|
double topP,
|
|
ModelProvider modelProvider,
|
|
String modelName,
|
|
String url,
|
|
String apiKey,
|
|
BigDecimal costPerInToken,
|
|
BigDecimal costPerCachedInToken,
|
|
BigDecimal costPerOutToken,
|
|
BigDecimal costPerReasoningOutToken,
|
|
String category) {
|
|
|
|
public ModelProfile {
|
|
if (maxTokens < 0) {
|
|
throw new IllegalArgumentException("Model profile maxTokens must be greater than or equal to zero");
|
|
}
|
|
if (maxContextLength < 0) {
|
|
throw new IllegalArgumentException("Model profile maxContextLength must be greater than or equal to zero");
|
|
}
|
|
if (temperature <= 0) {
|
|
throw new IllegalArgumentException("Model profile temperature must be greater than zero");
|
|
}
|
|
if (topP <= 0) {
|
|
throw new IllegalArgumentException("Model profile topP must be greater than zero");
|
|
}
|
|
if (modelProvider == null) {
|
|
throw new IllegalArgumentException("Model profile modelProvider is mandatory and cannot be null");
|
|
}
|
|
if (category == null || category.isBlank()) {
|
|
throw new IllegalArgumentException("Model profile category is mandatory and cannot be empty");
|
|
}
|
|
}
|
|
|
|
public static enum ModelProvider {
|
|
OAI_TEXT_COMPLETION, OAI_CHAT_COMPLETION, OAI_RESPONSES, OPENROUTER, OLLAMA, ANTHROPIC;
|
|
}
|
|
}
|