Skip to content

OpenAiEmbeddingModel failes to instantiate unless embedding-model-dimensions.properties is manually added to class path #1709

Open
@russdanner

Description

@russdanner

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions