Tool

Query SingleStore for Similar Documents

LlamaIndex reader that retrieves similar documents from a SingleStore table by embedding.

Works with singlestore

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

Add to Favorites

Why it matters

Retrieve relevant documents from your SingleStore database based on semantic similarity to a given query embedding. This enables efficient knowledge retrieval and context building for AI applications.

Outcomes

What it gets done

01

Connect to SingleStore database using provided credentials.

02

Embed user queries into vector representations.

03

Perform vector similarity search within specified table.

04

Fetch top K most similar documents based on embedding.

Install

Add it to your toolbox

Run in your project directory:

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

Overview

SingleStore Loader

The SingleStore Loader retrieves documents from a SingleStore table by embedding similarity, given connection details, a target table, and the content/vector column names. Use it when you have an existing SingleStore table with a vector column and need documents retrieved by embedding similarity. It requires full database connection credentials.

What it does

The SingleStore Loader retrieves documents from a specified table in a SingleStore database. You initialize it with database connection details, then provide a search embedding to retrieve similar documents.

When to use - and when NOT to

Use it when you have an existing SingleStore table with a vector-embedding column and need to retrieve the most similar documents to a query embedding into LlamaIndex. It requires database connection credentials (scheme, host, port, user, password) plus the specific table, content field, and vector field names, so it is not usable without an existing, populated table configured this way.

Inputs and outputs

Install with:

pip install llama-index-readers-singlestore

Initialize with connection and table details, then load by search embedding:

from llama_index.readers.singlestore import SingleStoreReader

reader = SingleStoreReader(
    scheme="mysql",
    host="localhost",
    port="3306",
    user="username",
    [REDACTED],
    dbname="database_name",
    table_name="table_name",
    content_field="text",
    vector_field="embedding",
)

search_embedding = [n1, n2, n3, ...]

documents = reader.load_data(search_embedding=search_embedding, top_k=5)

SingleStoreReader takes connection details (scheme, host, port, user, password), the target dbname and table_name, and which columns hold the text (content_field) and embedding (vector_field). load_data takes a search_embedding and a top_k count of how many similar documents to fetch.

Who it's for

Developers building LlamaIndex pipelines that need documents retrieved from an existing SingleStore table by embedding similarity.

Source README

SingleStore Loader

pip install llama-index-readers-singlestore

The SingleStore Loader retrieves a set of documents from a specified table in a SingleStore database. The user initializes the loader with database information and then provides a search embedding for retrieving similar documents.

Usage

Here's an example usage of the SingleStoreReader:

from llama_index.readers.singlestore import SingleStoreReader

### Initialize the reader with your SingleStore database credentials and other relevant details
reader = SingleStoreReader(
    scheme="mysql",
    host="localhost",
    port="3306",
    user="username",
    [REDACTED],
    dbname="database_name",
    table_name="table_name",
    content_field="text",
    vector_field="embedding",
)

### The search_embedding is an embedding representation of your query_vector.
### Example search_embedding:
###   search_embedding=[0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]
search_embedding = [n1, n2, n3, ...]

### load_data fetches documents from your SingleStore database that are similar to the search_embedding.
### The top_k argument specifies the number of similar documents to fetch.
documents = reader.load_data(search_embedding=search_embedding, top_k=5)

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.