mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-14 15:52:26 +00:00
The pages describing this code lived in lancedb/docs, a repository with ten stars that neither contributing guide mentioned. A user who hit a wrong page while reading the source had to find a separate, near-invisible repository to fix it. These 102 pages now sit beside the code, and a documentation fix is a pull request in the repository the reader already had open. `docs/web` is a complete Mintlify site: `cd docs/web && mint dev` serves it with no other checkout. Enterprise pages stay private and are merged in when the published site is assembled, so links into them do not resolve here — every open-source page does. `docs/web-tests` holds the tests the code examples are extracted from. They ran against a published wheel before; here they can run against this repository's own SDK, so an example that stops compiling fails the pull request that broke it rather than being noticed later. Both directories sit beside `docs/src` and are invisible to it: mkdocs reads `docs_dir: src`, so the SDK reference builds and deploys exactly as before.
55 lines
2.0 KiB
Plaintext
55 lines
2.0 KiB
Plaintext
---
|
|
title: "LlamaIndex"
|
|
sidebarTitle: "LlamaIndex"
|
|
|
|
---
|
|
|
|
import {
|
|
PyFrameworksLlamaindexAddReranker,
|
|
PyFrameworksLlamaindexFiltering,
|
|
PyFrameworksLlamaindexHybridSearch,
|
|
PyFrameworksLlamaindexQuickStart,
|
|
} from '/snippets/integrations.mdx';
|
|
|
|
## Quickstart {#quickstart}
|
|
|
|
LlamaIndex is a well-known framework for building LLM-powered agents over your data with LLMs and workflows.
|
|
You can build your LlamaIndex pipeline and persist your metadata and embeddings in LanceDB via the `LanceDBVectorStore` class.
|
|
|
|
First, install the LlamaIndex-LanceDB integration.
|
|
|
|
<CodeBlock filename="bash" language="bash" icon="terminal">
|
|
pip install llama-index-vector-stores-LanceDB
|
|
</CodeBlock>
|
|
|
|
Run the below script as an example.
|
|
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyFrameworksLlamaindexQuickStart}
|
|
</CodeBlock>
|
|
|
|
The vector store connector will open an existing LanceDB directory or create the directory if it does not exist.
|
|
|
|
### Filtering {#filtering}
|
|
For metadata filtering, you can use a Lance SQL-like string filter as demonstrated in the example above. Additionally, you can also filter using the `MetadataFilters` class from LlamaIndex:
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyFrameworksLlamaindexFiltering}
|
|
</CodeBlock>
|
|
|
|
### Hybrid Search {#hybrid-search}
|
|
For complete documentation, refer [here](https://docs.lancedb.com/search/hybrid-search). This example uses the `colbert` reranker. Make sure to install necessary dependencies for the reranker you choose.
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyFrameworksLlamaindexHybridSearch}
|
|
</CodeBlock>
|
|
|
|
In the snippet above, you can change/specify `query_type` when creating the engine/retriever
|
|
to use different search strategies, such as vector search or FTS.
|
|
|
|
## API reference {#api-reference}
|
|
|
|
<Card
|
|
title="LlamaIndex Vector Stores API reference"
|
|
href="https://developers.llamaindex.ai/python/framework-api-reference/storage/vector_store/lancedb/"
|
|
>
|
|
See the official LlamaIndex Vector Stores API reference for more details.
|
|
</Card> |