Skip to content

Commit 89e4c00

Browse files
Pull out threshold optimizers and cleanup README (#354)
- Remove threshold optimizers (pushed to the retrieval optimizer library!) - Clean up tests, docs, and readme - Bumps to 0.8.0 in prep for release
1 parent defa62a commit 89e4c00

25 files changed

+1154
-5473
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- main
99

1010
env:
11-
POETRY_VERSION: "1.8.3"
11+
POETRY_VERSION: "2.0.1"
1212

1313
jobs:
1414
check:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
env:
88
PYTHON_VERSION: "3.11"
9-
POETRY_VERSION: "1.8.3"
9+
POETRY_VERSION: "2.0.1"
1010

1111
jobs:
1212
build:

.github/workflows/test.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
PYTHON_VERSION: "3.11"
17-
POETRY_VERSION: "1.8.3"
17+
POETRY_VERSION: "2.0.1"
1818

1919
jobs:
2020
service-tests:
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up Python 3.11
4242
uses: actions/setup-python@v4
4343
with:
44-
python-version: 3.11
44+
python-version: ${{ env.PYTHON_VERSION }}
4545
cache: pip
4646

4747
- name: Install Poetry
@@ -52,7 +52,6 @@ jobs:
5252
- name: Install dependencies
5353
run: |
5454
poetry install --all-extras
55-
poetry run pip install ranx
5655
5756
- name: Authenticate to Google Cloud
5857
uses: google-github-actions/auth@v1
@@ -79,7 +78,7 @@ jobs:
7978
make test-all
8079
8180
test:
82-
name: Python ${{ matrix.python-version }} - ${{ matrix.connection }} - redis-py ${{ matrix.redis-py-version }} [redis ${{ matrix.redis-version }}]
81+
name: Python ${{ matrix.python-version }} - redis-py ${{ matrix.redis-py-version }} [redis ${{ matrix.redis-version }}]
8382
runs-on: ubuntu-latest
8483
needs: service-tests
8584
env:
@@ -89,7 +88,6 @@ jobs:
8988
matrix:
9089
# 3.11 tests are run in the service-tests job
9190
python-version: ["3.9", "3.10", 3.12, 3.13]
92-
connection: ["hiredis", "plain"]
9391
redis-py-version: ["5.x", "6.x"]
9492
redis-version: ["6.2.6-v9", "latest", "8.0.1"]
9593

@@ -117,18 +115,12 @@ jobs:
117115
- name: Install dependencies
118116
run: |
119117
poetry install --all-extras
120-
poetry run pip install ranx
121118
122119
# Install right redis version based on redis py
123120
if [[ "${{ matrix.redis-py-version }}" == "5.x" ]]; then
124-
poetry add "redis>=5.0.0,<6.0.0"
121+
poetry run pip install "redis>=5.0.0,<6.0.0"
125122
else
126-
poetry add "redis>=6.0.0,<7.0.0"
127-
fi
128-
129-
# Install hiredis if selected
130-
if [[ "${{ matrix.connection }}" == "hiredis" ]]; then
131-
poetry add hiredis
123+
poetry run pip install "redis>=6.0.0,<7.0.0"
132124
fi
133125
134126
- name: Set Redis image name
@@ -145,21 +137,15 @@ jobs:
145137
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
146138

147139
- name: Run tests
148-
if: matrix.connection == 'plain' && matrix.redis-py-version == '6.x' && matrix.redis-version == 'latest'
149140
env:
150141
HF_HOME: ${{ github.workspace }}/hf_cache
151142
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
152143
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
153144
run: |
154145
make test
155146
156-
- name: Run tests (alternate)
157-
if: matrix.connection != 'plain' || matrix.redis-py-version != '6.x' || matrix.redis-version != 'latest'
158-
run: |
159-
make test
160-
161147
- name: Run notebooks
162-
if: matrix.connection == 'plain' && matrix.redis-py-version == '6.x' && matrix.redis-version == 'latest'
148+
if: matrix.redis-py-version == '6.x' && matrix.redis-version == 'latest'
163149
env:
164150
HF_HOME: ${{ github.workspace }}/hf_cache
165151
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
@@ -177,11 +163,7 @@ jobs:
177163
HF_TOKEN: ${{ secrets.HF_TOKEN }}
178164
run: |
179165
docker run -d --name redis -p 6379:6379 redis/redis-stack-server:latest
180-
if [[ "${{ matrix.python-version }}" > "3.9" ]]; then
181-
make test-notebooks
182-
else
183-
poetry run test-notebooks --ignore ./docs/user_guide/09_threshold_optimization.ipynb --ignore ./docs/user_guide/release_guide/0_5_1_release.ipynb
184-
fi
166+
make test-notebooks
185167
186168
docs:
187169
runs-on: ubuntu-latest

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ redisvl/
7979
├── redis/ # Redis client utilities
8080
├── schema/ # Index schema definitions
8181
└── utils/ # Utilities (vectorizers, rerankers, optimization)
82-
├── optimize/ # Threshold optimization
8382
├── rerank/ # Result reranking
8483
└── vectorize/ # Embedding providers integration
8584
```

README.md

Lines changed: 74 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,60 @@
1-
<div align="center" dir="auto">
2-
<img width="300" src="https://raw.githubusercontent.com/redis/redis-vl-python/main/docs/_static/Redis_Logo_Red_RGB.svg" style="max-width: 100%" alt="Redis">
3-
<h1>🔥 Vector Library</h1>
1+
<div align="center">
2+
<img width="300" src="https://raw.githubusercontent.com/redis/redis-vl-python/main/docs/_static/Redis_Logo_Red_RGB.svg" alt="Redis">
3+
<h1>Redis Vector Library</h1>
4+
<p><strong>The AI-native Redis Python client</strong></p>
45
</div>
56

6-
7-
<div align="center" style="margin-top: 20px;">
8-
<span style="display: block; margin-bottom: 10px;">The *AI-native* Redis Python client</span>
9-
<br />
10-
7+
<div align="center">
118

129
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13-
![Language](https://img.shields.io/github/languages/top/redis/redis-vl-python)
14-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
15-
![GitHub last commit](https://img.shields.io/github/last-commit/redis/redis-vl-python)
1610
[![pypi](https://badge.fury.io/py/redisvl.svg)](https://pypi.org/project/redisvl/)
1711
![PyPI - Downloads](https://img.shields.io/pypi/dm/redisvl)
1812
[![GitHub stars](https://img.shields.io/github/stars/redis/redis-vl-python)](https://github.com/redis/redis-vl-python/stargazers)
1913

20-
</div>
14+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
15+
![Language](https://img.shields.io/github/languages/top/redis/redis-vl-python)
16+
![GitHub last commit](https://img.shields.io/github/last-commit/redis/redis-vl-python)
17+
18+
**[Documentation](https://docs.redisvl.com)****[Recipes](https://github.com/redis-developer/redis-ai-resources)****[GitHub](https://github.com/redis/redis-vl-python)**
2119

22-
<div align="center">
23-
<div display="inline-block">
24-
<a href="https://github.com/redis/redis-vl-python"><b>Home</b></a>&nbsp;&nbsp;&nbsp;
25-
<a href="https://docs.redisvl.com"><b>Documentation</b></a>&nbsp;&nbsp;&nbsp;
26-
<a href="https://github.com/redis-developer/redis-ai-resources"><b>Recipes</b></a>&nbsp;&nbsp;&nbsp;
27-
</div>
28-
<br />
2920
</div>
3021

22+
---
3123

32-
# Introduction
24+
## Introduction
3325

34-
Redis Vector Library is the ultimate Python client designed for AI-native applications harnessing the power of [Redis](https://redis.io).
26+
Redis Vector Library (RedisVL) is the production-ready Python client for AI applications built on Redis. **Lightning-fast vector search meets enterprise-grade reliability.**
3527

36-
[redisvl](https://pypi.org/project/redisvl/) is your go-to client for:
28+
<div align="center">
3729

38-
- Lightning-fast information retrieval & vector similarity search
39-
- Real-time RAG pipelines
40-
- Agentic memory structures
41-
- Smart recommendation engines
30+
| **🎯 Core Capabilities** | **🚀 AI Extensions** | **🛠️ Dev Utilities** |
31+
|:---:|:---:|:---:|
32+
| **[Index Management](#index-management)**<br/>*Schema design, data loading, CRUD ops* | **[Semantic Caching](#semantic-caching)**<br/>*Reduce LLM costs & boost throughput* | **[CLI](#command-line-interface)**<br/>*Index management from terminal* |
33+
| **[Vector Search](#retrieval)**<br/>*Similarity search with metadata filters* | **[LLM Memory](#llm-memory)**<br/>*Agentic AI context management* | **Async Support**<br/>*Async indexing and search for improved performance* |
34+
| **[Hybrid Queries](#retrieval)**<br/>*Vector + text + metadata combined* | **[Semantic Routing](#semantic-routing)**<br/>*Intelligent query classification* | **[Vectorizers](#vectorizers)**<br/>*8+ embedding provider integrations* |
35+
| **[Multi-Query Types](#retrieval)**<br/>*Vector, Range, Filter, Count queries* | **[Embedding Caching](#embedding-caching)**<br/>*Cache embeddings for efficiency* | **[Rerankers](#rerankers)**<br/>*Improve search result relevancy* |
36+
37+
</div>
38+
39+
### **Built for Modern AI Workloads**
40+
41+
- **RAG Pipelines** → Real-time retrieval with hybrid search capabilities
42+
- **AI Agents** → Short term & long term memory and semantic routing for intent-based decisions
43+
- **Recommendation Systems** → Fast retrieval and reranking
4244

4345

4446
# 💪 Getting Started
4547

4648
## Installation
4749

48-
Install `redisvl` into your Python (>=3.8) environment using `pip`:
50+
Install `redisvl` into your Python (>=3.9) environment using `pip`:
4951

5052
```bash
5153
pip install redisvl
5254
```
5355
> For more detailed instructions, visit the [installation guide](https://docs.redisvl.com/en/stable/overview/installation.html).
5456
55-
## Setting up Redis
57+
## Redis
5658

5759
Choose from multiple Redis deployment options:
5860

@@ -71,7 +73,7 @@ Choose from multiple Redis deployment options:
7173
# Overview
7274

7375

74-
## 🗃️ Redis Index Management
76+
## Index Management
7577
1. [Design a schema for your use case](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#define-an-indexschema) that models your dataset with built-in Redis and indexable fields (*e.g. text, tags, numerics, geo, and vectors*). [Load a schema](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#example-schema-creation) from a YAML file:
7678
```yaml
7779
index:
@@ -147,7 +149,7 @@ and [fetch](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.htm
147149
john = index.fetch("john")
148150
```
149151

150-
## 🔍 Retrieval
152+
## Retrieval
151153

152154
Define queries and perform advanced searches over your indices, including the combination of vectors, metadata filters, and more.
153155

@@ -186,7 +188,7 @@ Define queries and perform advanced searches over your indices, including the co
186188
> Read more about building [advanced Redis queries](https://docs.redisvl.com/en/stable/user_guide/02_hybrid_queries.html).
187189

188190

189-
## 🔧 Utilities
191+
## Dev Utilities
190192

191193
### Vectorizers
192194
Integrate with popular embedding providers to greatly simplify the process of vectorizing unstructured data for your index and queries:
@@ -222,19 +224,13 @@ embeddings = co.embed_many(
222224
### Rerankers
223225
[Integrate with popular reranking providers](https://docs.redisvl.com/en/stable/user_guide/06_rerankers.html) to improve the relevancy of the initial search results from Redis
224226

225-
### Threshold Optimization
226-
[Optimize distance thresholds for cache and router](https://docs.redisvl.com/en/stable/user_guide/09_threshold_optimization.html) with the utility `ThresholdOptimizer` classes.
227-
228-
**Note:** only available for `python > 3.9`.
229227

230-
231-
232-
## 💫 Extensions
228+
## Extensions
233229
We're excited to announce the support for **RedisVL Extensions**. These modules implement interfaces exposing best practices and design patterns for working with LLM memory and agents. We've taken the best from what we've learned from our users (that's you) as well as bleeding-edge customers, and packaged it up.
234230

235231
*Have an idea for another extension? Open a PR or reach out to us at [email protected]. We're always open to feedback.*
236232
237-
### LLM Semantic Caching
233+
### Semantic Caching
238234
Increase application throughput and reduce the cost of using LLM models in production by leveraging previously generated knowledge with the [`SemanticCache`](https://docs.redisvl.com/en/stable/api/cache.html#semanticcache).
239235
240236
```python
@@ -264,9 +260,41 @@ print(response[0]["response"])
264260
265261
> Learn more about [semantic caching]((https://docs.redisvl.com/en/stable/user_guide/03_llmcache.html)) for LLMs.
266262
267-
### LLM Memory History
263+
### Embedding Caching
264+
Reduce computational costs and improve performance by caching embedding vectors with their associated text and metadata using the [`EmbeddingsCache`](https://docs.redisvl.com/en/stable/api/cache.html#embeddingscache).
265+
266+
```python
267+
from redisvl.extensions.cache.embeddings import EmbeddingsCache
268+
from redisvl.utils.vectorize import HFTextVectorizer
269+
270+
# Initialize embedding cache
271+
embed_cache = EmbeddingsCache(
272+
name="embed_cache",
273+
redis_url="redis://localhost:6379",
274+
ttl=3600 # 1 hour TTL
275+
)
276+
277+
# Initialize vectorizer with cache
278+
vectorizer = HFTextVectorizer(
279+
model="sentence-transformers/all-MiniLM-L6-v2",
280+
cache=embed_cache
281+
)
282+
283+
# First call computes and caches the embedding
284+
embedding = vectorizer.embed("What is machine learning?")
285+
286+
# Subsequent calls retrieve from cache (much faster!)
287+
cached_embedding = vectorizer.embed("What is machine learning?")
288+
```
289+
```stdout
290+
>>> Cache hit! Retrieved from Redis in <1ms
291+
```
268292
269-
Improve personalization and accuracy of LLM responses by providing user message history as context. Manage access to message history data using recency or relevancy, *powered by vector search* with the [`MessageHistory`](https://docs.redisvl.com/en/stable/api/message_history.html).
293+
> Learn more about [embedding caching](https://docs.redisvl.com/en/stable/user_guide/10_embeddings_cache.html) for improved performance.
294+
295+
### LLM Memory
296+
297+
Improve personalization and accuracy of LLM responses by providing user conversation context. Manage access to memory data using recency or relevancy, *powered by vector search* with the [`MessageHistory`](https://docs.redisvl.com/en/stable/api/message_history.html).
270298
271299
```python
272300
from redisvl.extensions.message_history import SemanticMessageHistory
@@ -298,10 +326,10 @@ history.get_relevant("weather", top_k=1)
298326
```stdout
299327
>>> [{"role": "user", "content": "what is the weather going to be today?"}]
300328
```
301-
> Learn more about [LLM message history]((https://docs.redisvl.com/en/stable/user_guide/07_message_history.html)).
329+
> Learn more about [LLM memory]((https://docs.redisvl.com/en/stable/user_guide/07_message_history.html)).
302330
303331
304-
### LLM Semantic Routing
332+
### Semantic Routing
305333
Build fast decision models that run directly in Redis and route user queries to the nearest "route" or "topic".
306334
307335
```python
@@ -337,7 +365,7 @@ router("Hi, good morning")
337365
```
338366
> Learn more about [semantic routing](https://docs.redisvl.com/en/stable/user_guide/08_semantic_router.html).
339367
340-
## 🖥️ Command Line Interface
368+
## Command Line Interface
341369
Create, destroy, and manage Redis index configurations from a purpose-built CLI interface: `rvl`.
342370
343371
```bash
@@ -355,25 +383,20 @@ Commands:
355383
356384
## 🚀 Why RedisVL?
357385
358-
In the age of GenAI, **vector databases** and **LLMs** are transforming information retrieval systems. With emerging and popular frameworks like [LangChain](https://github.com/langchain-ai/langchain) and [LlamaIndex](https://www.llamaindex.ai/), innovation is rapid. Yet, many organizations face the challenge of delivering AI solutions **quickly** and at **scale**.
386+
Redis is a proven, high-performance database that excels at real-time workloads. With RedisVL, you get a production-ready Python client that makes Redis's vector search, caching, and session management capabilities easily accessible for AI applications.
359387

360-
Enter [Redis](https://redis.io) – a cornerstone of the NoSQL world, renowned for its versatile [data structures](https://redis.io/docs/data-types/) and [processing engines](https://redis.io/docs/interact/). Redis excels in real-time workloads like caching, session management, and search. It's also a powerhouse as a vector database for RAG, an LLM cache, and a chat session memory store for conversational AI.
361-
362-
The Redis Vector Library bridges the gap between the AI-native developer ecosystem and Redis's robust capabilities. With a lightweight, elegant, and intuitive interface, RedisVL makes it easy to leverage Redis's power. Built on the [Redis Python](https://github.com/redis/redis-py/tree/master) client, `redisvl` transforms Redis's features into a grammar perfectly aligned with the needs of today's AI/ML Engineers and Data Scientists.
388+
Built on the [Redis Python](https://github.com/redis/redis-py/tree/master) client, RedisVL provides an intuitive interface for vector search, LLM caching, and conversational AI memory - all the core components needed for modern AI workloads.
363389

364390

365391
## 😁 Helpful Links
366392

367393
For additional help, check out the following resources:
368394
- [Getting Started Guide](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html)
369395
- [API Reference](https://docs.redisvl.com/en/stable/api/index.html)
370-
- [Example Gallery](https://docs.redisvl.com/en/stable/examples/index.html)
371396
- [Redis AI Recipes](https://github.com/redis-developer/redis-ai-resources)
372-
- [Official Redis Vector API Docs](https://redis.io/docs/interact/search-and-query/advanced-concepts/vectors/)
373397

374398

375399
## 🫱🏼‍🫲🏽 Contributing
376-
377400
Please help us by contributing PRs, opening GitHub issues for bugs or new feature ideas, improving documentation, or increasing test coverage. [Read more about how to contribute!](CONTRIBUTING.md)
378401

379402
## 🚧 Maintenance

docs/api/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ reranker
2222
cache
2323
message_history
2424
router
25-
threshold_optimizer
2625
```
2726

docs/api/threshold_optimizer.rst

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)