Files
langchaingo/examples/qdrant-vectorstore-example
Dmitry Ng 064f09155c chore(deps): bump Go toolchain to 1.26.5 and fix vulnerable dependencies
- Raised the `go` directive from 1.24.1 to 1.26.5 to satisfy pgx/v5 and ollama's minimum Go version requirements and to pick up 15 patched standard library CVEs.
- Updated `pgx/v5`, `otel`/`otel/sdk`/`otlptracehttp`, `x/net`, and the AWS `eventstream` protocol package to their latest requested versions.
- Remediated govulncheck-flagged CVEs in `grpc`, `x/text`, `x/crypto`, `antchfx/xpath`, AWS SDK `bedrock*`/`s3` services, `etcd/server`, and `mongo-driver` v1/v2.
- Fixed ollama's `MainGPU` API type change (`int` -> `*int`) in `llms/ollama/options.go` without breaking the public `WithRunnerMainGPU` signature.
2026-08-04 13:57:26 +03:00
..
2024-06-20 23:47:52 -04:00

Qdrant Vector Store Example with LangChain Go

Welcome to this cheerful example of using Qdrant vector store with LangChain Go! 🎉

This example demonstrates how to use the Qdrant vector store to store and search for similar documents using embeddings. It's a great way to get started with vector databases and semantic search in your Go applications!

What This Example Does

  1. Sets up OpenAI Embeddings:

    • Creates an embeddings client using the OpenAI API.
    • Make sure you have your OPENAI_API_KEY environment variable set!
  2. Creates a Qdrant Vector Store:

    • Connects to your Qdrant instance.
    • Don't forget to replace YOUR_QDRANT_URL and YOUR_COLLECTION_NAME with your actual Qdrant details!
  3. Adds Documents:

    • Adds a variety of documents about different locations to the vector store.
    • Each document has some content and metadata (like area).
  4. Performs Similarity Searches:

    • Searches for documents similar to "england".
    • Searches for "american places" with a score threshold.
    • Searches for "cities in south america" with both a score threshold and metadata filter.

Cool Features Demonstrated

  • Similarity Search: Find documents that are semantically similar to a query.
  • Score Threshold: Filter results based on a minimum similarity score.
  • Metadata Filtering: Use additional metadata to refine your search results.

How to Run

  1. Make sure you have Go installed and your OPENAI_API_KEY set.
  2. Replace YOUR_QDRANT_URL and YOUR_COLLECTION_NAME with your Qdrant details.
  3. Run the example with go run qdrant_vectorstore_example.go.

Have fun exploring the world of vector databases and semantic search with LangChain Go and Qdrant! 🚀🔍