Tool

Retrieve Data from DashVector with LlamaIndex

LlamaIndex reader that retrieves documents from a DashVector cluster by vector similarity.

Works with llamaindexdashvector

72
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate DashVector with LlamaIndex to efficiently retrieve documents from your DashVector clusters. This asset enables seamless data loading for RAG applications and can be used as a tool within LangChain agents.

Outcomes

What it gets done

01

Load documents from DashVector collections.

02

Query DashVector using embedding vectors and retrieve top results.

03

Configure data retrieval with options like filtering and including vectors.

04

Utilize retrieved data within LlamaIndex or LangChain frameworks.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-dashvector | bash

Overview

LlamaIndex Readers Integration: Dashvector

DashVector Reader retrieves documents from a DashVector cluster by vector similarity, with control over result count, filtering, and whether embeddings and specific fields come back. Use it when you have an existing DashVector cluster and need documents retrieved from it by vector similarity. It requires a DashVector API key and cluster endpoint.

What it does

DashVector Reader retrieves documents from DashVector clusters. You initialize it with an API key and a cluster endpoint, then load data from a named collection by vector similarity, with control over how many results to return, whether documents are separated, filter conditions, whether to include the embedding vector in results, and which output fields to return.

When to use - and when NOT to

Use it when you have an existing DashVector cluster and need to retrieve documents from it by vector similarity into LlamaIndex or a LangChain Agent. It requires a DashVector API key and cluster endpoint, so it is not usable without an Alibaba Cloud DashVector account already set up.

Inputs and outputs

Install with:

pip install llama-index-readers-dashvector

Initialize with your API key and endpoint, then load data by collection and query vector:

from llama_index.core.schema import Document
from llama_index.readers.dashvector import DashVectorReader

reader = DashVectorReader(
    api_key="<Your API Key>", endpoint="<Cluster Endpoint>"
)

documents = reader.load_data(
    collection_name="<Collection Name>",
    vector=[0.1, 0.2, 0.3],  # Query vector
    topk=10,  # Number of results to return
    separate_documents=True,  # Whether to return separate documents
    filter=None,  # Optional: Filter conditions
    include_vector=True,  # Whether to include the embedding in the response
    output_fields=None,  # Optional: Fields Filter
)

load_data takes a collection_name, a query vector, topk (how many results), separate_documents (whether to return one document per match), an optional filter, include_vector (whether to include the embedding), and an optional output_fields list.

Who it's for

Developers building LlamaIndex or LangChain pipelines that need documents retrieved from an existing DashVector cluster by vector similarity.

Source README

LlamaIndex Readers Integration: Dashvector

Overview

DashVector Reader is a tool designed to retrieve documents from DashVector clusters efficiently.

Installation

You can install DashVector Reader via pip:

pip install llama-index-readers-dashvector

To use DashVector, you must have an API key. Here are the installation instructions

Usage

from llama_index.core.schema import Document
from llama_index.readers.dashvector import DashVectorReader

### Initialize DashVectorReader with the API key and cluster endpoint
reader = DashVectorReader(
    api_key="<Your API Key>", endpoint="<Cluster Endpoint>"
)

### Load data from DashVector
documents = reader.load_data(
    collection_name="<Collection Name>",
    vector=[0.1, 0.2, 0.3],  # Query vector
    topk=10,  # Number of results to return
    separate_documents=True,  # Whether to return separate documents
    filter=None,  # Optional: Filter conditions
    include_vector=True,  # Whether to include the embedding in the response
    output_fields=None,  # Optional: Fields Filter
)

This loader is designed to be used as a way to load data into
LlamaIndex and/or subsequently
used as a Tool in a LangChain Agent.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.