langchain go postgresql vectorstore
1.0.0
langchaingo extension to use pgvector as a vector database for your Go applications. It uses the pgvector-go library along with pgx driver.
You can use this in your LangChain applications as a standalone vector database or more likely, as part of a chain. For example, in a RAG implementation:
import(
"github.com/abhirockzz/langchain-go-postgresql-vectorstore/pgvector"
//...
)
func ragToRiches(){
bedrockClaudeLLM, err := claude.New("us-east-1")
tableName := "test_table"
textColumnName := "text_data"
embeddingStoreColumnName := "embedding_data"
amazonTitanEmbedder, err := titan_embedding.New("us-east-1")
pgVectorStore, err := pgvector.New(pgConnString,
tableName,
embeddingStoreColumnName,
textColumnName,
false,
amazonTitanEmbedder)
result, err := chains.Run(
context.Background(),
chains.NewRetrievalQAFromLLM(
bedrockClaudeLLM,
vectorstores.ToRetriever(pgVectorStore, numOfResults),
),
question,
chains.WithMaxTokens(8091),
)
}