PostgresVectorHelpers

org.llm4s.vectorstore.PostgresVectorHelpers

Shared helpers for Postgres pgvector operations: the text codec pgvector uses on the wire, [0.1,0.2,0.3].

This is pure Scala over Array[Float] - it touches no JDBC type and pulls in no driver - so it lives in llm4s-core, at the fully-qualified name it had in 0.4.1, even though the rest of org.llm4s.vectorstore ships in llm4s-rag.

It has two consumers in different modules: PgVectorStore and friends in llm4s-rag, and PostgresMemoryStore in llm4s-memory-postgres. Neither module depends on the other, and neither should: making llm4s-memory-postgres reach for llm4s-rag to get twenty lines would drag Tika, POI, PDFBox, jsoup and the AWS SDK onto the classpath of anyone storing agent memory in Postgres, which is the opposite of what carving memory out was for (llm4s/llm4s#1129). Keeping the one copy in the module both already depend on is the cheaper answer, and it retires the temporary duplicate slice 1 left in org.llm4s.agent.memory (llm4s/llm4s#1128).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def embeddingToString(embedding: Array[Float]): String
def stringToEmbedding(s: String): Result[Array[Float]]