pgvectorspring-ai

How to use different VECTOR_TABLE_NAME in Spring AI?


I currently developing a project using Spring AI framework. To work with vector database I'm using the following depency (PGVector Store):

<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-pgvector-store-spring-boot-starter</artifactId>
</dependency>

What I'm struggling is how to use a different table name in my project. As default, the PgVectorStore class is set to work with a specific table:

public static final String VECTOR_TABLE_NAME = "vector_store";

Somehow, I can't find a way to update this vector table name to work properly with my database. The Spring AI version I've been working is 0.8.1.

Anyone can help with that? Thanks in advance!


Solution

  • It's not possible as for 0.8.1 unless you're willing to implement VectorStore with a custom table name. If you check the current PgVectorStore implementation, you'll notice that VECTOR_TABLE_NAME is hardcoded and used throughout query operations, lacking the option to override it through a property.

    I haven't encountered any relevant issues for this use case either, so please feel free to contribute or submit one through the Spring AI issue tracker.