mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-25 22:18:30 +02:00
* use relative links instead of absolute * add trailing slashes to avoid 301 redirect * add trailing slashes to avoid 301 redirect * make link checker unhappy with local redirects * test if ci fails (should fail) * rollback: test if ci fails (should fail)
1.5 KiB
1.5 KiB
title, weight
| title | weight |
|---|---|
| Langchain Go | 120 |
Langchain Go
Langchain Go is a framework for developing data-aware applications powered by language models in Go.
You can use Qdrant as a vector store in Langchain Go.
Setup
Install the langchain-go project dependency
go get -u github.com/tmc/langchaingo
Usage
Before you use the following code sample, customize the following values for your configuration:
YOUR_QDRANT_REST_URL: If you've set up Qdrant using the Quick Start guide, set this value tohttp://localhost:6333.YOUR_COLLECTION_NAME: Use our Collections guide to create or list collections.
import (
"fmt"
"log"
"github.com/tmc/langchaingo/embeddings"
"github.com/tmc/langchaingo/llms/openai"
"github.com/tmc/langchaingo/vectorstores"
"github.com/tmc/langchaingo/vectorstores/qdrant"
)
llm, err := openai.New()
if err != nil {
log.Fatal(err)
}
e, err := embeddings.NewEmbedder(llm)
if err != nil {
log.Fatal(err)
}
url, err := url.Parse("YOUR_QDRANT_REST_URL")
if err != nil {
log.Fatal(err)
}
store, err := qdrant.New(
qdrant.WithURL(*url),
qdrant.WithCollectionName("YOUR_COLLECTION_NAME"),
qdrant.WithEmbedder(e),
)
if err != nil {
log.Fatal(err)
}
Further Reading
- You can find usage examples of Langchain Go here.