spring-projects / spring-projects/spring-ai
OpenAiEmbeddingModel failes to instantiate unless `embedding-model-dimensions.properties` is manually added to class path
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
org.springframework.ai.embedding.AbstractEmbeddingModel function loadKnownModelDimensions is called statically to load a properties file classpath:/embedding/embedding-model-dimensions.properties that is not guaranteed to be in the classpath.
It should be possible to:
- Run the system on defaults without externally placing the properties file
- Change the location of the resource
- Override how this resource is defined.
Environment
SpringAI SNAPSHOT-1.0.0
Steps to reproduce
Attempt to instantiate OpenAiEmbeddingModel without manually placing the properties file in the class path.
Expected behavior
N/A
Minimal Complete Reproducible example
def embeddingOptions = OpenAiEmbeddingOptions.builder().withModel("text-embedding-ada-002").build()
def embeddingModel = new OpenAiEmbeddingModel(openAiApi, MetadataMode.EMBED, embeddingOptions)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in org.springframework.ai.embedding.AbstractEmbeddingModel and inspect loadKnownModelDimensions, especially how it loads classpath:/embedding/embedding-model-dimensions.properties. Reproduce construction of OpenAiEmbeddingModel with the provided options and verify the behavior when the resource is absent. Done should cover running with defaults and the requested ability to change or override the resource location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- ai, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100