mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-27 15:08:30 +02:00
* added a table of content * wide layout for docs, styles for the table of content * fixes for docs layout * wide footer at the docs section * added support for nested docs, added toggling groups of links, delimiters, external links * external link icon * added active state for nested links, styles for the external link icon * styles fix * remove doc sync * update directory structure and doc titles * fix outstanding links * fix more links for merge * Revert "fix more links for merge" This reverts commit 46c9ccaf1b7765f2cda8dc85d625fa6b4e3f5436. * Revert "fix outstanding links" This reverts commit 28e6380b74f1ab74690c8184551f186656d6d4e9. * fix remaining broken links * move how-to tutorials in the different page * split tutorials * fix link * upd github edit link * skip empty index pages --------- Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com> Co-authored-by: David Sertic <62056091+davidmyriel@users.noreply.github.com>
54 lines
2.0 KiB
Markdown
54 lines
2.0 KiB
Markdown
---
|
|
title: LangChain
|
|
weight: 100
|
|
---
|
|
|
|
# LangChain
|
|
|
|
LangChain is a library that makes developing Large Language Models based applications much easier. It unifies the interfaces
|
|
to different libraries, including major embedding providers and Qdrant. Using LangChain, you can focus on the business value
|
|
instead of writing the boilerplate.
|
|
|
|
Langchain comes with the Qdrant integration by default. It might be installed with pip:
|
|
|
|
```bash
|
|
pip install langchain
|
|
```
|
|
|
|
Qdrant acts as a vector index that may store the embeddings with the documents used to generate them. There are various ways
|
|
how to use it, but calling `Qdrant.from_texts` is probably the most straightforward way how to get started:
|
|
|
|
```python
|
|
from langchain.vectorstores import Qdrant
|
|
from langchain.embeddings import HuggingFaceEmbeddings
|
|
|
|
embeddings = HuggingFaceEmbeddings(
|
|
model_name="sentence-transformers/all-mpnet-base-v2"
|
|
)
|
|
doc_store = Qdrant.from_texts(
|
|
texts, embeddings, url="<qdrant-url>", api_key="<qdrant-api-key>", collection_name="texts"
|
|
)
|
|
```
|
|
|
|
Calling `Qdrant.from_documents` or `Qdrant.from_texts` will always recreate the collection and remove all the existing points.
|
|
That's fine for some experiments, but you'll prefer not to start from scratch every single time in a real-world scenario.
|
|
If you prefer reusing an existing collection, you can create an instance of Qdrant on your own:
|
|
|
|
```
|
|
import qdrant_client
|
|
|
|
client = qdrant_client.QdrantClient(
|
|
"<qdrant-url>",
|
|
api_key="<qdrant-api-key>", # For Qdrant Cloud, None for local instance
|
|
)
|
|
|
|
doc_store = Qdrant(
|
|
client=client, collection_name="texts",
|
|
embedding_function=embeddings.embed_query,
|
|
)
|
|
```
|
|
|
|
If you'd like to know more about running Qdrant in a LangChain-based application, please read our article
|
|
[Question Answering with LangChain and Qdrant without boilerplate](/articles/langchain-integration/). Some more information
|
|
might also be found in the [LangChain documentation](https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html).
|