Skip to content

PGVector Should not Force UUID on ID column #1856

@dpresonate

Description

@dpresonate

I am using PGVector to store my vector embeddings and this works fine when fetching. Our vectordb was populated through a non spring-ai script and we are not conforming to a UUID as the id of the record and are instead using our own internal key. When I try to add/update a document in our table, I am getting the following error:

java.lang.IllegalArgumentException: Invalid UUID string: A101750
	at java.base/java.util.UUID.fromString1(UUID.java:282)
	at java.base/java.util.UUID.fromString(UUID.java:260)
	at org.springframework.ai.vectorstore.PgVectorStore$1.setValues(PgVectorStore.java:216)
	at org.springframework.jdbc.core.JdbcTemplate.lambda$getPreparedStatementCallback$6(JdbcTemplate.java:1603)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:701)
	at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1047)

And it is due to the following code in PgVectorStore.java:

StatementCreatorUtils.setParameterValue(ps, 1, SqlTypeValue.TYPE_UNKNOWN,

Why is this enforced to be a UUID? Can this be changed to allow any type? I would like to use the convenience of the VectorStore abstraction to handle embedding and everything for me, but will have to use a workaround with it in the current state.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions