Update thinking tool model in integration tests

Replaced the 'deepseek-r1:1.5b' model with 'qwen3:0.6b' for thinking tool tests in OllamaAPIIntegrationTest. Also made minor formatting improvements to comments and string concatenations for better readability.
This commit is contained in:
amithkoujalgi 2025-09-20 00:02:52 +05:30
parent 5da9bc8626
commit 751b11881f
No known key found for this signature in database
GPG Key ID: E29A37746AF94B70

View File

@ -5,7 +5,7 @@
* Licensed under the MIT License (the "License"); * Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* *
*/ */
package io.github.ollama4j.integrationtests; package io.github.ollama4j.integrationtests;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@ -54,11 +54,13 @@ class OllamaAPIIntegrationTest {
private static final String EMBEDDING_MODEL = "all-minilm"; private static final String EMBEDDING_MODEL = "all-minilm";
private static final String VISION_MODEL = "moondream:1.8b"; private static final String VISION_MODEL = "moondream:1.8b";
private static final String THINKING_TOOL_MODEL = "deepseek-r1:1.5b"; private static final String THINKING_TOOL_MODEL = "deepseek-r1:1.5b";
private static final String THINKING_TOOL_MODEL_2 = "qwen3:0.6b";
private static final String GENERAL_PURPOSE_MODEL = "gemma3:270m"; private static final String GENERAL_PURPOSE_MODEL = "gemma3:270m";
private static final String TOOLS_MODEL = "mistral:7b"; private static final String TOOLS_MODEL = "mistral:7b";
@BeforeAll @BeforeAll
static void setUp() { static void setUp() {
// defaults
int requestTimeoutSeconds = 60; int requestTimeoutSeconds = 60;
int numberOfRetriesForModelPull = 5; int numberOfRetriesForModelPull = 5;
@ -101,10 +103,10 @@ class OllamaAPIIntegrationTest {
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"USE_EXTERNAL_OLLAMA_HOST is not set so, we will be using Testcontainers" "USE_EXTERNAL_OLLAMA_HOST is not set so, we will be using Testcontainers"
+ " Ollama host for the tests now. If you would like to use an external" + " Ollama host for the tests now. If you would like to use an external"
+ " host, please set the env var to USE_EXTERNAL_OLLAMA_HOST=true and" + " host, please set the env var to USE_EXTERNAL_OLLAMA_HOST=true and"
+ " set the env var OLLAMA_HOST=http://localhost:11435 or a different" + " set the env var OLLAMA_HOST=http://localhost:11435 or a different"
+ " host/port."); + " host/port.");
} }
} catch (Exception e) { } catch (Exception e) {
String ollamaVersion = "0.6.1"; String ollamaVersion = "0.6.1";
@ -318,8 +320,8 @@ class OllamaAPIIntegrationTest {
OllamaChatMessageRole.SYSTEM, OllamaChatMessageRole.SYSTEM,
String.format( String.format(
"[INSTRUCTION-START] You are an obidient and helpful bot" "[INSTRUCTION-START] You are an obidient and helpful bot"
+ " named %s. You always answer with only one word and" + " named %s. You always answer with only one word and"
+ " that word is your name. [INSTRUCTION-END]", + " that word is your name. [INSTRUCTION-END]",
expectedResponse)) expectedResponse))
.withMessage(OllamaChatMessageRole.USER, "Who are you?") .withMessage(OllamaChatMessageRole.USER, "Who are you?")
.withOptions(new OptionsBuilder().setTemperature(0.0f).build()) .withOptions(new OptionsBuilder().setTemperature(0.0f).build())
@ -685,9 +687,9 @@ class OllamaAPIIntegrationTest {
URISyntaxException, URISyntaxException,
InterruptedException, InterruptedException,
ToolInvocationException { ToolInvocationException {
api.pullModel(THINKING_TOOL_MODEL); api.pullModel(THINKING_TOOL_MODEL_2);
OllamaChatRequestBuilder builder = OllamaChatRequestBuilder builder =
OllamaChatRequestBuilder.getInstance(THINKING_TOOL_MODEL); OllamaChatRequestBuilder.getInstance(THINKING_TOOL_MODEL_2);
OllamaChatRequest requestModel = OllamaChatRequest requestModel =
builder.withMessage( builder.withMessage(
OllamaChatMessageRole.USER, OllamaChatMessageRole.USER,
@ -906,11 +908,11 @@ class OllamaAPIIntegrationTest {
"string") "string")
.description( .description(
"The name" "The name"
+ " of the" + " of the"
+ " employee," + " employee,"
+ " e.g." + " e.g."
+ " John" + " John"
+ " Doe") + " Doe")
.required( .required(
true) true)
.build()) .build())
@ -924,16 +926,16 @@ class OllamaAPIIntegrationTest {
"string") "string")
.description( .description(
"The address" "The address"
+ " of the" + " of the"
+ " employee," + " employee,"
+ " Always" + " Always"
+ " eturns" + " eturns"
+ " a random" + " a random"
+ " address." + " address."
+ " For example," + " For example,"
+ " Church" + " Church"
+ " St, Bengaluru," + " St, Bengaluru,"
+ " India") + " India")
.required( .required(
true) true)
.build()) .build())
@ -947,16 +949,16 @@ class OllamaAPIIntegrationTest {
"string") "string")
.description( .description(
"The phone" "The phone"
+ " number" + " number"
+ " of the" + " of the"
+ " employee." + " employee."
+ " Always" + " Always"
+ " returns" + " returns"
+ " a random" + " a random"
+ " phone" + " phone"
+ " number." + " number."
+ " For example," + " For example,"
+ " 9911002233") + " 9911002233")
.required( .required(
true) true)
.build()) .build())