-
Notifications
You must be signed in to change notification settings - Fork 995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the embedding field name configurable for the ElasticSearchVectorStore #2175
base: main
Are you sure you want to change the base?
Conversation
bf91743
to
414422a
Compare
Fixed conflict with #2176 |
@dev-jonghoonpark We wanted to go with a specific type instead of Map. Do you see any downside of using the Record type for this? |
@ilayaperumalg private Object getDocument(Document document, float[] embedding, String fieldName) {
Assert.notNull(document.getText(), "document's text must not be null");
if (fieldName.equals("embedding")) {
return new ElasticSearchDocument(document.getId(), document.getText(), document.getMetadata(), embedding);
}
return Map.of("id", document.getId(), "content", document.getText(), "metadata", document.getMetadata(),
fieldName, embedding);
} Could there have been a better way? |
...framework/ai/autoconfigure/vectorstore/elasticsearch/ElasticsearchVectorStoreProperties.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/springframework/ai/vectorstore/elasticsearch/ElasticsearchVectorStore.java
Outdated
Show resolved
Hide resolved
a567120
to
729ab32
Compare
@Bean | ||
public EmbeddingModel embeddingModel() { | ||
return new OpenAiEmbeddingModel(new OpenAiApi(System.getenv("OPENAI_API_KEY"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAiApi constructor deprecated since 1.0.0.M6, so I changed to use builder
@ilayaperumalg |
…rStore Signed-off-by: jonghoon park <[email protected]>
729ab32
to
e41b52a
Compare
Fixed conflict with #2209 |
Related issue: #2082
Motivation:
On #2082, We found embedding field name is not configurable.
Modification:
Added a configuration option for the embedding field name in the ElasticSearchVectorStore
Result:
Users can now specify a custom embedding field name through configuration.
Close #2082 issue.
Further discussion:
Is an ElasticSearchDocument record really necessary? If not, what about just using the Map class?