https://github.com/abhirockzz/langchain-go-postgresql-vectorstore
langchain Vector Store implementation based for PostgreSQL pgvector
https://github.com/abhirockzz/langchain-go-postgresql-vectorstore
generative-ai golang langchain postgresql
Last synced: 8 months ago
JSON representation
langchain Vector Store implementation based for PostgreSQL pgvector
- Host: GitHub
- URL: https://github.com/abhirockzz/langchain-go-postgresql-vectorstore
- Owner: abhirockzz
- Created: 2023-10-03T04:18:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-06T10:34:11.000Z (over 2 years ago)
- Last Synced: 2025-03-24T00:24:26.213Z (over 1 year ago)
- Topics: generative-ai, golang, langchain, postgresql
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PostgreSQL Vector Database implementation for LangChain Go
[langchaingo](https://github.com/tmc/langchaingo) extension to use [pgvector](https://github.com/pgvector/pgvector) as a vector database for your Go applications. It uses the [pgvector-go](https://github.com/pgvector/pgvector-go) library along with [pgx](https://github.com/jackc/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:
```go
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),
)
}
```