From 5faba257f684f87cd215348cded8fd99fa8136a7 Mon Sep 17 00:00:00 2001 From: Angular2guy Date: Wed, 13 Dec 2023 20:54:02 +0100 Subject: [PATCH] feat: add ollama --- backend/build.gradle | 7 ++++++- backend/src/main/resources/application.properties | 1 + buildDocker.sh | 1 + runOllama.sh | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/build.gradle b/backend/build.gradle index ddcc099..575d145 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -33,7 +33,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.experimental.ai:spring-ai-openai-spring-boot-starter:0.7.1-SNAPSHOT' implementation 'org.springframework.experimental.ai:spring-ai-tika-document-reader:0.7.1-SNAPSHOT' implementation 'org.springframework.experimental.ai:spring-ai-pgvector-store:0.7.1-SNAPSHOT' implementation 'org.liquibase:liquibase-core' @@ -45,6 +44,12 @@ dependencies { testImplementation 'org.springframework.security:spring-security-test' testImplementation 'com.tngtech.archunit:archunit-junit5:1.1.0' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + if(project.hasProperty('useOllama') { + implementation 'org.springframework.experimental.ai:spring-ai-ollama:0.7.1-SNAPSHOT' + } else { + implementation 'org.springframework.experimental.ai:spring-ai-openai-spring-boot-starter:0.7.1-SNAPSHOT' + } } bootJar { diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 4702d21..2baa063 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -30,3 +30,4 @@ server.servlet.session.timeout=30s spring.jackson.parser.allow-unquoted-control-chars=true spring.ai.openai.api-key=${OPENAI-API-KEY:23418pajkfdsadlöa} +spring.ai.ollama.base-url=${OLLAMA-BASE-URL:http://localhost:11434} diff --git a/buildDocker.sh b/buildDocker.sh index 7d9617e..0bb4fe2 100644 --- a/buildDocker.sh +++ b/buildDocker.sh @@ -1,4 +1,5 @@ #!/bin/sh +#./gradlew clean build -PwithAngular=true -PuseChromium=true -PuseOllama=true #./gradlew clean build -PwithAngular=true -PuseChromium=true ./gradlew clean build -PwithAngular=true docker build -t angular2guy/aidocumentlibrarychat:latest --build-arg APP_FILE=build/libs/angularAndSpringWithMaps.jar --no-cache . diff --git a/runOllama.sh b/runOllama.sh index d592aef..195c62b 100644 --- a/runOllama.sh +++ b/runOllama.sh @@ -2,5 +2,5 @@ docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama docker start ollama docker stop ollama -docker exec -it ollama ollama run orca2:13b +#docker exec -it ollama ollama run orca2:13b docker exec -it ollama ollama run stable-beluga:13b \ No newline at end of file