Tool

Connect LlamaIndex to MyScale Databases

LlamaIndex reader that retrieves documents from a MyScale table by vector similarity.

Works with myscalellamaindexlangchain

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

Add to Favorites

Why it matters

Integrate your LlamaIndex applications with MyScale databases to efficiently retrieve and query vector data. This asset enables seamless data loading for advanced AI-powered applications.

Outcomes

What it gets done

01

Load data from MyScale using a query vector.

02

Configure MyScale connection parameters (host, credentials, database, table).

03

Specify index and search parameters for MyScale queries.

04

Utilize the reader as a tool within LangChain agents.

Install

Add it to your toolbox

Run in your project directory:

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

Overview

LlamaIndex Readers Integration: Myscale

MyScale Reader retrieves documents from a MyScale table by vector similarity, filterable with a SQL-style where condition, given connection and index settings. Use it when you have an existing MyScale table and need documents retrieved by vector similarity. It requires reachable MyScale connection credentials.

What it does

MyScale Reader loads data from a MyScale backend. It constructs a query to retrieve documents based on a given query vector and additional search parameters.

When to use - and when NOT to

Use it when you have an existing MyScale table and need to retrieve documents from it by vector similarity, with an optional SQL-style where filter, into LlamaIndex or a LangChain Agent. It requires MyScale connection credentials (host, username, password), so it is not usable without a reachable MyScale instance.

Inputs and outputs

Install with:

pip install llama-index-readers-myscale

Initialize with your connection and index settings, then load by query vector:

from llama_index.readers.myscale import MyScaleReader

reader = MyScaleReader(
    myscale_host="<MyScale Host>",  # MyScale host address
    username="<Username>",  # Username to login
    [REDACTED],  # Password to login
    database="<Database Name>",  # Database name (default: 'default')
    table="<Table Name>",  # Table name (default: 'llama_index')
    index_type="<Index Type>",  # Index type (default: "IVFLAT")
    metric="<Metric>",  # Metric to compute distance (default: 'cosine')
    batch_size=32,  # Batch size for inserting documents (default: 32)
    index_params=None,  # Index parameters for MyScale (default: None)
    search_params=None,  # Search parameters for MyScale query (default: None)
)

documents = reader.load_data(
    query_vector=[0.1, 0.2, 0.3],  # Query vector
    where_str="<Where Condition>",  # Where condition string (default: None)
    limit=10,  # Number of results to return (default: 10)
)

Connection and index defaults: database defaults to default, table to llama_index, index_type to IVFLAT, metric to cosine, and batch_size to 32. load_data takes a query_vector, an optional SQL-style where_str filter, and a limit (default 10).

Who it's for

Developers building LlamaIndex or LangChain pipelines that need documents retrieved from an existing MyScale table by vector similarity, filterable by a where condition.

Source README

LlamaIndex Readers Integration: Myscale

Overview

MyScale Reader allows loading data from a MyScale backend. It constructs a query to retrieve documents based on a given query vector and additional search parameters.

Installation

You can install Myscale Reader via pip:

pip install llama-index-readers-myscale

Usage

from llama_index.readers.myscale import MyScaleReader

### Initialize MyScaleReader
reader = MyScaleReader(
    myscale_host="<MyScale Host>",  # MyScale host address
    username="<Username>",  # Username to login
    [REDACTED],  # Password to login
    database="<Database Name>",  # Database name (default: 'default')
    table="<Table Name>",  # Table name (default: 'llama_index')
    index_type="<Index Type>",  # Index type (default: "IVFLAT")
    metric="<Metric>",  # Metric to compute distance (default: 'cosine')
    batch_size=32,  # Batch size for inserting documents (default: 32)
    index_params=None,  # Index parameters for MyScale (default: None)
    search_params=None,  # Search parameters for MyScale query (default: None)
)

### Load data from MyScale
documents = reader.load_data(
    query_vector=[0.1, 0.2, 0.3],  # Query vector
    where_str="<Where Condition>",  # Where condition string (default: None)
    limit=10,  # Number of results to return (default: 10)
)

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.