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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_readers_astra_db-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_astra_db-0.3.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53175154712986f826ed305bad20a4c2f0a266b356bb3c6f88e52a38beb1d541 |
|
MD5 | dcd32d44f0fa476633c0f315354633f6 |
|
BLAKE2b-256 | 6f145437dd61b637f77215bf3e7521e1713d94025af28414d8326f7a18e05056 |
File details
Details for the file llama_index_readers_astra_db-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_astra_db-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c234a80769c293c01ae8127d64c2e23dab287f0d54aa3b28581c52fe38d0a2a |
|
MD5 | 58b6d1754be83db766126dc7ea86cb3b |
|
BLAKE2b-256 | 7bf334d101a61c1b5b57f9ec99107de396e3b22ed2185d377bda44c8c23ca54d |