java.lang.Object
dev.langchain4j.community.store.embedding.cloudsql.PostgresEngine

public class PostgresEngine extends Object
PostgresEngine

Instances of this store are created by configuring a builder: PostgresEngine engine = new PostgresEngine.Builder(projectId, region, instance, database).build(); Uses HikariCP as a DataSource. A connection pool that will avoid the latency of repeatedly creating new database connections.

  • Constructor Details

    • PostgresEngine

      public PostgresEngine(PostgresEngine.Builder builder)
      Constructor for PostgresEngine
      Parameters:
      builder - builder.
  • Method Details

    • getConnection

      public Connection getConnection() throws SQLException
      Gets a Connection from the datasource
      Returns:
      A connection with the database specified in PostgresEngine
      Throws:
      SQLException - if database error occurs
    • initVectorStoreTable

      public void initVectorStoreTable(EmbeddingStoreConfig embeddingStoreConfig)
      Parameters:
      embeddingStoreConfig - contains the parameters necesary to intialize the Vector table
    • close

      public void close()
      Closes a Connection