Skip to main content

Vector Database for Fast ANN Searches

Project description

Endee LlamaIndex Integration

This package provides an integration between Endee (a vector database) and LlamaIndex, allowing you to use Endee as a vector store backend for LlamaIndex.

Features

  • Vector Storage: Use Endee for your LlamaIndex embeddings
  • Multiple Distance Metrics: Support for cosine, L2, and inner product distance metrics
  • Metadata Filtering: Filter search results based on metadata
  • High Performance: Optimized for speed and efficiency

Installation

pip install endee-llamaindex

This will install both the endee-llamaindex package and its dependencies (endee and llama-index).

Quick Start

import os
from llama_index.core.schema import TextNode
from llama_index.core.vector_stores.types import VectorStoreQuery
from endee_llamaindex import EndeeVectorStore

# Configure your Endee credentials
api_token = os.environ.get("ENDEE_API_TOKEN")
index_name = "my_llamaindex_vectors"
dimension = 1536  # OpenAI ada-002 embedding dimension

# Initialize the vector store
vector_store = EndeeVectorStore.from_params(
    api_token=api_token,
    index_name=index_name,
    dimension=dimension,
    space_type="cosine"
)

# Create a node with embedding
node = TextNode(
    text="This is a sample document",
    id_="doc1",
    embedding=[0.1, 0.2, 0.3, ...],  # Your embedding vector
    metadata={
        "doc_id": "doc1",
        "source": "example",
        "author": "Endee"
    }
)

# Add the node to the vector store
vector_store.add([node])

# Query the vector store
query = VectorStoreQuery(
    query_embedding=[0.2, 0.3, 0.4, ...],  # Your query vector
    similarity_top_k=5
)

results = vector_store.query(query)

# Process results
for node, score in zip(results.nodes, results.similarities):
    print(f"Node ID: {node.node_id}, Similarity: {score}")
    print(f"Text: {node.text}")
    print(f"Metadata: {node.metadata}")

Using with LlamaIndex

from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.embeddings.openai import OpenAIEmbedding

# Initialize your nodes or documents
nodes = [...]  # Your nodes with text but no embeddings yet

# Setup embedding function
embed_model = OpenAIEmbedding()  # Or any other embedding model

# Initialize Endee vector store
vector_store = EndeeVectorStore.from_params(
    api_token=api_token,
    index_name=index_name,
    dimension=1536,  # Make sure this matches your embedding dimension
)

# Create storage context
storage_context = StorageContext.from_defaults(vector_store=vector_store)

# Create vector index
index = VectorStoreIndex(
    nodes, 
    storage_context=storage_context,
    embed_model=embed_model
)

# Query the index
query_engine = index.as_query_engine()
response = query_engine.query("Your query here")
print(response)

Configuration Options

The EndeeVectorStore constructor accepts the following parameters:

  • api_token: Your Endee API token
  • index_name: Name of the Endee index
  • dimension: Vector dimension (required when creating a new index)
  • space_type: Distance metric, one of "cosine", "l2", or "ip" (default: "cosine")
  • batch_size: Number of vectors to insert in a single API call (default: 100)
  • text_key: Key to use for storing text in metadata (default: "text")
  • remove_text_from_metadata: Whether to remove text from metadata (default: False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

endee_llamaindex-0.1.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

endee_llamaindex-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file endee_llamaindex-0.1.2.tar.gz.

File metadata

  • Download URL: endee_llamaindex-0.1.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for endee_llamaindex-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d712ed33d5659435a9c551878e571332b22fe469913033ab8e1082197d6abc44
MD5 e900d27832bcf6fd4477b92e7846c0db
BLAKE2b-256 62125bb0b4ace0e0acc38887857d7119aec03017dbafcd3924dd5354a5a871cf

See more details on using hashes here.

File details

Details for the file endee_llamaindex-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for endee_llamaindex-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1eddc993130fe5e29998eac1ddf5fb9e348eae00890f251c12813de144e1759
MD5 c6a939a714bd62f943345c984fa0db2d
BLAKE2b-256 9bf0173b36d27e596289d286cf24d1dbc93fa988a56a94614e7e506327b88fb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page