Class PgvectorVectorIndex

java.lang.Object
com.tnsai.intelligence.rag.vector.PgvectorVectorIndex
All Implemented Interfaces:
com.tnsai.memory.advanced.VectorIndex

public final class PgvectorVectorIndex extends Object implements com.tnsai.memory.advanced.VectorIndex
pgvector-backed VectorIndex.

Opens only when tnsai.vector.pgvector.url (or TNSAI_VECTOR_PGVECTOR_URL) is set. The PostgreSQL JDBC driver is never a required dependency: SQL is spoken through PgvectorTransport.

Bindings pass separate namespace and ownership scopes. Corpora with the same configuration may share a physical table, while each live provider-created engine receives a lifecycle-unique row owner. Role-bound owners remain deterministic for restart visibility. clear() deletes only that owner's rows and never drops the table.

Since:
0.14.0
  • Field Details

  • Constructor Details

  • Method Details

    • configured

      public static Optional<PgvectorVectorIndex> configured()
    • configured

      public static Optional<PgvectorVectorIndex> configured(String scope)
      Opens a live JDBC index namespaced to scope.
      Parameters:
      scope - binding identity and source set, or null for the shared standalone table
      Returns:
      empty when pgvector is not configured
    • isConfigured

      public static boolean isConfigured()
    • scopedTable

      public static String scopedTable(String base, String scope)
    • upsert

      public void upsert(String id, com.tnsai.memory.strategy.MemoryEntry entry, float[] vector)
      Specified by:
      upsert in interface com.tnsai.memory.advanced.VectorIndex
    • remove

      public boolean remove(String id)
      Specified by:
      remove in interface com.tnsai.memory.advanced.VectorIndex
    • clear

      public void clear()
      Specified by:
      clear in interface com.tnsai.memory.advanced.VectorIndex
    • size

      public int size()
      Specified by:
      size in interface com.tnsai.memory.advanced.VectorIndex
    • searchByVector

      public List<com.tnsai.memory.advanced.ScoredEntry> searchByVector(float[] queryVector, int topK)
      Specified by:
      searchByVector in interface com.tnsai.memory.advanced.VectorIndex