Skip to content

Commit 59c878f

Browse files
committed
fix: properties
1 parent 645a365 commit 59c878f

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Technologies: Angular, Angular-Cli, Angular-Material, Typescript, Spring Boot, S
77
[![CodeQL](https://github.com/Angular2Guy/AIDocumentLibraryChat/actions/workflows/codeql.yml/badge.svg)](https://github.com/Angular2Guy/AIDocumentLibraryChat/actions/workflows/codeql.yml)
88

99
### DocumentLibraryChat
10-
This is a project to show howto use SpringAI to chat with the documents in a library. Document can be uploaded are then stored in a normal and vector database. The AI is used to create embeddings from the chunks of the documents that are stored in the vector database. In the chat questions can be asked that are turned in embeddings and are used for requests to the vector database. The document vector with the lowest distance is used to load the document from the database and to request an answer from the AI based on document content tokens. That enables the AI to generate the answer based on the content of the document and limits hallucinations. A link to the source document is provided for further research.
10+
This is a project to show howto use SpringAI 1.0.0+ to chat with the documents in a library. Document can be uploaded are then stored in a normal and vector database. The AI is used to create embeddings from the chunks of the documents that are stored in the vector database. In the chat questions can be asked that are turned in embeddings and are used for requests to the vector database. The document vector with the lowest distance is used to load the document from the database and to request an answer from the AI based on document content tokens. That enables the AI to generate the answer based on the content of the document and limits hallucinations. A link to the source document is provided for further research.
1111

1212
The project uses Spring Boot with Spring AI to access OpenAI and the vector database. The Postgresql DB is used with the vector, hstore and the uuid-ossp extensions. Liquibase is used to manage the database migrations. Jpa is used for database access in the services by the rest controllers. For the frontend Angular, Angular Material and Typescript is used to create the table of documents, the upload dialog and the document chat. Angular Cli is used for the frontend build and Gradle for the project build.
1313

@@ -71,10 +71,6 @@ In the helm directory is a kubernetes setup to run the AIDocumentLibraryChat pro
7171
## Postgresql setup
7272
In the [runPostgresql.sh](https://github.com/Angular2Guy/AIDocumentLibraryChat/blob/master/runPostgresql.sh) file are the commands to pull and run the Postgresql Docker image with vector extension locally.
7373

74-
## OpenAI Api key
75-
To get the OpenAI api key you need to create a account at [https://platform.openai.com](https://platform.openai.com) and create a key in the user settings. That key has to be added in the [application.properties](https://github.com/Angular2Guy/AIDocumentLibraryChat/blob/master/backend/src/main/resources/application.properties) at the key: 'spring.ai.openai.api-key'.
76-
As alternative it can be provided as the environment variable 'OPEN-API-KEY'.
77-
7874
## Ollama setup
7975
[Ollama](https://ollama.ai/) can run the AI model locally. The file [runOllama.sh](https://github.com/Angular2Guy/AIDocumentLibraryChat/blob/master/runOllama.sh) has the commands to run it as Docker container. The application needs to be build with the 'useOllama=true' Gradle build property to include the dependencies. The application needs to be started with the 'ollama' profile to switch on the configs/features to use Ollama based models. Ollama has support for GPU acceleration.
8076

backend/src/main/resources/application-ollama.properties

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,55 @@ spring.liquibase.change-log=classpath:/dbchangelog/db.changelog-master-ollama.xm
1212
# document processing
1313
# config free production use
1414
# best model for documents currently
15-
spring.ai.ollama.chat.model=qwen2.5:32b
16-
#spring.ai.ollama.chat.model=deepseek-r1:14b
17-
#spring.ai.ollama.chat.model=llama3.1:8b
15+
spring.ai.ollama.chat.options.model=qwen2.5:32b
16+
#spring.ai.ollama.chat.options.model=deepseek-r1:14b
17+
#spring.ai.ollama.chat.options.model=llama3.1:8b
1818
spring.ai.ollama.chat.options.num-ctx=12288
1919
spring.ai.embedding.transformer.onnx.modelUri=https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1/resolve/main/onnx/model_quantized.onnx
2020
spring.ai.embedding.transformer.tokenizer.uri=https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1/resolve/main/tokenizer.json
2121

2222
# function calling
2323
# best model for function calls currently
24-
#spring.ai.ollama.chat.model=qwen2.5:14b
24+
#spring.ai.ollama.chat.options.model=qwen2.5:14b
25+
#spring.ai.ollama.chat.options.model=qwen2.5:14b
2526
#spring.ai.ollama.chat.options.num-ctx=40960
2627

2728
#spring.ai.ollama.chat.model=llama3.1:8b
29+
#spring.ai.ollama.chat.options.model=llama3.1:8b
2830
#spring.ai.ollama.chat.options.num-ctx=65535
2931

3032
# image processing
3133
# best model for vision currently
32-
#spring.ai.ollama.chat.model=llama3.2-vision:11b
34+
#spring.ai.ollama.chat.options.model=llama3.2-vision:11b
3335
#spring.ai.ollama.chat.options.num-thread=8
3436
#spring.ai.ollama.chat.options.keep_alive=1s
3537

36-
#spring.ai.ollama.chat.model=llava:34b-v1.6-q6_K
38+
#spring.ai.ollama.chat.options.model=llava:34b-v1.6-q6_K
3739

3840

3941
# generate code
4042
# best model for code generation currently
41-
#spring.ai.ollama.chat.model=codestral:22b
43+
#spring.ai.ollama.chat.options.model=ollama run devstral:24b
44+
#spring.ai.ollama.chat.options.model=codestral:22b
4245
#spring.ai.ollama.chat.options.num-ctx=32768
4346

44-
#spring.ai.ollama.chat.model=granite-code:20b
47+
#spring.ai.ollama.chat.options.model=granite-code:20b
4548
#spring.ai.ollama.chat.options.num-ctx=8192
4649

4750
#spring.ai.ollama.chat.options.num-thread=8
4851
#spring.ai.ollama.chat.options.keep_alive=1s
4952

50-
#spring.ai.ollama.chat.model=deepseek-coder-v2:16b
53+
#spring.ai.ollama.chat.options.model=deepseek-coder-v2:16b
5154
#spring.ai.ollama.chat.options.num-ctx=65536
5255

5356
# generate book summaries
5457
# best model for book summaries currently
55-
#spring.ai.ollama.chat.model=qwen2.5:32b
58+
#spring.ai.ollama.chat.options.model=qwen2.5:32b
5659
#spring.ai.ollama.chat.options.num-ctx=30720
5760
spring.ai.ollama.chat.options.num-thread=8
5861
spring.ai.ollama.chat.options.keep_alive=1s
5962

60-
#spring.ai.ollama.chat.model=llama3.1:70b
63+
#spring.ai.ollama.chat.options.model=llama3.1:70b
6164
#spring.ai.ollama.chat.options.num-ctx=131072
6265

6366
#spring.ai.ollama.chat.options.num-ctx=32768

runOllama.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ docker exec -it ollama ollama run stable-beluga:13b
1515
#docker exec -it ollama ollama run codestral:22b
1616
#docker exec -it ollama ollama run llama3.1:8b
1717
#docker exec -it ollama ollama run qwen2.5:14b
18+
#docker exec -it ollama ollama run llama3.2-vision:11b
19+
#docker exec -it ollama ollama run devstral:24b
1820
#docker exec -it ollama bash

0 commit comments

Comments
 (0)