examples/pgvector-vectorstore-example/README.md
This example demonstrates how to use pgvector, a PostgreSQL extension for vector similarity search, with OpenAI embeddings in a Go application. It showcases the integration of langchain-go, OpenAI's API, and pgvector to create a powerful vector database for similarity searches.
Sets up a PostgreSQL Database with pgvector:
Initializes OpenAI Embeddings:
Creates a PGVector Store:
Adds Sample Documents:
Performs Similarity Searches:
Start the PostgreSQL database:
docker compose up -d
Set your OpenAI API key:
export OPENAI_API_KEY=<your key>
Run the Go example:
go run pgvector_vectorstore_example.go
This example provides a practical demonstration of using vector databases for semantic search and similarity matching, which can be incredibly useful for various AI and machine learning applications.