Skip to content

Python: preserve Redis memory vectorizer data types - #8629

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
Shy7777:fix/maf-memory-integrations-20260922
Sep 22, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
Shy7777:fix/maf-memory-integrations-20260922

Conversation

@Shy7777

Copy link
Copy Markdown
Contributor

Motivation & Context

When RedisContextProvider is used with a float16, float64, or bfloat16 vectorizer, its memory writes are still encoded as float32. The resulting buffers disagree with the index schema and the query encoding. For example, a two-dimensional float64 field receives 8 bytes instead of 16, so the stored bytes cannot represent the intended vector.

Description & Review Guide

  • What are the major changes? Use RedisVL's existing array_to_buffer helper with the configured vectorizer data type when storing memories. Add a regression test through after_run() for float16, float32, float64, and bfloat16, checking both input and response embeddings against the schema, byte lengths, and decoded values.
  • What is the impact of these changes? Stored embeddings now use the same data type as the schema and hybrid-search queries. The default float32 behavior remains unchanged, and no public API or dependency changes are needed.
  • What do you want reviewers to focus on? Consistency between the configured vectorizer type and the bytes sent to the index, including the default data type. RedisVL's helper also handles bfloat16 without a separate encoding implementation.

Related Issue

Fixes #8624

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible (Redis package: 310 passed; 48 live-service integration cases were not run.)
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings September 22, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sunhy (@Shy7777) Reviewed the complete diff; no high-confidence issues found.

Merged via the queue into microsoft:main with commit 334bc31 Sep 22, 2026
52 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 45061a78 Deployed Sep 22, 2026 by Shy7777 via team_check #5015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: RedisContextProvider stores embeddings with the wrong vector data type

3 participants