Giving up Chroma, Embracing Pgvector
For my local development of AI applications using Spring AI, I have been used Chroma for a long time. It used to be a very smooth experience. I just installed Chroma using pip
and started it using chroma run
. In Spring AI, I simply use the Spring Boot starter.
Starting from Chroma version 0.6.0
, I switched to use Docker to run Chroma. So I can easily tested different versions. Then I started to encounter various of issues.
In Chroma 0.6.0
and 0.6.1
, a similarity query returns 400 error.
400 - {"error":"InvalidArgumentError","message":"Input is a zero-length, empty document: line 1 column 1 (char 0)"}
In 0.6.2
, it's the same 400 error, but without the error message.
In 0.6.3
, when connecting to Chroma, it gives the following error.
{"error":"InvalidArgumentError","message":"cannot unpack non-iterable coroutine object"}
It's time-consuming to debug and fix these kind of issues. So I changed the vector store to pgvector. pgvector is stable and easy to use. I can also leverage existing database management tools.
Thanks to the VectorStore
interface in Spring AI, it's very easy to switch to different vector stores. To use pgvector, we can simply include the Spring Boot starter for pgvector, and change some configurations. No code change is required.