Radient
Radient is a developer-friendly, lightweight library for vectorization, i.e. turning data into embeddings. Radient supports many data types, not just text.
$ pip install radient
Why Radient?
In applications that leverage RAG, vector databases are commonly used as a way to retrieve relevant content that is relevant to the query. It's become so popular that "traditional" database vendors are rushing to support vector search. (Anybody see those funky Singlestore ads on US-101?)
Although still predominantly used for text today, vectors will be used extensively across a variety of different modalities in the upcoming months. This evolution is being powered by two independent occurrences: 1) the shift from large language models to large multimodal models (such as Reka and Fuyu), and 2) the rise in adoption for "traditional" tasks such as recommendation and semantic search. In short, vectors are going mainstream, and we need a way to vectorize everything, not just text.
Getting started
Vectorization can be performed as follows:
>> > from radient import text_vectorizer >> > vectorizer = text_vectorizer () >> > vectorizer . vectorize ( "Hello, world!" ) Vector ([ - 3.21440510e-02 , - 5.10351397e-02 , 3.69579718e-02 , ...
You're not limited to text modalities. Audio, graphs, images, and molecules can be vectorized as well:
>> > from pathlib import Path >> > from radient import audio_vectorizer , molecule_vectorizer >> > audio_vectorizer (). vectorize ( str ( Path . home () / "audio.wav" )) Vector ([ - 5.26519306e-03 , - 4.55586426e-03 , 1.79212391e-02 , ... >> > molecule_vectorizer (). vectorize ( "O=C=O" ) # O=C=O == SMILES string for CO2 Vector ([ False , False , False , ...
You can attach metadata to the resulting embeddings and store them in sinks. Radient currently supports Milvus:
>> > vector = vectorizer . vectorize ( "My name is Slim Shady" ) >> > vector . add_key_value ( "artist" , "Eminem" ) # {"artist": "Eminem"} >> > vector . store ()
For production use cases with large quantities of data, performance is key. Radient provides an accelerate function to optimize some vectorizers on-the-fly:
>> > vectorizer . vectorize ( "Hello, world!" ) # runtime: ~32ms Vector ([ - 3.21440510e-02 , - 5.10351397e-02 , 3.69579718e-02 , ... >> > vectorizer . accelerate () >> > vectorizer . vectorize ( "Hello, world!" ) # runtime: ~17ms Vector ([ - 3.21440622e-02 , - 5.10351285e-02 , 3.69579904e-02 , ...
Full write-up on Radient will come later, along with some sample applications.
Supported libraries
Radient builds atop work from the broader ML community. Most vectorizers come from other libraries:
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):