Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ async def _redis_search(
vector_field_name=self.vector_field_name,
text_scorer=text_scorer,
filter_expression=combined_filter,
alpha=alpha,
linear_alpha=alpha,
dtype=self.redis_vectorizer.dtype,
num_results=num_results,
return_fields=return_fields,
Expand Down
2 changes: 1 addition & 1 deletion python/packages/redis/agent_framework_redis/_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ async def _redis_search(
vector_field_name=self.vector_field_name,
text_scorer=text_scorer,
filter_expression=combined_filter,
alpha=alpha,
linear_alpha=alpha,
dtype=self.redis_vectorizer.dtype,
num_results=num_results,
return_fields=return_fields,
Expand Down
18 changes: 18 additions & 0 deletions python/packages/redis/tests/test_redis_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,28 @@ async def test_hybridquery_path_with_vectorizer(self, mock_index: AsyncMock, pat
assert k["dtype"] == "float32"
assert k["num_results"] == 10
assert "filter_expression" in k
assert "linear_alpha" in k

# Context assembled from returned memories
assert ctx.messages and "Hit" in ctx.messages[0].text

# Ensures HybridQuery receives linear_alpha parameter (redisvl 0.14.0+ compatibility)
async def test_hybridquery_uses_linear_alpha_parameter(
self, mock_index: AsyncMock, patch_index_from_dict, patch_queries
): # noqa: ARG002
mock_index.query = AsyncMock(return_value=[{"content": "Result"}])
provider = RedisProvider(user_id="u1", redis_vectorizer=CUSTOM_VECTORIZER, vector_field_name="vec")

await provider.invoking([Message(role="user", text="query")])

# Assert: HybridQuery called with linear_alpha parameter (not alpha)
assert patch_queries["HybridQuery"].call_count == 1
k = patch_queries["calls"]["HybridQuery"][0]
assert "linear_alpha" in k
assert "alpha" not in k
# Default alpha value is 0.7 from _redis_search signature
assert k["linear_alpha"] == 0.7


class TestRedisProviderContextManager:
# Verifies async context manager returns self for chaining
Expand Down
Loading