Skip to content

Conversation

@ilayaperumalg
Copy link
Member

  • Add configuration properties to override the default field names for doc_id, content, metadata and embedding
  • Add support to allow auto-id when enabled
  • Add tests

Resolves #513

…orStore collection

- Add configuration properties to override the default field names for doc_id, content, metadata and embedding
- Add support to allow auto-id when enabled
- Add tests

Resolves spring-projects#513
@sobychacko sobychacko self-assigned this Oct 29, 2024
@sobychacko sobychacko added this to the 1.0.0-M4 milestone Oct 29, 2024
@sobychacko sobychacko added the enhancement New feature or request label Oct 29, 2024
@sobychacko sobychacko removed this from the 1.0.0-M4 milestone Oct 29, 2024
@sobychacko sobychacko removed the enhancement New feature or request label Oct 29, 2024
*/
@Testcontainers
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
public class MilvusVectorStoreCustomFieldNamesIT {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop the public modifier and keep it at default access.


@ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "COSINE" })
public void searchWithCustomFieldNames(String metricType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for public.


@ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "COSINE" })
public void searchWithoutMetadataFieldOverride(String metricType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for public.


@ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "COSINE" })
public void searchWithAutoIdEnabled(String metricType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for public.


@SpringBootConfiguration
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
public static class TestApplication {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for public.

private String metadataFieldName;

@Bean
public VectorStore vectorStore(MilvusServiceClient milvusClient, EmbeddingModel embeddingModel) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for public.

}

@Bean
public MilvusServiceClient milvusClient() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for public.

}

@Bean
public EmbeddingModel embeddingModel() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for public.

}

@Test
public void searchWithCustomFields() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Author tag needs to be updated for this class.

@sobychacko sobychacko merged commit d8f7ddb into spring-projects:main Oct 30, 2024
1 check passed
leijendary pushed a commit to leijendary/spring-ai that referenced this pull request Jan 24, 2025
…orStore collection (spring-projects#1616)

* spring-projectsGH-513 fix: Support custom field names for Milvus VectorStore collection

- Add configuration properties to override the default field names for doc_id, content, metadata and embedding
- Add support to allow auto-id when enabled
- Add tests

Resolves spring-projects#513

* Fix package modifier

Signed-off-by: leijendary <[email protected]>
leijendary pushed a commit to leijendary/spring-ai that referenced this pull request Jan 24, 2025
…orStore collection (spring-projects#1616)

* spring-projectsGH-513 fix: Support custom field names for Milvus VectorStore collection

- Add configuration properties to override the default field names for doc_id, content, metadata and embedding
- Add support to allow auto-id when enabled
- Add tests

Resolves spring-projects#513

* Fix package modifier

Signed-off-by: leijendary <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The SDK of the vector database is very inflexible, unable to modify some database fields.

3 participants