-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Bug description
When using the ElasticsearchVectorStoreAutoConfiguration from Spring AI, the application fails to start due to an ambiguous dependency injection for the EmbeddingModel bean.
Spring cannot determine which EmbeddingModel to inject, as there are two candidates available:
• cohereEmbeddingModel
• titanEmbeddingModel
Environment
Spring Boot version: 3.5.5
Spring AI version: 1.0.1
Java version: 21
Steps to reproduce
- Include both BedrockCohereEmbeddingAutoConfiguration and BedrockTitanEmbeddingAutoConfiguration in the classpath.
2. Run the application.
3. Observe the startup failure due to ambiguous beans.
implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.ai:spring-ai-starter-vector-store-elasticsearch") implementation("org.springframework.ai:spring-ai-starter-model-bedrock")
Minimal Complete Reproducible example
`
plugins {
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
id("org.springframework.boot") version "3.5.5"
id("io.spring.dependency-management") version "1.1.7"
}
group = "com.rtl.material"
version = "0.0.1-SNAPSHOT"
description = "VideoAnalyticsAI"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
extra["springAiVersion"] = "1.0.1"
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.ai:spring-ai-starter-vector-store-elasticsearch")
implementation("org.springframework.ai:spring-ai-starter-model-bedrock")
implementation("com.amazonaws:aws-java-sdk-s3:1.12.788")
implementation("software.amazon.awssdk:eventbridge:2.32.29")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
dependencyManagement {
imports {
mavenBom("org.springframework.ai:spring-ai-bom:${property("springAiVersion")}")
}
}
kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}
tasks.withType {
useJUnitPlatform()
}
`