mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-09-16 11:48:58 +02:00
Update workflow job names and refine integration tests
Added descriptive names to jobs in the GitHub Actions workflow for better clarity. In integration tests, replaced GENERAL_PURPOSE_MODEL with TOOLS_MODEL in relevant tests and adjusted logging within lambda expressions for improved output handling.
This commit is contained in:
parent
52d7dbd7ce
commit
6b69284497
3
.github/workflows/build-on-pull-request.yml
vendored
3
.github/workflows/build-on-pull-request.yml
vendored
@ -15,6 +15,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Build Java Project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@ -33,12 +34,14 @@ jobs:
|
|||||||
run: mvn --file pom.xml -U clean package
|
run: mvn --file pom.xml -U clean package
|
||||||
|
|
||||||
run-tests:
|
run-tests:
|
||||||
|
name: Run Unit and Integration Tests
|
||||||
needs: build
|
needs: build
|
||||||
uses: ./.github/workflows/run-tests.yml
|
uses: ./.github/workflows/run-tests.yml
|
||||||
with:
|
with:
|
||||||
branch: ${{ github.head_ref || github.ref_name }}
|
branch: ${{ github.head_ref || github.ref_name }}
|
||||||
|
|
||||||
build-docs:
|
build-docs:
|
||||||
|
name: Build Documentation
|
||||||
needs: [build, run-tests]
|
needs: [build, run-tests]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class OllamaAPIIntegrationTest {
|
|||||||
@Order(6)
|
@Order(6)
|
||||||
void testGenerateWithStructuredOutput()
|
void testGenerateWithStructuredOutput()
|
||||||
throws OllamaBaseException, IOException, InterruptedException, URISyntaxException {
|
throws OllamaBaseException, IOException, InterruptedException, URISyntaxException {
|
||||||
api.pullModel(GENERAL_PURPOSE_MODEL);
|
api.pullModel(TOOLS_MODEL);
|
||||||
|
|
||||||
String prompt = "The sun is shining brightly and is directly overhead at the zenith, casting my shadow over my foot, so it must be noon.";
|
String prompt = "The sun is shining brightly and is directly overhead at the zenith, casting my shadow over my foot, so it must be noon.";
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class OllamaAPIIntegrationTest {
|
|||||||
});
|
});
|
||||||
format.put("required", List.of("isNoon"));
|
format.put("required", List.of("isNoon"));
|
||||||
|
|
||||||
OllamaResult result = api.generate(GENERAL_PURPOSE_MODEL, prompt, format);
|
OllamaResult result = api.generate(TOOLS_MODEL, prompt, format);
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertNotNull(result.getResponse());
|
assertNotNull(result.getResponse());
|
||||||
@ -207,7 +207,6 @@ class OllamaAPIIntegrationTest {
|
|||||||
OllamaResult result = api.generate(GENERAL_PURPOSE_MODEL,
|
OllamaResult result = api.generate(GENERAL_PURPOSE_MODEL,
|
||||||
"What is the capital of France? And what's France's connection with Mona Lisa?", raw,
|
"What is the capital of France? And what's France's connection with Mona Lisa?", raw,
|
||||||
thinking, new OptionsBuilder().build(), (s) -> {
|
thinking, new OptionsBuilder().build(), (s) -> {
|
||||||
LOG.info(s);
|
|
||||||
String substring = s.substring(sb.toString().length());
|
String substring = s.substring(sb.toString().length());
|
||||||
LOG.info(substring);
|
LOG.info(substring);
|
||||||
sb.append(substring);
|
sb.append(substring);
|
||||||
@ -469,9 +468,9 @@ class OllamaAPIIntegrationTest {
|
|||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
OllamaChatResult chatResult = api.chat(requestModel, (s) -> {
|
OllamaChatResult chatResult = api.chat(requestModel, (s) -> {
|
||||||
LOG.info(s);
|
|
||||||
String substring = s.substring(sb.toString().length());
|
String substring = s.substring(sb.toString().length());
|
||||||
sb.append(substring);
|
sb.append(substring);
|
||||||
|
LOG.info(substring);
|
||||||
});
|
});
|
||||||
assertNotNull(chatResult);
|
assertNotNull(chatResult);
|
||||||
assertNotNull(chatResult.getResponseModel());
|
assertNotNull(chatResult.getResponseModel());
|
||||||
@ -492,9 +491,9 @@ class OllamaAPIIntegrationTest {
|
|||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
OllamaChatResult chatResult = api.chat(requestModel, (s) -> {
|
OllamaChatResult chatResult = api.chat(requestModel, (s) -> {
|
||||||
LOG.info(s);
|
|
||||||
String substring = s.substring(sb.toString().length());
|
String substring = s.substring(sb.toString().length());
|
||||||
sb.append(substring);
|
sb.append(substring);
|
||||||
|
LOG.info(substring);
|
||||||
});
|
});
|
||||||
assertNotNull(chatResult);
|
assertNotNull(chatResult);
|
||||||
assertNotNull(chatResult.getResponseModel());
|
assertNotNull(chatResult.getResponseModel());
|
||||||
@ -587,7 +586,6 @@ class OllamaAPIIntegrationTest {
|
|||||||
|
|
||||||
OllamaResult result = api.generateWithImageFiles(VISION_MODEL, "What is in this image?",
|
OllamaResult result = api.generateWithImageFiles(VISION_MODEL, "What is in this image?",
|
||||||
List.of(imageFile), new OptionsBuilder().build(), (s) -> {
|
List.of(imageFile), new OptionsBuilder().build(), (s) -> {
|
||||||
LOG.info(s);
|
|
||||||
String substring = s.substring(sb.toString().length());
|
String substring = s.substring(sb.toString().length());
|
||||||
LOG.info(substring);
|
LOG.info(substring);
|
||||||
sb.append(substring);
|
sb.append(substring);
|
||||||
@ -628,9 +626,9 @@ class OllamaAPIIntegrationTest {
|
|||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
OllamaResult result = api.generate(THINKING_TOOL_MODEL, "Who are you?", raw, thinking,
|
OllamaResult result = api.generate(THINKING_TOOL_MODEL, "Who are you?", raw, thinking,
|
||||||
new OptionsBuilder().build(), (s) -> {
|
new OptionsBuilder().build(), (s) -> {
|
||||||
LOG.info(s);
|
|
||||||
String substring = s.substring(sb.toString().length());
|
String substring = s.substring(sb.toString().length());
|
||||||
sb.append(substring);
|
sb.append(substring);
|
||||||
|
LOG.info(substring);
|
||||||
});
|
});
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertNotNull(result.getResponse());
|
assertNotNull(result.getResponse());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user