1 line
237 KiB
JSON
1 line
237 KiB
JSON
{"repo": "ardoco/lissa", "files": {"src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelProvider.java": {"dafb8c023a19b6d8522072c02e5d9b3aa2f37405": {"t": 1785745661.5982745, "n": 12078, "h": "cadf239fe4a1d709", "c": "/* Licensed under MIT 2025-2026. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.CacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.classifier.ClassifierCacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static ChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n return new LazyChatModel(() -> {\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n });\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build());\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, CacheParameter)\n */\n public ClassifierCacheParameter cacheParameters() {\n return new ClassifierCacheParameter(modelName, seed, temperature);\n }\n}\n"}, "df1196f197d9570debbeb90d923e7ade870066c8": {"t": 1785755516.1953616, "n": 12078, "h": "cadf239fe4a1d709", "c": "/* Licensed under MIT 2025-2026. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.CacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.classifier.ClassifierCacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static ChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n return new LazyChatModel(() -> {\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n });\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build());\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new LazyChatModel(() -> new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build());\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, CacheParameter)\n */\n public ClassifierCacheParameter cacheParameters() {\n return new ClassifierCacheParameter(modelName, seed, temperature);\n }\n}\n"}, "5d359fa45f3e3d5ac79070bba2512945ace054eb": {"t": 1785755521.4055736, "n": 11892, "h": "fe6ac6214b23d7f3", "c": "/* Licensed under MIT 2025-2026. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.CacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.cache.classifier.ClassifierCacheParameter;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, CacheParameter)\n */\n public ClassifierCacheParameter cacheParameters() {\n return new ClassifierCacheParameter(modelName, seed, temperature);\n }\n}\n"}, "256f335f07d4648c48fd1bc61ec86ab6e0882095": {"t": 1785755524.1393385, "n": 11973, "h": "bcc4cf21b3f6aa2a", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "4779b17190b255e2e157585cc78f4bea565e6f79": {"t": 1785755526.131092, "n": 12329, "h": "ef95fc15a84208cd", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\nimport java.util.SortedMap;\nimport java.util.TreeMap;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return A sorted map of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public SortedMap<String, String> getCacheParameters() {\n // TODO be real careful here (downward) and consider if you actually need this\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new TreeMap<>(Map.of(\"modelName\", modelName(), \"seed\", String.valueOf(seed())));\n } else {\n return new TreeMap<>(Map.of(\n \"modelName\",\n modelName(),\n \"seed\",\n String.valueOf(seed()),\n \"temperature\",\n String.valueOf(temperature())));\n }\n }\n}\n"}, "f64f6afbbe9a030a956b0e68401ac1a5924c5759": {"t": 1785755527.6168985, "n": 12242, "h": "4f41b671ca93f2ec", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\nimport java.util.SortedMap;\nimport java.util.TreeMap;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return A sorted map of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public SortedMap<String, String> getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new TreeMap<>(Map.of(\"modelName\", modelName(), \"seed\", String.valueOf(seed())));\n } else {\n return new TreeMap<>(Map.of(\n \"modelName\",\n modelName(),\n \"seed\",\n String.valueOf(seed()),\n \"temperature\",\n String.valueOf(temperature())));\n }\n }\n}\n"}, "4007e2a699b8ebc2d900397b8435723e20ffe1a2": {"t": 1785755529.098808, "n": 12145, "h": "63833ef8a35afb65", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return A map of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public Map<String, String> getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return Map.of(\"modelName\", modelName(), \"seed\", String.valueOf(seed()));\n } else {\n return Map.of(\n \"modelName\",\n modelName(),\n \"seed\",\n String.valueOf(seed()),\n \"temperature\",\n String.valueOf(temperature()));\n }\n }\n}\n"}, "b299aaee1c6e3c228aa639cf86534df78ad3264d": {"t": 1785755530.3524525, "n": 12304, "h": "14bdf4096f429a5c", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * Time in minutes before an Ollama request times out.\n */\n public static final int OLLAMA_MINUTES_TO_TIMEOUT = 10;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(OLLAMA_MINUTES_TO_TIMEOUT))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return A map of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public Map<String, String> getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return Map.of(\"modelName\", modelName(), \"seed\", String.valueOf(seed()));\n } else {\n return Map.of(\n \"modelName\",\n modelName(),\n \"seed\",\n String.valueOf(seed()),\n \"temperature\",\n String.valueOf(temperature()));\n }\n }\n}\n"}, "2ba78934352f3cc60711b697052c78fe6707d089": {"t": 1785755531.836006, "n": 11973, "h": "bcc4cf21b3f6aa2a", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .timeout(Duration.ofMinutes(10))\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "e5d6cb5fd38deb245c7fb62690d25cbb35680e6f": {"t": 1785755533.4473546, "n": 11924, "h": "db0f477c41bd619a", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n * <p>\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "1a2f0bb32ba6fd852c32d6a18fc5b0b0f0ef62e9": {"t": 1785755534.9618816, "n": 11920, "h": "0246f5730c66f627", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n *\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * <li>DeepSeek:\n * <ul>\n * <li>{@code DEEPSEEK_API_KEY}: Your DeepSeek API key</li>\n * </ul>\n * </li>\n * <li>Open WebUI:\n * <ul>\n * <li>{@code OPENWEBUI_URL}: The URL for the Open WebUI server</li>\n * <li>{@code OPENWEBUI_API_KEY}: Your Open WebUI API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n case OPENWEBUI -> createOpenWebUIChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n if (host == null) {\n throw new IllegalStateException(\"OLLAMA_HOST environment variable not set\");\n }\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates an Open WebUI chat model instance.\n * Requires Open WebUI API key and url to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Open WebUI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static ChatModel createOpenWebUIChatModel(String model, int seed, double temperature) {\n String openwebuiUrl = Environment.getenv(\"OPENWEBUI_URL\");\n String openwebuiApiKey = Environment.getenv(\"OPENWEBUI_API_KEY\");\n if (openwebuiUrl == null || openwebuiApiKey == null) {\n throw new IllegalStateException(\"OPENWEBUI_URL or OPENWEBUI_API_KEY environment variable not set\");\n }\n\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(openwebuiUrl)\n .modelName(model)\n .apiKey(openwebuiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "445bb7de9619f909b67f44d42003459e603142c8": {"t": 1785755536.4445326, "n": 10236, "h": "5cd695d31fda1e2e", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n *\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server (optional)</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * </ul>\n *\n * @see ChatLanguageModelPlatform\n */\npublic class ChatLanguageModelProvider {\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final ChatLanguageModelPlatform platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n this.platform = ChatLanguageModelPlatform.fromModuleConfiguration(configuration);\n this.initPlatformParameters(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initPlatformParameters(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = configuration.argumentAsString(modelKey, platform.getDefaultModel());\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return ChatLanguageModelPlatform.fromModuleConfiguration(configuration).getThreads();\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "e2d98a109397170b9ff3edc74af278649ac5d208": {"t": 1785755537.9968271, "n": 11210, "h": "f7fb0e7764861e1e", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n *\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server (optional)</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * </ul>\n */\npublic class ChatLanguageModelProvider {\n /**\n * Identifier for the OpenAI platform.\n */\n public static final String OPENAI = \"openai\";\n\n /**\n * Identifier for the Ollama platform.\n */\n public static final String OLLAMA = \"ollama\";\n\n /**\n * Identifier for the Blablador platform.\n */\n public static final String BLABLADOR = \"blablador\";\n\n /**\n * Identifier for the DeepSeek platform.\n */\n public static final String DEEPSEEK = \"deepseek\";\n\n /**\n * Default seed value for model.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * Default temperature setting for the model.\n */\n public static final double DEFAULT_TEMPERATURE = 0.0;\n\n /**\n * The platform to use for the language model.\n */\n private final String platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Temperature setting for the model.\n */\n private double temperature;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed, temperature);\n case OLLAMA -> createOllamaChatModel(modelName, seed, temperature);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed, temperature);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed, temperature);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n this.temperature = configuration.argumentAsDouble(\"temperature\", DEFAULT_TEMPERATURE);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Gets the temperature setting for the model.\n *\n * @return The temperature value\n */\n public double temperature() {\n return temperature;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR) ? 100 : 1;\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed, double temperature) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(temperature)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed, double temperature) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed, double temperature) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @param temperature The temperature setting for the model\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed, double temperature) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(temperature)\n .seed(seed)\n .build();\n }\n\n /**\n * Returns the parameters used to create the cache key for this model.\n * This method is used to identify the cache uniquely.\n *\n * @return An array of strings representing the cache parameters\n * @see edu.kit.kastel.sdq.lissa.ratlr.cache.CacheManager#getCache(Object, String[])\n */\n public String[] getCacheParameters() {\n if (temperature == 0.0) {\n // Backwards compatibility with the old mode that did not have temperature\n return new String[] {modelName(), String.valueOf(seed())};\n } else {\n return new String[] {modelName(), String.valueOf(seed()), String.valueOf(temperature())};\n }\n }\n}\n"}, "9074decbf7b5796488a54e979e69087048eae602": {"t": 1785755539.775361, "n": 9627, "h": "68a6acaaf11dd274", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n *\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server (optional)</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * </ul>\n */\npublic class ChatLanguageModelProvider {\n /**\n * Identifier for the OpenAI platform.\n */\n public static final String OPENAI = \"openai\";\n\n /**\n * Identifier for the Ollama platform.\n */\n public static final String OLLAMA = \"ollama\";\n\n /**\n * Identifier for the Blablador platform.\n */\n public static final String BLABLADOR = \"blablador\";\n\n /**\n * Identifier for the DeepSeek platform.\n */\n public static final String DEEPSEEK = \"deepseek\";\n\n /**\n * Default seed value for model randomization.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * The platform to use for the language model.\n */\n private final String platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n case DEEPSEEK -> createDeepSeekChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR) ? 100 : 1;\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a DeepSeek chat model instance.\n * Requires DeepSeek API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured DeepSeek chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createDeepSeekChatModel(String model, int seed) {\n String deepseekApiKey = Environment.getenv(\"DEEPSEEK_API_KEY\");\n if (deepseekApiKey == null) {\n throw new IllegalStateException(\"DEEPSEEK_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.deepseek.com/v1\")\n .modelName(model)\n .apiKey(deepseekApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "66d08b33c5c6d68a846194716e7daf0b019772a7": {"t": 1785755541.6347256, "n": 8476, "h": "3abbcf60492a44d5", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\n/**\n * Provides chat language model instances for different platforms.\n * This class supports multiple language model platforms (OpenAI, Ollama, Blablador)\n * and handles their configuration, including authentication and model settings.\n *\n * Required environment variables for each platform:\n * <ul>\n * <li>OpenAI:\n * <ul>\n * <li>{@code OPENAI_ORGANIZATION_ID}: Your OpenAI organization ID</li>\n * <li>{@code OPENAI_API_KEY}: Your OpenAI API key</li>\n * </ul>\n * </li>\n * <li>Ollama:\n * <ul>\n * <li>{@code OLLAMA_HOST}: The host URL for the Ollama server (optional)</li>\n * <li>{@code OLLAMA_USER}: Username for Ollama authentication (optional)</li>\n * <li>{@code OLLAMA_PASSWORD}: Password for Ollama authentication (optional)</li>\n * </ul>\n * </li>\n * <li>Blablador:\n * <ul>\n * <li>{@code BLABLADOR_API_KEY}: Your Blablador API key</li>\n * </ul>\n * </li>\n * </ul>\n */\npublic class ChatLanguageModelProvider {\n /**\n * Identifier for the OpenAI platform.\n */\n public static final String OPENAI = \"openai\";\n\n /**\n * Identifier for the Ollama platform.\n */\n public static final String OLLAMA = \"ollama\";\n\n /**\n * Identifier for the Blablador platform.\n */\n public static final String BLABLADOR = \"blablador\";\n\n /**\n * Default seed value for model randomization.\n */\n public static final int DEFAULT_SEED = 133742243;\n\n /**\n * The platform to use for the language model.\n */\n private final String platform;\n\n /**\n * The name of the model to use.\n */\n private String modelName;\n\n /**\n * The seed value for model randomization.\n */\n private int seed;\n\n /**\n * Creates a new chat language model provider with the specified configuration.\n * The configuration name should be in the format \"mode_platform\" (e.g., \"simple_openai\").\n *\n * @param configuration The module configuration containing model settings\n */\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n /**\n * Creates a chat model instance based on the configured platform.\n *\n * @return A chat model instance for the configured platform\n * @throws IllegalArgumentException If the platform is not supported\n */\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n /**\n * Initializes the model platform settings from the configuration.\n * Sets the model name and seed value based on the platform.\n *\n * @param configuration The module configuration containing model settings\n * @throws IllegalArgumentException If the platform is not supported\n */\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n /**\n * Gets the name of the configured model.\n *\n * @return The model name\n */\n public String modelName() {\n return modelName;\n }\n\n /**\n * Gets the seed value used for model randomization.\n *\n * @return The seed value\n */\n public int seed() {\n return seed;\n }\n\n /**\n * Determines the number of threads to use based on the platform.\n * OpenAI and Blablador platforms use 100 threads, while others use 1.\n *\n * @param configuration The module configuration\n * @return The number of threads to use\n */\n public static int threads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR) ? 100 : 1;\n }\n\n /**\n * Creates an Ollama chat model instance.\n * The model is configured with authentication if credentials are provided.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured Ollama chat model instance\n */\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n /**\n * Creates an OpenAI chat model instance.\n * Requires OpenAI organization ID and API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured OpenAI chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n /**\n * Creates a Blablador chat model instance.\n * Requires Blablador API key to be set in environment variables.\n *\n * @param model The name of the model to use\n * @param seed The seed value for randomization\n * @return A configured Blablador chat model instance\n * @throws IllegalStateException If required environment variables are not set\n */\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "69c50fd1bca55ba30da98be3d314fa7c1f8c32c0": {"t": 1785755543.1827674, "n": 4718, "h": "10081c20979737cd", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static int threads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR) ? 100 : 1;\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "8acb60ea4bb46d293243b6e7ca3ff569aec72463": {"t": 1785755544.944935, "n": 4717, "h": "6d60f5c7c10cfa3a", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static int threads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR) ? 100 : 1;\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \"\n + Base64.getEncoder()\n .encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "2f12fc62954e25e2f296baeabe32d4bac2522822": {"t": 1785755546.4275522, "n": 4654, "h": "b6fb056cf40b24cc", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n \"Basic \" + Base64.getEncoder().encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "a3f63dcff3d737e7034b03d44f45514ed8a7e7ac": {"t": 1785755548.0230799, "n": 4643, "h": "a272793d6005269f", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.util.Base64;\nimport java.util.Map;\n\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\n \"Authorization\",\n Base64.getEncoder().encodeToString((user + \":\" + password).getBytes(StandardCharsets.UTF_8))));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "5604e13370982ee23915b187bc2be71dba43bdc7": {"t": 1785755549.8359704, "n": 4520, "h": "88236af042d549da", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI) || configuration.name().contains(BLABLADOR);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "dea49f1d88131b8820d3b076dbd2dfa2337bbe99": {"t": 1785755551.4729037, "n": 4562, "h": "a7b3fb1f89af09ee", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String modelName;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(modelName, seed);\n case OLLAMA -> createOllamaChatModel(modelName, seed);\n case BLABLADOR -> createBlabladorChatModel(modelName, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n final String modelKey = \"model\";\n this.modelName = switch (platform) {\n case OPENAI -> configuration.argumentAsString(modelKey, \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(modelKey, \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(modelKey, \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return modelName;\n }\n\n public int seed() {\n return seed;\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI);\n }\n\n public boolean supportsThreads() {\n return platform.equals(OPENAI);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "b6ce91b95751f75bcd5c1bf95830fcf43cb4a4f6": {"t": 1785755552.8180852, "n": 4569, "h": "2e91a245afdaf35e", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n public static final String BLABLADOR = \"blablador\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n case BLABLADOR -> createBlabladorChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n case BLABLADOR -> configuration.argumentAsString(\"model\", \"2 - Llama 3.3 70B instruct\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n public int seed() {\n return seed;\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI);\n }\n\n public boolean supportsThreads() {\n return platform.equals(OPENAI);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n\n private static OpenAiChatModel createBlabladorChatModel(String model, int seed) {\n String blabladorApiKey = Environment.getenv(\"BLABLADOR_API_KEY\");\n if (blabladorApiKey == null) {\n throw new IllegalStateException(\"BLABLADOR_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .baseUrl(\"https://api.helmholtz-blablador.fz-juelich.de/v1\")\n .modelName(model)\n .apiKey(blabladorApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "64b7f35c04ed6794f4c3f27298fd0603d23f94fd": {"t": 1785755554.4491763, "n": 3680, "h": "5cc64e0330def68d", "c": "/* Licensed under MIT 2025. */\npackage edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.configuration.ModuleConfiguration;\nimport edu.kit.kastel.sdq.lissa.ratlr.utils.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n public static boolean supportsThreads(ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI);\n }\n\n public boolean supportsThreads() {\n return platform.equals(OPENAI);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "357db4b5dad013a86d79db939e8153c63a5cdb7c": {"t": 1785755556.2041814, "n": 3665, "h": "e1293543061894bb", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n public static boolean supportsThreads(Configuration.ModuleConfiguration configuration) {\n return configuration.name().contains(OPENAI);\n }\n\n public boolean supportsThreads() {\n return platform.equals(OPENAI);\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "12a6e44580e585dc98ae6811975cfde566978253": {"t": 1785755558.4674878, "n": 3425, "h": "b3de3aebd6c999d2", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(15))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "57c6f433b9f884361cd48805030b0f134d2e2a08": {"t": 1785755559.950065, "n": 3425, "h": "8ac2670623e56b0a", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(10))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "be73f0c6dc656e383e81c93cea3d91eeb25efe7b": {"t": 1785755561.7409353, "n": 3424, "h": "9566b3f29348d81b", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(5))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "07baad0e0afb868beb4c40538332386ecededd9a": {"t": 1785755563.2058136, "n": 3415, "h": "c55705b07c880d7a", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n public static final int DEFAULT_SEED = 133742243;\n\n private final String platform;\n private String model;\n private int seed;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model, seed);\n case OLLAMA -> createOllamaChatModel(model, seed);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);};\n this.seed = configuration.argumentAsInt(\"seed\", DEFAULT_SEED);\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model, int seed) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(5))\n .temperature(0.0)\n .seed(seed);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model, int seed) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .seed(seed)\n .build();\n }\n}\n"}, "0141296c764d915d95723b9c5945cb10cbe6e036": {"t": 1785755564.7875483, "n": 3179, "h": "28bc368f978fcedf", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n private final String platform;\n private String model;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model);\n case OLLAMA -> createOllamaChatModel(model);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);};\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder()\n .baseUrl(host)\n .modelName(model)\n .timeout(Duration.ofMinutes(5))\n .temperature(0.0);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder()\n .modelName(model)\n .organizationId(openAiOrganizationId)\n .apiKey(openAiApiKey)\n .temperature(0.0)\n .build();\n }\n}\n"}, "3036b9b8573aeea1df42db5397be91cbcba20aa0": {"t": 1785755566.2729356, "n": 3035, "h": "14ddc2f7738d3252", "c": "package edu.kit.kastel.sdq.lissa.ratlr.classifier;\n\nimport dev.langchain4j.model.chat.ChatLanguageModel;\nimport dev.langchain4j.model.ollama.OllamaChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\nimport edu.kit.kastel.sdq.lissa.ratlr.Configuration;\nimport edu.kit.kastel.sdq.lissa.ratlr.Environment;\nimport okhttp3.Credentials;\n\nimport java.time.Duration;\nimport java.util.Map;\nimport java.util.Objects;\n\npublic class ChatLanguageModelProvider {\n public static final String OPENAI = \"openai\";\n public static final String OLLAMA = \"ollama\";\n\n private final String platform;\n private String model;\n\n public ChatLanguageModelProvider(Configuration.ModuleConfiguration configuration) {\n String[] modeXplatform = configuration.name().split(Classifier.CONFIG_NAME_SEPARATOR, 2);\n if (modeXplatform.length == 1) {\n this.platform = null;\n return;\n }\n this.platform = modeXplatform[1];\n initModelPlatform(configuration);\n }\n\n public ChatLanguageModel createChatModel() {\n return switch (platform) {\n case OPENAI -> createOpenAiChatModel(model);\n case OLLAMA -> createOllamaChatModel(model);\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n private void initModelPlatform(Configuration.ModuleConfiguration configuration) {\n this.model = switch (platform) {\n case OPENAI -> configuration.argumentAsString(\"model\", \"gpt-4o-mini\");\n case OLLAMA -> configuration.argumentAsString(\"model\", \"llama3:8b\");\n default -> throw new IllegalArgumentException(\"Unsupported platform: \" + platform);\n };\n }\n\n public String modelName() {\n return Objects.requireNonNull(model, \"Model not initialized\");\n }\n\n private static OllamaChatModel createOllamaChatModel(String model) {\n String host = Environment.getenv(\"OLLAMA_HOST\");\n String user = Environment.getenv(\"OLLAMA_USER\");\n String password = Environment.getenv(\"OLLAMA_PASSWORD\");\n\n var ollama = OllamaChatModel.builder().baseUrl(host).modelName(model).timeout(Duration.ofMinutes(5)).temperature(0.0);\n if (user != null && password != null && !user.isEmpty() && !password.isEmpty()) {\n ollama.customHeaders(Map.of(\"Authorization\", Credentials.basic(user, password)));\n }\n return ollama.build();\n }\n\n private static OpenAiChatModel createOpenAiChatModel(String model) {\n String openAiOrganizationId = Environment.getenv(\"OPENAI_ORGANIZATION_ID\");\n String openAiApiKey = Environment.getenv(\"OPENAI_API_KEY\");\n if (openAiOrganizationId == null || openAiApiKey == null) {\n throw new IllegalStateException(\"OPENAI_ORGANIZATION_ID or OPENAI_API_KEY environment variable not set\");\n }\n return new OpenAiChatModel.OpenAiChatModelBuilder().modelName(model).organizationId(openAiOrganizationId).apiKey(openAiApiKey).temperature(0.0).build();\n }\n}\n"}}}} |