Redis backed Caching of Internal Embeddings#3532
Open
ajtiwari07 wants to merge 80 commits into
Open
Conversation
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
…configuration Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
… and telemetry integration Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
…ate empty embeddings Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
…oint/health sub-objects Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
…orization Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
…lthCheckConfig in converter
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…dding controller tests, switching the dab schema for the embedding system to default to false
embeddings endpoint is now permanently fixed to /embed with no user-configurable path option. This removes unnecessary configuration surface since the feature has not been released yet, eliminating the need for backward compatibility. Changes: - Remove path property from dab.draft.schema.json - Remove Path, UserProvidedPath, and EffectivePath from EmbeddingsEndpointOptions - Remove EffectiveEndpointPath from EmbeddingsOptions - Remove path deserialization from EmbeddingsOptionsConverterFactory - Remove --runtime.embeddings.endpoint.path CLI option - Remove path configuration logic from ConfigGenerator - Remove endpoint path validation from RuntimeConfigValidator - Update Startup.cs logging to use DEFAULT_PATH constant - Update all tests to remove path references
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the embeddings feature set (“phase2”) by adding embeddings-specific cache configuration (L1 in-memory + optional L2 Redis), wiring a dedicated FusionCache instance for embeddings in the Service startup path, and updating config serialization/schema and tests to cover the new options and related behaviors.
Changes:
- Add
runtime.embeddings.cacheconfiguration surface (object model + JSON converters + JSON schema). - Configure a named FusionCache instance (
EmbeddingsCache) and optionally attach Redis distributed cache/backplane for embeddings. - Add/adjust unit tests and update configuration snapshots to reflect the new runtime config shape.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Service/Startup.cs | Adds embeddings cache setup and overrides embedding service registration to use a named FusionCache (and optional Redis). |
| src/Service/HealthCheck/HealthCheckHelper.cs | Adds fields intended to track incoming role/token for health checks. |
| src/Service/Controllers/EmbeddingController.cs | Minor formatting change (blank line). |
| src/Service.Tests/UnitTests/StartupRedisConnectionTests.cs | New unit tests for Redis Entra-auth detection logic in Startup. |
| src/Service.Tests/UnitTests/EmbeddingsCacheOptionsTests.cs | New unit tests for embeddings cache option defaults/behavior. |
| src/Service.Tests/UnitTests/EmbeddingsCacheOptionsSerializationTests.cs | New unit tests validating (de)serialization of embeddings cache options with runtime config serializer options. |
| src/Service.Tests/UnitTests/EmbeddingsCacheLevel2OptionsTests.cs | New unit tests for embeddings L2 cache option record/config behavior. |
| src/Service.Tests/UnitTests/EmbeddingControllerTests.cs | Extends controller tests around service availability; currently introduces duplicate local declarations. |
| src/Service.Tests/UnitTests/ConfigValidationUnitTests.cs | Adds additional embeddings validation tests; currently duplicates existing test methods in the same class. |
| src/Service.Tests/Snapshots/ConfigurationTests.TestReadingRuntimeConfigForPostgreSql.verified.txt | Updates expected runtime-config snapshot output to match new serialization/config shape. |
| src/Service.Tests/Snapshots/ConfigurationTests.TestReadingRuntimeConfigForMySql.verified.txt | Updates expected runtime-config snapshot output to match new serialization/config shape. |
| src/Service.Tests/Snapshots/ConfigurationTests.TestReadingRuntimeConfigForCosmos.verified.txt | Updates expected runtime-config snapshot output to match new serialization/config shape. |
| src/Service.Tests/Configuration/ConfigurationTests.cs | Fixes JSON request body formatting in an existing strict-mode test. |
| src/Core/Services/Embeddings/EmbeddingTelemetryHelper.cs | Adds OpenTelemetry namespace import for tracing-related extensions. |
| src/Config/RuntimeConfigLoader.cs | Registers the new EmbeddingsCacheOptionsConverterFactory in serializer options. |
| src/Config/ObjectModel/Embeddings/EmbeddingsOptions.cs | Adds cache property to embeddings runtime options and helper booleans for cache enablement. |
| src/Config/ObjectModel/Embeddings/EmbeddingsCacheOptions.cs | Introduces embeddings cache options model (enabled/ttl/level2 + “user provided TTL” semantics). |
| src/Config/ObjectModel/Embeddings/EmbeddingsCacheLevel2Options.cs | Introduces embeddings L2 cache options model (Redis connection string). |
| src/Config/Converters/EmbeddingsOptionsConverterFactory.cs | Extends embeddings options converter to read/write the new cache section. |
| src/Config/Converters/EmbeddingsCacheOptionsConverterFactory.cs | New custom converter to control embeddings cache options serialization (avoid writing default TTL unless explicitly provided). |
| src/Cli/Commands/ConfigureOptions.cs | Adds CLI flags for embeddings runtime configuration; currently contains duplicated option/property blocks. |
| schemas/dab.draft.schema.json | Adds schema definition for runtime.embeddings.cache (including L2 settings). |
Comments suppressed due to low confidence (1)
src/Cli/Commands/ConfigureOptions.cs:474
- Duplicate option properties were introduced for embeddings (e.g., RuntimeEmbeddingsEnabled/Provider/BaseUrl/etc. are declared twice). This will not compile due to duplicate member definitions and duplicate [Option] attributes; remove the duplicated block and keep a single set of embeddings options (including endpoint.path/chunking options as needed).
[Option("runtime.embeddings.enabled", Required = false, HelpText = "Enable/disable the embedding service. Default: true")]
public CliBool? RuntimeEmbeddingsEnabled { get; }
[Option("runtime.embeddings.provider", Required = false, HelpText = "Configure embedding provider type. Allowed values: azure-openai, openai.")]
public EmbeddingProviderType? RuntimeEmbeddingsProvider { get; }
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
souvikghosh04
requested changes
May 13, 2026
Contributor
souvikghosh04
left a comment
There was a problem hiding this comment.
Posting some comments which needs to be fixed. Will have another review after that.
Co-authored-by: Copilot <copilot@github.com>
JimRoberts-MS
approved these changes
May 15, 2026
prshri-msft
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Embeddings-Specific Cache Configuration
EmbeddingsCacheOptionsclass for embeddings-specific cache settings2. Level 2 (L2) Distributed Redis Cache Support
EmbeddingsCacheLevel2Optionsclass for Redis-specific configuration3. Enhanced Configuration Schema
cachesection underembeddings4. Dedicated FusionCache Instance for Embeddings
5. Comprehensive Test Coverage
EmbeddingsCacheOptionsclass (205 lines)EmbeddingsCacheLevel2Optionsclass (64 lines)