Skip to main content

llama-index readers astra_db integration

Project description

Astra DB Loader

pip install llama-index-readers-astra-db

The Astra DB Loader returns a set of documents retrieved from Astra DB. The user initializes the loader with an Astra DB index. They then pass in a vector.

Usage

Here's an example usage of the AstraDBReader.

from openai import OpenAI


# Get the credentials for Astra DB
api_endpoint = "https://324<...>f1c.astra.datastax.com"
token = "AstraCS:<...>"

# EXAMPLE: OpenAI embeddings
client = OpenAI(api_key="sk-<...>")

# Call OpenAI (or generate embeddings another way)
response = client.embeddings.create(
    input="Your text string goes here", model="text-embedding-ada-002"
)

# Get the embedding
query_vector = response.data[0].embedding

# Initialize the Reader object
from llama_index.readers.astra_db import AstraDBReader

# Your Astra DB Account will provide you with the endpoint URL and Token
reader = AstraDBReader(
    collection_name="astra_v_table",
    token=token,
    api_endpoint=api_endpoint,
    embedding_dimension=len(query_vector),
)

# Fetch data from the reader
documents = reader.load_data(vector=query_vector, limit=5)

This loader is designed to be used as a way to load data into LlamaIndex.

Note: Please see the AstraDB documentation here.

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

llama_index_readers_astra_db-0.5.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

llama_index_readers_astra_db-0.5.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_readers_astra_db-0.5.0.tar.gz.

File metadata

  • Download URL: llama_index_readers_astra_db-0.5.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_readers_astra_db-0.5.0.tar.gz
Algorithm Hash digest
SHA256 cbbbdfa983d83e6a84e1b46b77ebccb9442d0fb36b79134f4ccd2ab7666545bc
MD5 2557e1cfad0a7a693e26a2a117219410
BLAKE2b-256 d06109da1c518414793f427be7705a297f16593d297164419c9359220e5d68a0

See more details on using hashes here.

File details

Details for the file llama_index_readers_astra_db-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_readers_astra_db-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_readers_astra_db-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a86400163629542e1c50effaf76bc8c20c92ac2805a3e4f4e9f40e85d06ff950
MD5 f5ef5412c0e1eaeeedac1b7258e6fcc9
BLAKE2b-256 856227c70fb545711487b194b4430a170be836fd733b49001cdc0a9f45c23355

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