Skip to main content

Radient

Radient is a developer-friendly, lightweight library for unstructured data ETL, i.e. turning audio, graphs, images, molecules, text, and other data types into embeddings. Radient supports simple vectorization as well as complex vector-centric workflows.

$ pip install radient

If you find this project helpful or interesting, please consider giving it a star. ⭐

Getting started

Basic vectorization can be performed as follows:

from radient import text_vectorizer
vz = text_vectorizer()
vz.vectorize("Hello, world!")
# Vector([-3.21440510e-02, -5.10351397e-02,  3.69579718e-02, ...])

The above snippet vectorizes the string "Hello, world!" using a default model, namely bge-small-en-v1.5 from sentence-transformers. If your Python environment does not contain the sentence-transformers library, Radient will prompt you for it:

vz = text_vectorizer()
# Vectorizer requires sentence-transformers. Install? [Y/n]

You can type "Y" to have Radient install it for you automatically.

Each vectorizer can take a method parameter along with optional keyword arguments which get passed directly to the underlying vectorization library. For example, we can pick Mixbread AI's mxbai-embed-large-v1 model using the sentence-transformers library via:

vz_mbai = text_vectorizer(method="sentence-transformers", model_name_or_path="mixedbread-ai/mxbai-embed-large-v1")
vz_mbai.vectorize("Hello, world!")
# Vector([ 0.01729078,  0.04468533,  0.00055427, ...])

More than just text

With Radient, you're not limited to text. Audio, graphs, images, and molecules can be vectorized as well:

from radient import (
    audio_vectorizer,
    graph_vectorizer,
    image_vectorizer,
    molecule_vectorizer,
)
avec = audio_vectorizer().vectorize(str(Path.home() / "audio.wav"))
gvec = graph_vectorizer().vectorize(nx.karate_club_graph())
ivec = image_vectorizer().vectorize(str(Path.home() / "image.jpg"))
mvec = molecule_vectorizer().vectorize("O=C=O")

A partial list of methods and optional kwargs supported by each modality can be found here.

For production use cases with large quantities of data, performance is key. Radient also provides an accelerate function to optimize vectorizers on-the-fly:

import numpy as np
vz = text_vectorizer()
vec0 = vz.vectorize("Hello, world!")
vz.accelerate()
vec1 = vz.vectorize("Hello, world!")
np.allclose(vec0, vec1)
# True

On a 2.3 GHz Quad-Core Intel Core i7, the original vectorizer returns in ~32ms, while the accelerated vectorizer returns in ~17ms.

Building unstructured data ETL

Aside from running experiments, pure vectorization is not particularly useful. Mirroring strutured data ETL pipelines, unstructured data ETL workloads often require a combination of four components: a data source where unstructured data is stored, one more more transform modules that perform data conversions and pre-processing, a vectorizer which turns the data into semantically rich embeddings, and a sink to persist the vectors once they have been computed.

Radient provides a Workflow object specifically for building vector-centric ETL applications. With Workflows, you can combine any number of each of these components into a directed graph. For example, a workflow to continuously read text documents from Google Drive, vectorize them with Voyage AI, and vectorize them into Milvus might look like:

from radient import make_operator
from radient import Workflow

extract = make_operator("source", method="google-drive", task_params={"folder": "My Files"})
transform = make_operator("transform", method="read-text", task_params={})
vectorize = make_operator("vectorizer", method="voyage-ai", modality="text", task_params={})
load = make_operator("sink", method="milvus", task_params={"operation": "insert"})

wf = (
    Workflow()
    .add(extract, name="extract")
    .add(transform, name="transform")
    .add(vectorize, name="vectorize")
    .add(load, name="load")
)

You can use accelerated vectorizers and transforms in a Workflow by specifying accelerate=True for all supported operators.

Supported vectorizer engines

Radient builds atop work from the broader ML community. Most vectorizers come from other libraries:

On-the-fly model acceleration is done via ONNX.

A massive thank you to all the creators and maintainers of these libraries.

Coming soon™

A couple of features slated for the near-term (hopefully):

  1. Sparse vector, binary vector, and multi-vector support
  2. Support for all relevant embedding models on Huggingface

LLM connectors will not be a feature that Radient provides. Building context-aware systems around LLMs is a complex task, and not one that Radient intends to solve. Projects such as Haystack and Llamaindex are two of the many great options to consider if you're looking to extract maximum RAG performance.

Full write-up on Radient will come later, along with more sample applications, so stay tuned.

Metadata

Release files for radient 2024.8.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for radient 2024.8.19
File Size Uploaded
radient-2024.8.19.tar.gz 27.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for radient 2024.8.19
File Interpreter ABI Platform
radient-2024.8.19-py3-none-any.whl Python 3 none any Details

Total release size: 69.6 kB

Release files / radient-2024.8.19.tar.gz

Download URL radient-2024.8.19.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb1032b88e033c84c9755ad4a9d4a09fa228dff486ee5362a16a4140b95878bf
BLAKE2b-256 checksum
How to use checksums
52787ac2adade8b94fff3bd34548cd9d01c9cd55ee7a3f011be85c2e048019ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release files / radient-2024.8.19-py3-none-any.whl

Download URL radient-2024.8.19-py3-none-any.whl
Size 42.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0807546d76caad4dcc5bb19cbaef38740e6cc1ee146bfef7b645c7a2ba7de36
BLAKE2b-256 checksum
How to use checksums
7594090b891ad210c6797c9c016ad7052ff979220ff51465a8f31a1ed3de5da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

2024.8.19 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page