-
Notifications
You must be signed in to change notification settings - Fork 39
Bruno add scenario for vector search with SQL2025 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DETAILS The Dockerfile has been modified to replace the previous SQL Server 2025 CTP 2.1 image with the official SQL Server 2025 Preview image for Ubuntu 22.04. The image line has been updated from `FROM mcr.microsoft.com/mssql/server:2025-CTP2.1-ubuntu-22.04` to `FROM mcr.microsoft.com/mssql/server:2025-latest`.
DETAILS This commit removes the `MemoryContext` class and its associated dependencies from `ProductEndpoints.cs`, `MemoryContext.cs`, `Products.csproj`, and `Program.cs`. This change signifies a transition away from in-memory storage for product data, potentially indicating a new data management strategy. Additionally, related logging and initialization logic have been eliminated, simplifying the product management process. References to the `VectorEntities` project have also been removed from the solution file.
DETAILS The `ProductVector.cs` file has been completely removed, which included the definition of the `ProductVector` class that inherited from `Product`. This class had properties for `Id`, `Name`, `Description`, `Price`, and a `Vector` of type `ReadOnlyMemory<float>`, all of which were overridden from the base class and included attributes for vector storage. The `VectorEntities.csproj` file has also been removed entirely. This project file defined the project settings, including the target framework (`net9.0`), implicit usings, nullable reference types, and a package reference to `Microsoft.Extensions.VectorData.Abstractions`. It also included a project reference to another project located in the `DataEntities` directory.
DETAILS Modified console output in `AISearch` to reflect "similar products" and added a filter to exclude products with IDs less than or equal to 0, ensuring only valid products are returned in the search results.
DETAILS Modified the LINQ query to directly select the product entity instead of creating an anonymous object with product name and distance. This change simplifies the result set and allows easier access to all properties of the `Product` entity.
DETAILS - Changed `Embedding` initialization in `Product` class to use an empty array `[]`. - Updated `AISearch` method in `ProductAiActions.cs` to include a `dimensions` parameter, modifying embedding generation and reducing returned products from 3 to 2. - Modified `DbInitializer` to pass the `dimensions` parameter for consistent embedding generation. - Changed embedding model name from `"text-embedding-ada-002"` to `"text-embedding-3-small"` in `Program.cs`. - Updated deployment configuration to align with the new embedding model name and version.
DETAILS - Added new using directives for Entity Framework Core and OpenAI namespaces. - Corrected the globalization environment variable from "fal" to "false". - Commented out the old method of adding DbContext with `AddSqlServerDbContext`. - Introduced a new approach to retrieve the connection string from configuration and initialize DbContext with vector search enabled. - Added comments for clarity on DbContext handling and Azure OpenAI client configuration.
DETAILS Removed the `ProductAiActions` class and integrated its `AISearch` method into `ProductApiActions`. Updated `using` directives to include necessary namespaces, refactored response construction for improved readability, and updated routing for the AISearch endpoint to ensure continued functionality.
DETAILS The project file `Products.csproj` has been updated to remove several package references, including `Aspire.Microsoft.EntityFrameworkCore.SqlServer`, `Microsoft.SemanticKernel.Connectors.InMemory`, `Microsoft.VisualStudio.Web.CodeGeneration.Design`, and `OpenTelemetry.Instrumentation.AspNetCore`. Additionally, the project reference to `VectorEntities.csproj` has been removed. The remaining package references are `Aspire.Azure.AI.OpenAI` and `EFCore.SqlServer.VectorSearch`.
… and enhance description
👋 Thanks for contributing @elbruno! We will review the pull request and get back to you soon. |
Check Broken PathsWe have automatically detected the following broken relative paths in your files. Check the file paths and associated broken paths inside them.
|
Check Broken PathsWe have automatically detected the following broken relative paths in your files. Check the file paths and associated broken paths inside them.
|
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
Check Broken PathsWe have automatically detected the following broken relative paths in your files. Check the file paths and associated broken paths inside them.
|
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
1 similar comment
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
This pull request introduces a new scenario, "SQL 2025 Preview," showcasing the integration of vector search and vector indexes in SQL Server 2025 within a .NET Aspire application. The changes include updates to documentation, project setup, and implementation of the scenario's core functionality, along with unit tests to ensure robustness.
SQL 2025 Scenario Implementation:
Scenario Documentation: Added a new entry for "SQL 2025 Preview" in
README.md
and created a dedicatedREADME.md
for the scenario. This includes an overview, features, architecture diagram, deployment guidance, and cost/security considerations. [1] [2]Project Setup:
DataEntities.csproj
targeting.NET 9.0
with nullable reference types enabled..editorconfig
settings to suppress specific warnings (CS8602
andIDE0058
).Core Functionality:
Product
class with support for SQL Server 2025's vector type and JSON serialization.ProductDataContext
for database operations and initialized sample product data with vector embeddings.AISearch()
function inProductApiActions
to perform semantic search using vector embeddings.Unit Testing:
Products.Tests.csproj
targeting.NET 9.0
with references toEntityFrameworkCore.InMemory
andMSTest
.ProductApiActionsTests
.Tooling and Configuration:
dotnet-ef
todotnet-tools.json
for database migrations and management.These changes collectively enable semantic search capabilities in a .NET Aspire application using SQL Server 2025's vector search features.