Skip to content

Commit 835d44d

Browse files
committed
Bedrock
1 parent 3589428 commit 835d44d

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

chat-server/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.kotlin
33
.gradle
44
.ollama
5-
build
5+
build
6+
system.properties

chat-server/build.gradle.kts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
22
import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
33
import org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED
4+
import java.util.Properties
45

56
plugins {
67
val kotlinVersion = "2.1.20"
@@ -29,11 +30,11 @@ dependencies {
2930
implementation("org.springframework.ai:spring-ai-mcp-client-spring-boot-starter")
3031

3132
// ollama
32-
implementation("org.springframework.ai:spring-ai-ollama-spring-boot-starter")
33+
// implementation("org.springframework.ai:spring-ai-ollama-spring-boot-starter")
3334

3435
// bedrock
35-
// implementation("org.springframework.ai:spring-ai-bedrock-converse-spring-boot-starter")
36-
// implementation("org.springframework.ai:spring-ai-bedrock-ai-spring-boot-starter")
36+
implementation("org.springframework.ai:spring-ai-bedrock-converse-spring-boot-starter")
37+
implementation("org.springframework.ai:spring-ai-bedrock-ai-spring-boot-starter")
3738

3839
implementation("org.springframework.ai:spring-ai-pgvector-store-spring-boot-starter")
3940
runtimeOnly("org.postgresql:postgresql")
@@ -73,4 +74,22 @@ tasks.withType<Test> {
7374
testLogging {
7475
events(PASSED, SKIPPED, FAILED)
7576
}
77+
setSystemProperties { systemProperty(it.first, it.second) }
78+
}
79+
80+
tasks.withType<JavaExec> {
81+
setSystemProperties { systemProperty(it.first, it.second) }
82+
}
83+
84+
private fun setSystemProperties(setSystemProperty: (Pair<String, Any>) -> Unit) {
85+
val systemPropertiesFile = project.rootProject.file("system.properties")
86+
if (systemPropertiesFile.exists()) {
87+
systemPropertiesFile.inputStream().use { inputStream ->
88+
Properties().apply {
89+
load(inputStream)
90+
}.forEach {
91+
setSystemProperty(it.key.toString() to it.value)
92+
}
93+
}
94+
}
7695
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
spring:
2+
ai:
3+
bedrock:
4+
aws:
5+
access-key: "${AWS_ACCESS_KEY_ID}"
6+
secret-key: "${AWS_SECRET_ACCESS_KEY}"
7+
region: "${AWS_REGION:eu-central-1}"
8+
converse:
9+
chat:
10+
enabled: true
11+
options:
12+
model: "arn:aws:bedrock:eu-central-1:538639307912:application-inference-profile/chl6cthltjx5"
13+
cohere:
14+
embedding:
15+
enabled: true
16+
model: "arn:aws:bedrock:eu-central-1:538639307912:application-inference-profile/e4nllpth9c18"
17+
vectorstore:
18+
pgvector:
19+
dimensions: 1024
20+
initialize-schema: true

chat-server/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
profiles:
3-
active: "ollama"
3+
active: "bedrock"
44
application:
55
name: chat-server
66
datasource:

0 commit comments

Comments
 (0)