Commit Graph

243 Commits

Author SHA1 Message Date
Marco Minerva 9a31ad1400 Update SwaggerUI package to version 9.0.6
Upgraded the `Swashbuckle.AspNetCore.SwaggerUI` package in the `SqlDatabaseVectorSearch.csproj` file from version 9.0.5 to 9.0.6. This minor version update likely includes bug fixes, enhancements, or other improvements while maintaining backward compatibility.
2025-10-06 11:35:15 +02:00
Marco Minerva d730b1f760 Update Swashbuckle.AspNetCore.SwaggerUI to v9.0.5
Upgraded the `Swashbuckle.AspNetCore.SwaggerUI` package in the
`SqlDatabaseVectorSearch.csproj` file from version 9.0.4 to 9.0.5.
This update may include bug fixes, new features, or other
improvements provided in the latest version.
2025-09-30 10:49:49 +02:00
Marco Minerva 13c08c1752 Update .editorconfig with new style and diagnostic rules
Added `csharp_style_prefer_simple_property_accessors` to promote
simple property accessors with suggestion severity. Disabled
CA1873 warnings for potentially expensive logging. Retained
IDE0305 rule for simplifying collection initialization for
clarity. These changes enhance code style consistency and
suppress irrelevant diagnostics.
2025-09-19 10:26:37 +02:00
Marco Minerva a80e132f8f Update Microsoft.SemanticKernel to version 1.65.0
Upgraded the `Microsoft.SemanticKernel` package reference in
`SqlDatabaseVectorSearch.csproj` from version 1.64.0 to 1.65.0.
This update may include new features, bug fixes, or performance
improvements.
2025-09-11 09:25:32 +02:00
Marco Minerva e0220da84e Update NuGet package versions to latest releases
Updated the following NuGet packages to their latest versions:
- `Microsoft.AspNetCore.OpenApi` to `9.0.9`
- `Microsoft.EntityFrameworkCore.SqlServer` to `9.0.9`
- `Microsoft.EntityFrameworkCore.Tools` to `9.0.9`
- `Microsoft.Extensions.Caching.Hybrid` to `9.9.0`
- `Microsoft.Extensions.Http.Resilience` to `9.9.0`
- `TinyHelpers.AspNetCore` to `4.1.6`
2025-09-10 16:02:10 +02:00
Marco Minerva ed90a22888 Update copilot instructions and package version
Updated EFCore.SqlServer.VectorSearch package version from 9.0.0-preview.2 to 9.0.0 for stability.
2025-09-08 12:57:16 +02:00
Marco Minerva 98c18139f4 Update documentation and package versions
- Clarified test practices in `copilot-instructions.md`.
- Revised Azure rules for best practices and tool usage.
- Added instruction in `ChatService.cs` for asking clarifying questions.
- Updated package versions in `SqlDatabaseVectorSearch.csproj` for several dependencies.
2025-09-01 11:58:11 +02:00
Marco Minerva 261853e4a7 Fix typos and update dependencies and configurations
Updated the version of
`TinyHelpers.AspNetCore` in `SqlDatabaseVectorSearch.csproj`
from `4.1.2` to `4.1.3`. Clarified comments in
`appsettings.json` for the `ModelId` field under
`ChatCompletion` to specify requirements for `gpt-4.1` models.
2025-08-01 16:11:06 +02:00
Marco Minerva 0ba84a35ba Update package versions for dependencies
Updated the following packages:
- `MinimalHelpers.Routing.Analyzers` to version `1.2.2`
- `PdfPig` to version `0.1.11`
- `TinyHelpers.AspNetCore` to version `4.1.2`
2025-07-28 12:41:46 +02:00
Marco Minerva b20491f247 Refactor solution structure and update package version
Updated the Visual Studio solution file to remove obsolete project configuration lines, indicating a cleanup.
The `Microsoft.SemanticKernel` package version has been upgraded from `1.60.0` to `1.61.0`.
Introduced a new solution file format (`SqlDatabaseVectorSearch.slnx`) to better organize solution items in a structured XML format.
2025-07-25 12:24:05 +02:00
Marco Minerva f6fa60247a Enhance language handling and formatting in ChatService
Updated system prompts in ChatService to emphasize that responses must match the user's question language. Added formatting requirements for answers, including the need for a period before citations. Clarified citation format and adjusted prompt construction for improved readability.
2025-07-24 15:08:43 +02:00
Marco Minerva caa2ed4542 Improve streaming content layout and spinner positioning
Updated `Ask.razor` to conditionally apply a CSS class for the `streaming-text` div based on message status, enabling a spinner display during streaming. Adjusted spinner position from bottom right to bottom left and ensured proper layout with a minimum height for `streaming-content`. Modified a comment for clarity regarding the `Citations` property.

In `Ask.razor.css`, added padding to `streaming-text` for spinner accommodation and adjusted spinner styling to maintain layout integrity.
2025-07-22 10:49:12 +02:00
Marco Minerva d8343b16e5 Refactor message handling and UI in Ask.razor
- Introduced a new `MessageStatus` enum to replace the `IsCompleted` boolean in the `Message` class, allowing for better tracking of message states (New, Streaming, Completed).
- Updated UI rendering to enhance message display with new div elements and conditional spinner for streaming messages.
- Modified the `AskQuestion` method to set the status of user and assistant messages appropriately.
- Added new CSS styles for improved layout and alignment of message components.
- Overall improvements enhance functionality and user experience in the messaging system.
2025-07-22 10:30:16 +02:00
Marco Minerva 505ccff8b7 Enhance ChatService with new prompts and simplifications
Updated ChatService to include static readonly fields for
reformulation and answering prompts. Replaced the existing
ChatSystemPrompt in CreateQuestionAsync. Simplified
GetTokenUsage using expression-bodied members. Modified
SetChatHistoryAsync to ensure correct chat history updates
in the cache.
2025-07-16 16:33:52 +02:00
Marco Minerva 595d6f974f Enhance ChatService with new prompt settings
Updated ChatService to use AzureOpenAIPromptExecutionSettings for improved chat message generation.
The CreateChatAsync method now returns both ChatHistory and settings, allowing for better configuration.
Refined question reformulation prompts to ensure context relevance and language consistency.
These changes enhance the overall functionality and interaction of the chat service.
2025-07-16 15:45:09 +02:00
Marco Minerva 7ca51232fb Add copilot-instructions.md file to the Solution 2025-07-15 12:23:10 +02:00
Marco Minerva 1065dbbf83 Update package references in SqlDatabaseVectorSearch
Updated several package references in the `SqlDatabaseVectorSearch.csproj` file to newer versions, including:
- `Microsoft.AspNetCore.OpenApi` to `9.0.7`
- `Microsoft.EntityFrameworkCore.SqlServer` to `9.0.7`
- `Microsoft.EntityFrameworkCore.Tools` to `9.0.7`
- `Microsoft.Extensions.Caching.Hybrid` to `9.7.0`
- `Microsoft.Extensions.Http.Resilience` to `9.7.0`
- `Microsoft.SemanticKernel` to `1.60.0`
- `MinimalHelpers.FluentValidation` to `1.1.4`
- `Swashbuckle.AspNetCore.SwaggerUI` to `9.0.3`
2025-07-10 10:15:57 +02:00
Marco Minerva f8a48930f3 Enhance UI and improve code documentation
Updated button styles in Documents.razor for better appearance and usability. Improved the document table layout for responsiveness, integrating checkboxes into rows. Corrected comments in VectorSearchService.cs for clarity. Added new styles for content-type badges in app.css.
2025-07-03 11:54:16 +02:00
Marco Minerva b849c78594 Sort citations by filename and page number
Updated the return statement in the `VectorSearchService` class to return citations sorted by `FileName` and `PageNumber`, improving the organization of the output.
2025-07-03 09:31:06 +02:00
Marco Minerva 0a2aaa9e6e Update package versions in SqlDatabaseVectorSearch.csproj
- Updated `Blazor.Bootstrap` from `3.3.1` to `3.4.0`.
- Updated `Microsoft.SemanticKernel` from `1.58.0` to `1.59.0`.
2025-07-02 10:11:29 +02:00
Marco Minerva ddc8ab8791 Enhance documentation and update DocumentChunk model
Updated `copilot-instructions.md` to include new guidelines for Markdown documentation and testing practices. Modified the `DocumentChunk` record in `DocumentChunk.cs` to add `PageNumber` and `IndexOnPage` properties. Adjusted `GetChunksAsync` and `GetChunkEmbeddingAsync` methods in `DocumentService.cs` to accommodate the new properties.
2025-07-01 16:21:25 +02:00
Marco Minerva b971b6bf05 Update copilot-instructions with new guidelines
Enhance `copilot-instructions.md` to include updated best practices for code suggestions, style, architecture, documentation, and testing. Key changes emphasize high confidence suggestions, the latest C# features, specific formatting preferences, and comprehensive documentation requirements. Additionally, new testing practices are introduced to streamline unit test additions and ensure code quality.
2025-06-27 11:41:29 +02:00
Marco Minerva b473511fb6 Update Microsoft.SemanticKernel to version 1.58.0
Updated the `Microsoft.SemanticKernel` package from version 1.57.0 to 1.58.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-06-26 09:45:26 +02:00
Marco Minerva 523fac2743 Enhance response formatting in ChatService
Updated response guidelines in ChatService.cs to clarify
requirements for answer formatting, including citation rules
and examples of correct and incorrect responses.
Binary differences noted in SqlDatabaseVectorSearch_WebApp.png,
indicating modifications to the image file.
2025-06-24 15:37:07 +02:00
Marco Minerva 13c0beeee6 Merge pull request #12 from marcominerva/decoder_updates
Add citation supports
2025-06-24 14:54:53 +02:00
Marco Minerva 06c1741f14 Enforce response formatting in ChatService
Updated the ChatService class to require that all responses end with a period and a space. Added a condition to include citations in a specified XML format when the answer is known, and to omit citations when the answer is unknown.
2025-06-24 14:53:14 +02:00
Marco Minerva 9eaed9176c Enhance application description and user guidance
Updated `Home.razor` to provide a more detailed overview of the application's capabilities, including document loading, embedding generation, and semantic search. Improved clarity in the supported features section and added a new feature for citations. Included new paragraphs to encourage user interaction and referenced the README for API usage details.
2025-06-24 14:33:43 +02:00
Marco Minerva 476a7734ef Update README.md to add Minimal API badge
Added a badge for "Minimal API" availability to the README.md file, enhancing the visibility of project features. Existing badges for .NET 9 and Blazor remain unchanged.
2025-06-24 12:57:37 +02:00
Marco Minerva 02861a27c5 Update README.md for clarity and organization
Enhanced the README.md file with the following changes:
- Added badges for .NET 9 and Blazor.
- Rephrased the application overview.
- Structured the Table of Contents for easier navigation.
- Reformatted setup instructions for better readability.
- Provided additional details for configuring the database and OpenAI settings.
- Expanded the supported features section.
- Included examples of API requests and responses.
- Clarified limitations and FAQ sections.
- Added a note about using straight SQL.
2025-06-24 12:55:28 +02:00
Marco Minerva 4e01ec81be Improve README.md for clarity and consistency
Updated the README.md file to enhance readability and grammatical structure. Key changes include improved phrasing, added missing commas, consistent formatting of section headers and bullet points, and correction of typographical errors. The description of the response streaming feature was also clarified to provide a better understanding of the application's functionality.
2025-06-24 12:25:42 +02:00
Marco Minerva 30fba5cfe0 Add citations feature and update streaming responses
- Updated README.md to include a new **Citations** feature, detailing how users can access source information.
- Modified JSON response examples to include a `citations` field and updated token usage details.
- Enhanced streaming response section to clarify the end of the stream includes citations.
- Adjusted `VectorSearchService.cs` to return `StreamState.End` and improved citation handling in streaming.
- Updated `appsettings.json` with new model IDs for Azure OpenAI configuration.
2025-06-24 12:16:48 +02:00
Marco Minerva c6ad2ca3ea Update package versions for dependencies
- Updated `Microsoft.SemanticKernel` to version `1.57.0`.
- Updated `Swashbuckle.AspNetCore.SwaggerUI` to version `9.0.1`.
- Updated `TinyHelpers.AspNetCore` to version `4.0.29`.
2025-06-19 09:27:24 +02:00
Marco Minerva 765daa8544 Refactor citation and token usage handling
Updated comments for clarity and streamlined logic for managing tokenUsageResponse. Removed explicit null checks in favor of a null-coalescing assignment. Ensured citations are always extracted and returned at the end of the streaming process.
2025-06-18 14:51:26 +02:00
Marco Minerva e0cf824dd6 Refactor document processing and embedding generation
- Updated `DocxContentDecoder` to process Word documents as chunks of text, removing page tracking and enhancing content handling.
- Modified `VectorSearchService.ImportAsync` to work with chunks, implementing batching for embedding generation.
- Added `EmbeddingBatchSize` property to `AppSettings` for configurable batch processing.
- Updated `appsettings.json` to include the new `EmbeddingBatchSize` setting for improved control over embedding processes.
2025-06-18 14:45:08 +02:00
Marco Minerva 1975d63189 Improve layout and readability in Documents.razor
- Wrapped checkbox input in a div for better alignment.
- Changed documents initialization from an empty array to a list.
- Updated document addition code for improved readability.
- Modified ConfirmDialogOptions and ToastMessage initializations to use object initializer syntax.
- Translated comment in DocxContentDecoder.cs from Italian to English.
2025-06-11 17:47:44 +02:00
Marco Minerva cdbe2e3a91 Enhance content decoders and update dependencies
- Modified `DocxContentDecoder` to use `IServiceProvider` for text chunking and improved paragraph processing with page break handling.
- Updated `PdfContentDecoder` and `TextContentDecoder` to trim whitespace from text before splitting into paragraphs.
- Reordered service registrations in `Program.cs` while retaining existing functionality.
- Updated `SqlDatabaseVectorSearch.csproj` with new package versions for several dependencies, including `Microsoft.AspNetCore.OpenApi` and `Microsoft.EntityFrameworkCore`.
2025-06-11 17:20:56 +02:00
Marco Minerva c9c5b74e75 Update response guidelines in ChatService class
Modified response examples and citation rules in ChatService.cs.
Changed context from France to Italy, added conditions for including citations, and emphasized formatting requirements. Updated examples to ensure compliance with new guidelines.
2025-06-10 12:19:37 +02:00
Marco Minerva 3f5f44145f Enforce strict citation formatting in services
Updated `ChatService` to ensure citations are enclosed in XML tags with a consistent format. Modified `VectorSearchService` to implement a new regex pattern for citation matching and improved text cleaning by removing citation content more efficiently.
2025-06-10 12:07:35 +02:00
Marco Minerva 4571478787 Enhance citation handling and formatting
Updated citation management in the application by removing the `RemoveCitations` and `ExtractCitations` methods in `Ask.razor`, and directly processing citations from the `delta` object. The `Response` class now includes a `Citations` property for better data handling.

Modified `VectorSearchService.cs` to extract citations from the full answer in `AskQuestionAsync` and return them at the end of the streaming process in `AskStreamingAsync`.

Introduced a new `Citation` class in `Citation.cs` to encapsulate citation properties, ensuring structured management of citation data.

Updated citation formatting rules to enforce a specific XML format, ensuring citations are presented at the end of responses rather than within the answer text.
2025-06-10 11:50:51 +02:00
Marco Minerva cdf8356e11 Enhance citation handling and document chunk structure
- Updated `Ask.razor` to change `PageNumber` to a nullable integer and added `IndexOnPage` to the `Citation` class. Adjusted regex for citation parsing.
- Introduced `PageNumber` and `IndexOnPage` properties in `DocumentChunk.cs`, marking `Content` as required.
- Modified migration files to reflect changes in `DocumentChunk` and `Document` entities.
- Updated citation format in `ChatService.cs` to include `index-on-page` and adjusted document chunk text formatting.
- Changed embedding generation method in `VectorSearchService.cs` and updated document chunk creation to include new properties.
2025-06-06 11:26:27 +02:00
Marco Minerva dc6bbfde91 Update content decoding and validation logic
- Changed `PageNumber` in `Chunk` to nullable `int?` in `IContentDecoder` and updated related logic in `TextContentDecoder`.
- Revised citation rules in `ChatService` for stricter placement and formatting.
- Introduced `QuestionValidator` class with validation rules for `Question` model's `Text` property.
2025-06-06 10:50:03 +02:00
Marco Minerva 5530a84d82 Update citation handling and formatting in Ask.razor
Refactor regex pattern in `Ask.razor` to capture
`document-id` and `chunk-id`. Update `Citation` class
to include new properties and make `PageNumber` nullable.
Adjust citation addition logic and citation format rules.
Modify chunk text formatting in `ChatService.cs` to
include page number.
2025-06-05 16:25:16 +02:00
Marco Minerva 9f5bd02f78 Refactor citation handling in Ask.razor and ChatService.cs
Updated the assistant message construction in `Ask.razor` to manage citations more effectively by introducing a `RawText` property and a new `RemoveCitations` method. The `ExtractCitations` method now processes raw input for citation extraction.

Removed outdated comments in `ChatService.cs` regarding citation formatting rules, indicating a potential shift in how citation handling is enforced.
2025-06-05 11:48:18 +02:00
Marco Minerva aae42a1658 Enhance .editorconfig with new rules and adjustments
- Added suggestion for collection expressions with loose type matches.
- Introduced diagnostic rule IDE0305 for simplified collection initialization.
2025-06-04 12:48:31 +02:00
Marco Minerva 1c24250a42 Add citation handling and styling in Ask.razor
Updated Ask.razor to include regex for citation extraction and display.
Introduced a new method to extract citations and updated the Message
class to store them. Added a Citation class for individual citation
representation. Enhanced app.css with styles for citation display.
2025-06-04 12:34:02 +02:00
Marco Minerva 0766103b9a Refactor ChatService and VectorSearchService parameters
Updated parameter types in ChatService and VectorSearchService from IEnumerable<string> to IEnumerable<Entities.DocumentChunk> for better structure. Enhanced citation formatting rules in ChatService. Increased MaxRelevantChunks and MaxInputTokens in appsettings.json to improve processing capabilities.
2025-06-04 11:42:24 +02:00
Marco Minerva 2fc070d0aa Refactor response handling and content decoding
- Updated `TextContentDecoder` to use `ITextChunker` for paragraph splitting and return a list of `Chunk` objects.
- Changed return type of `Stream` method in `AskEndpoints.cs` from `IAsyncEnumerable<QuestionResponse>` to `IAsyncEnumerable<Response>`.
- Removed `QuestionResponse` class and introduced `Response` class to better handle streaming responses.
- Modified `AskQuestionAsync` and `AskStreamingAsync` methods in `VectorSearchService` to return `Response` instead of `QuestionResponse`, and adjusted token count calculation.
- Added namespace declaration in `Response.cs` and defined properties to align with new response structure.
2025-06-04 10:22:15 +02:00
Marco Minerva a7fef36b66 Merge branch 'master' into decoder_updates 2025-06-04 10:08:35 +02:00
Marco Minerva 12e8a042db Update Microsoft.SemanticKernel to version 1.55.0
Updated the `Microsoft.SemanticKernel` package version from `1.54.0` to `1.55.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-06-04 10:08:21 +02:00
Marco Minerva c0051dbeb7 Update Swashbuckle.AspNetCore.SwaggerUI version
Updated the `Swashbuckle.AspNetCore.SwaggerUI` package from version `8.1.2` to `8.1.3` in the `SqlDatabaseVectorSearch.csproj` file.
2025-06-03 11:28:32 +02:00