mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-29 07:58:31 +02:00
Update langchain-go.md (#1036)
This commit is contained in:
@@ -27,39 +27,42 @@ Before you use the following code sample, customize the following values for you
|
|||||||
list collections.
|
list collections.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
package main
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/tmc/langchaingo/embeddings"
|
import (
|
||||||
"github.com/tmc/langchaingo/llms/openai"
|
"log"
|
||||||
"github.com/tmc/langchaingo/vectorstores"
|
"net/url"
|
||||||
"github.com/tmc/langchaingo/vectorstores/qdrant"
|
|
||||||
|
"github.com/tmc/langchaingo/embeddings"
|
||||||
|
"github.com/tmc/langchaingo/llms/openai"
|
||||||
|
"github.com/tmc/langchaingo/vectorstores/qdrant"
|
||||||
)
|
)
|
||||||
|
|
||||||
llm, err := openai.New()
|
func main() {
|
||||||
if err != nil {
|
llm, err := openai.New()
|
||||||
log.Fatal(err)
|
if err != nil {
|
||||||
}
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
e, err := embeddings.NewEmbedder(llm)
|
e, err := embeddings.NewEmbedder(llm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
url, err := url.Parse("YOUR_QDRANT_REST_URL")
|
url, err := url.Parse("YOUR_QDRANT_REST_URL")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
store, err := qdrant.New(
|
store, err := qdrant.New(
|
||||||
qdrant.WithURL(*url),
|
qdrant.WithURL(*url),
|
||||||
qdrant.WithCollectionName("YOUR_COLLECTION_NAME"),
|
qdrant.WithCollectionName("YOUR_COLLECTION_NAME"),
|
||||||
qdrant.WithEmbedder(e),
|
qdrant.WithEmbedder(e),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
|
|||||||
Reference in New Issue
Block a user