Skip to content

fix: semantic cache issues, dimension check on create namespace - #3611

Merged
akshaydeo merged 1 commit into
devfrom
05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace
May 20, 2026
Merged

akshaydeo merged 1 commit into
devfrom
05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace

Conversation

@TejasGhatte

@TejasGhatte TejasGhatte commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves the Qdrant vector store integration by raising the gRPC receive message size limit to 64 MB (configurable), and adds dimension mismatch detection on CreateNamespace for Qdrant and Redis to surface clear errors when an existing collection/index has a different vector dimension than what the config expects.

Changes

  • Added a max_recv_msg_size_mb field to QdrantConfig (default: 64 MB) that sets the gRPC MaxCallRecvMsgSize dial option. The previous 4 MB gRPC default caused silent failures when caching large payloads such as base64-encoded image generation responses.
  • Added dimension validation in QdrantStore.CreateNamespace: if the collection already exists and its vector dimension differs from the requested dimension, an actionable error is returned instead of silently proceeding.
  • Added the same dimension validation in RedisStore.CreateNamespace using FT.INFO attribute metadata.
  • Added a Configuration Reference table to the Qdrant integration docs covering all supported fields, their types, defaults, and descriptions.
  • Added max_recv_msg_size_mb to the JSON config schema with a minimum of 1 and a default of 64.
  • Promoted google.golang.org/grpc from an indirect to a direct dependency in go.mod since it is now explicitly used in qdrant.go.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

# Run framework tests
cd framework
go test ./vectorstore/...

# Verify Qdrant with a large payload (e.g. base64 image response)
# Configure a Qdrant vector store with max_recv_msg_size_mb unset (defaults to 64)
# and cache an image generation response — confirm no gRPC message size error.

# Verify dimension mismatch error
# Point Bifrost at an existing Qdrant collection or Redis index with dimension N,
# set vector_store_namespace to that collection and configure dimension M (M ≠ N).
# Expected: startup fails with a clear error message indicating the mismatch and
# instructing the user to rename the namespace or drop the collection manually.

New config field for Qdrant:

Field Type Default Description
max_recv_msg_size_mb integer 64 gRPC max receive message size in MB. Increase when caching large payloads such as base64-encoded image generation responses.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

None. The max_recv_msg_size_mb field controls an internal gRPC buffer limit and does not affect authentication or secret handling.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3d28a386-cece-47c8-856d-8eeea9d3caf2

📥 Commits

Reviewing files that changed from the base of the PR and between e346771 and d76a687.

📒 Files selected for processing (6)
  • docs/integrations/vector-databases/qdrant.mdx
  • framework/go.mod
  • framework/vectorstore/qdrant.go
  • framework/vectorstore/redis.go
  • framework/vectorstore/weaviate.go
  • plugins/semanticcache/main.go
💤 Files with no reviewable changes (5)
  • framework/vectorstore/weaviate.go
  • plugins/semanticcache/main.go
  • framework/go.mod
  • framework/vectorstore/qdrant.go
  • framework/vectorstore/redis.go
✅ Files skipped from review due to trivial changes (1)
  • docs/integrations/vector-databases/qdrant.mdx

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Configurable gRPC max receive message size for Qdrant (default 64 MB) to support larger cached payloads
    • Added vector-dimension validation when creating namespaces for Qdrant and Redis to prevent mismatched indexes
    • Semantic cache now uses a non-zero placeholder vector when required to satisfy vector-store constraints
  • Documentation

    • Added Qdrant Configuration Reference documenting fields, defaults, and environment variable syntax

Walkthrough

Adds dimension validation for existing Qdrant and Redis namespaces, exposes a configurable Qdrant gRPC max receive message size, updates schema and Qdrant docs, and changes the semantic cache to store a non-zero unit-vector placeholder when required.

Changes

Vector Store Dimension Validation and Qdrant Configuration

Layer / File(s) Summary
Qdrant configuration contract and dependency management
framework/vectorstore/qdrant.go, transports/config.schema.json, framework/go.mod
Adds QdrantConfig.MaxRecvMsgSizeMB and internal default constant (64MB), makes google.golang.org/grpc a direct dependency, and adds max_recv_msg_size_mb to the schema.
Qdrant store dimension validation and message size wiring
framework/vectorstore/qdrant.go
CreateNamespace inspects existing collection vectors and errors on dimension mismatch; newQdrantStore computes max receive size from config and applies it via gRPC MaxCallRecvMsgSize.
Redis store dimension validation
framework/vectorstore/redis.go
After detecting an existing index, calls FTInfo to inspect VECTOR attribute dimensions and errors on mismatch; small formatting alignment to RedisConfig fields.
Semantic cache placeholder vector
plugins/semanticcache/main.go
Replaces zero-vector placeholder with a unit-vector placeholder via setPlaceholderVectorIfRequired and updates both call sites that initialize per-request placeholder vectors.
Documentation and minor cleanup
docs/integrations/vector-databases/qdrant.mdx, framework/vectorstore/weaviate.go
Adds a Qdrant "Configuration Reference" table documenting host, port, api_key, use_tls, and max_recv_msg_size_mb; removes an inline comment in Weaviate CreateNamespace.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • akshaydeo
  • danpiths

Poem

🐰 I padded bytes for grpc to cope,

checked dims where indexes elope,
Redis and Qdrant now nod in line,
placeholders stand with a one that shines,
hopping bugs away, one nibble at a time.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses two key changes: semantic cache issues and dimension validation on CreateNamespace, accurately summarizing the main technical improvements.
Description check ✅ Passed The description comprehensively covers all changes, testing instructions, configuration details, affected areas, and includes proper checklist items.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


tejas ghatte seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TejasGhatte
TejasGhatte marked this pull request as ready for review May 20, 2026 08:37
@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge; all three functional changes are correct for their primary use cases and the issues noted are narrow edge cases.

All three functional changes (gRPC size limit, dimension guards, placeholder vector) are correct for their primary use cases. The Redis dimension check has a narrow edge case on multi-vector indexes and the schema has no upper bound on max_recv_msg_size_mb, but neither affects the normal operating path.

framework/vectorstore/redis.go and transports/config.schema.json have the minor issues noted in the inline comments.

Important Files Changed

Filename Overview
framework/vectorstore/qdrant.go Adds configurable gRPC max-recv-msg-size and dimension mismatch check on CreateNamespace; edge cases handled with warn/debug logs
framework/vectorstore/redis.go Adds FTInfo-based dimension check; loops over all VECTOR attributes rather than scoping to the embedding field Bifrost creates
plugins/semanticcache/main.go Renames setZeroVectorIfRequired to setPlaceholderVectorIfRequired and initializes vec[0]=1.0 to satisfy Pinecone's non-zero vector requirement
transports/config.schema.json Adds max_recv_msg_size_mb field with minimum:1 but no maximum
docs/integrations/vector-databases/qdrant.mdx Adds a Configuration Reference table covering all supported fields
framework/go.mod Promotes google.golang.org/grpc from indirect to direct dependency
framework/vectorstore/weaviate.go Trivial comment cleanup; no functional change

Reviews (3): Last reviewed commit: "fix: semantic cache issues, dimension ch..." | Re-trigger Greptile

Comment thread framework/vectorstore/qdrant.go
Comment thread framework/vectorstore/qdrant.go Outdated
Comment thread framework/vectorstore/redis.go

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/vectorstore/qdrant.go`:
- Around line 47-57: The current code swallows errors from
s.client.GetCollectionInfo (infoErr) and thus skips dimension validation; change
the logic in the block that calls s.client.GetCollectionInfo(ctx, namespace)
(and checks infoErr) to fail fast: if infoErr != nil return a wrapped/errorf
describing the failure to fetch collection info for namespace (including
infoErr), otherwise proceed with the existing
GetConfig/GetParams/GetVectorsConfig/GetParams dimension check and compare
existingDim to the configured dimension and return the existing
dimension-mismatch error as before.

In `@framework/vectorstore/redis.go`:
- Around line 83-91: The current CreateNamespace flow silently succeeds when
ftInfoErr != nil or when FTInfo has no VECTOR attribute; change it to fail fast:
if ftInfoErr != nil return a wrapped error describing inability to read existing
index metadata (include ftInfoErr), and after iterating ftInfo.Attributes, if no
VECTOR attribute with Dim > 0 was found return an error indicating the existing
index lacks a VECTOR schema; only call s.cacheNamespaceFieldTypes(namespace,
properties) and return nil when validation passes (matching dimension or no
conflict). Use the existing symbols ftInfoErr, ftInfo.Attributes loop,
dimension, namespace, and s.cacheNamespaceFieldTypes to locate and update the
logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 89211098-259e-4084-bc3b-c4199af18ec0

📥 Commits

Reviewing files that changed from the base of the PR and between 87e3ffc and 17742e1.

📒 Files selected for processing (6)
  • docs/integrations/vector-databases/qdrant.mdx
  • framework/go.mod
  • framework/vectorstore/qdrant.go
  • framework/vectorstore/redis.go
  • framework/vectorstore/weaviate.go
  • transports/config.schema.json

Comment thread framework/vectorstore/qdrant.go
Comment thread framework/vectorstore/redis.go Outdated
@TejasGhatte
TejasGhatte force-pushed the 05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace branch from 17742e1 to e346771 Compare May 20, 2026 09:01

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
docs/integrations/vector-databases/qdrant.mdx (2)

94-94: ⚡ Quick win

Document the minimum value constraint for max_recv_msg_size_mb.

According to the PR summary, the schema enforces a minimum value of 1 MB. Consider adding this constraint to the description to help users understand the valid range.

📝 Suggested enhancement
-| `max_recv_msg_size_mb` | integer | `64` | gRPC max receive message size in MB. Increase when caching large payloads (e.g. base64-encoded image generation responses exceed the default). |
+| `max_recv_msg_size_mb` | integer | `64` | gRPC max receive message size in MB (minimum: 1). Increase when caching large payloads (e.g. base64-encoded image generation responses exceed the default). |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/integrations/vector-databases/qdrant.mdx` at line 94, The docs entry for
the `max_recv_msg_size_mb` field omits the minimum constraint; update the
description for `max_recv_msg_size_mb` to state that the value must be an
integer >= 1 (minimum 1 MB) and retains the default of 64 MB so users understand
the valid range and when to increase it for large payloads.

66-80: 💤 Low value

Consider adding an example demonstrating max_recv_msg_size_mb configuration.

While the field has a sensible default, users who encounter payload size issues might benefit from seeing an example configuration with max_recv_msg_size_mb explicitly set (e.g., to 128 for large image payloads). This is optional since the field is documented in the Configuration Reference table.

📝 Optional example addition

You could add a third config.json example for users handling large payloads:

**Large Payload Setup:**
```json
{
  "vector_store": {
    "enabled": true,
    "type": "qdrant",
    "config": {
      "host": "your-qdrant-cluster.cloud.qdrant.io",
      "port": 6334,
      "api_key": "your-qdrant-api-key",
      "use_tls": true,
      "max_recv_msg_size_mb": 128
    }
  }
}
```
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/integrations/vector-databases/qdrant.mdx` around lines 66 - 80, Add an
optional "Large Payload Setup" example to
docs/integrations/vector-databases/qdrant.mdx showing how to set
max_recv_msg_size_mb (e.g., 128) inside the existing vector_store config object;
update the doc by inserting a third JSON snippet similar to the existing "Cloud
Setup" block that includes the "max_recv_msg_size_mb" field so users handling
large image/payloads can copy the config directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/integrations/vector-databases/qdrant.mdx`:
- Line 94: The docs entry for the `max_recv_msg_size_mb` field omits the minimum
constraint; update the description for `max_recv_msg_size_mb` to state that the
value must be an integer >= 1 (minimum 1 MB) and retains the default of 64 MB so
users understand the valid range and when to increase it for large payloads.
- Around line 66-80: Add an optional "Large Payload Setup" example to
docs/integrations/vector-databases/qdrant.mdx showing how to set
max_recv_msg_size_mb (e.g., 128) inside the existing vector_store config object;
update the doc by inserting a third JSON snippet similar to the existing "Cloud
Setup" block that includes the "max_recv_msg_size_mb" field so users handling
large image/payloads can copy the config directly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9fd1e290-d9c1-4b66-91ed-3fdca2161af1

📥 Commits

Reviewing files that changed from the base of the PR and between 17742e1 and e346771.

📒 Files selected for processing (7)
  • docs/integrations/vector-databases/qdrant.mdx
  • framework/go.mod
  • framework/vectorstore/qdrant.go
  • framework/vectorstore/redis.go
  • framework/vectorstore/weaviate.go
  • plugins/semanticcache/main.go
  • transports/config.schema.json
✅ Files skipped from review due to trivial changes (1)
  • framework/vectorstore/weaviate.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 20, 2026
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review May 20, 2026 10:00

The merge-base changed after approval.

@akshaydeo
akshaydeo requested a review from a team as a code owner May 20, 2026 10:00
@TejasGhatte
TejasGhatte force-pushed the 05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace branch from e346771 to d76a687 Compare May 20, 2026 10:49
@coderabbitai
coderabbitai Bot requested review from akshaydeo and danpiths May 20, 2026 10:51

akshaydeo commented May 20, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 20, 11:38 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 20, 11:39 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 78778fb into dev May 20, 2026
15 of 17 checks passed
@akshaydeo
akshaydeo deleted the 05-20-fix_semantic_cache_issues_dimension_check_on_create_namespace branch May 20, 2026 11:39
@akshaydeo akshaydeo mentioned this pull request May 20, 2026
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
…mhq#3611)

## Summary

Improves the Qdrant vector store integration by raising the gRPC receive message size limit to 64 MB (configurable), and adds dimension mismatch detection on `CreateNamespace` for Qdrant and Redis to surface clear errors when an existing collection/index has a different vector dimension than what the config expects.

## Changes

- Added a `max_recv_msg_size_mb` field to `QdrantConfig` (default: 64 MB) that sets the gRPC `MaxCallRecvMsgSize` dial option. The previous 4 MB gRPC default caused silent failures when caching large payloads such as base64-encoded image generation responses.
- Added dimension validation in `QdrantStore.CreateNamespace`: if the collection already exists and its vector dimension differs from the requested dimension, an actionable error is returned instead of silently proceeding.
- Added the same dimension validation in `RedisStore.CreateNamespace` using `FT.INFO` attribute metadata.
- Added a `Configuration Reference` table to the Qdrant integration docs covering all supported fields, their types, defaults, and descriptions.
- Added `max_recv_msg_size_mb` to the JSON config schema with a minimum of 1 and a default of 64.
- Promoted `google.golang.org/grpc` from an indirect to a direct dependency in `go.mod` since it is now explicitly used in `qdrant.go`.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [x] Docs

## How to test

```sh
# Run framework tests
cd framework
go test ./vectorstore/...

# Verify Qdrant with a large payload (e.g. base64 image response)
# Configure a Qdrant vector store with max_recv_msg_size_mb unset (defaults to 64)
# and cache an image generation response — confirm no gRPC message size error.

# Verify dimension mismatch error
# Point Bifrost at an existing Qdrant collection or Redis index with dimension N,
# set vector_store_namespace to that collection and configure dimension M (M ≠ N).
# Expected: startup fails with a clear error message indicating the mismatch and
# instructing the user to rename the namespace or drop the collection manually.
```

New config field for Qdrant:

| Field | Type | Default | Description |
|---|---|---|---|
| `max_recv_msg_size_mb` | integer | `64` | gRPC max receive message size in MB. Increase when caching large payloads such as base64-encoded image generation responses. |

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None. The `max_recv_msg_size_mb` field controls an internal gRPC buffer limit and does not affect authentication or secret handling.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [x] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
…mhq#3611)

## Summary

Improves the Qdrant vector store integration by raising the gRPC receive message size limit to 64 MB (configurable), and adds dimension mismatch detection on `CreateNamespace` for Qdrant and Redis to surface clear errors when an existing collection/index has a different vector dimension than what the config expects.

## Changes

- Added a `max_recv_msg_size_mb` field to `QdrantConfig` (default: 64 MB) that sets the gRPC `MaxCallRecvMsgSize` dial option. The previous 4 MB gRPC default caused silent failures when caching large payloads such as base64-encoded image generation responses.
- Added dimension validation in `QdrantStore.CreateNamespace`: if the collection already exists and its vector dimension differs from the requested dimension, an actionable error is returned instead of silently proceeding.
- Added the same dimension validation in `RedisStore.CreateNamespace` using `FT.INFO` attribute metadata.
- Added a `Configuration Reference` table to the Qdrant integration docs covering all supported fields, their types, defaults, and descriptions.
- Added `max_recv_msg_size_mb` to the JSON config schema with a minimum of 1 and a default of 64.
- Promoted `google.golang.org/grpc` from an indirect to a direct dependency in `go.mod` since it is now explicitly used in `qdrant.go`.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [x] Docs

## How to test

```sh
# Run framework tests
cd framework
go test ./vectorstore/...

# Verify Qdrant with a large payload (e.g. base64 image response)
# Configure a Qdrant vector store with max_recv_msg_size_mb unset (defaults to 64)
# and cache an image generation response — confirm no gRPC message size error.

# Verify dimension mismatch error
# Point Bifrost at an existing Qdrant collection or Redis index with dimension N,
# set vector_store_namespace to that collection and configure dimension M (M ≠ N).
# Expected: startup fails with a clear error message indicating the mismatch and
# instructing the user to rename the namespace or drop the collection manually.
```

New config field for Qdrant:

| Field | Type | Default | Description |
|---|---|---|---|
| `max_recv_msg_size_mb` | integer | `64` | gRPC max receive message size in MB. Increase when caching large payloads such as base64-encoded image generation responses. |

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None. The `max_recv_msg_size_mb` field controls an internal gRPC buffer limit and does not affect authentication or secret handling.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [x] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants