Commit Graph

157 Commits

Author SHA1 Message Date
Marco Minerva 0435f042f1 Refactor to use EF Core for database operations
Refactored the codebase to replace raw SQL connections and Dapper with Entity Framework Core (EF Core). Modified `Program.cs` to configure EF Core services. Refactored `VectorSearchService` to use EF Core for all database operations. Updated project dependencies to remove Dapper and `Microsoft.Data.SqlClient`, and add EF Core packages. Added `ApplicationDbContext` for EF Core context and new `Document` and `DocumentChunk` classes for entity models.
2024-10-31 15:16:38 +01:00
Marco Minerva 1d8fa7db12 Update Microsoft.SemanticKernel to 1.25.0
Updated the Microsoft.SemanticKernel package version from 1.24.1 to 1.25.0 in the SqlDatabaseVectorSearch.csproj file.
2024-10-29 10:23:08 +01:00
Marco Minerva bc26c03629 Update package versions in SqlDatabaseVectorSearch.csproj
Updated Microsoft.SemanticKernel from 1.22.0 to 1.24.1.
Updated MinimalHelpers.OpenApi from 2.0.16 to 2.0.17.
These updates may include bug fixes, performance improvements,
or new features.
2024-10-22 10:30:52 +02:00
Marco Minerva 1a5542f1d2 Refactor to use Dapper async methods and improve readability
Refactored code to utilize Dapper's `ExecuteAsync` and `ExecuteScalarAsync` methods, reducing boilerplate and simplifying SQL command execution. Updated `DeleteDocumentAsync` to a concise expression-bodied member. Replaced manual SQL parameter addition with anonymous objects for better readability and maintainability. Transaction handling remains unchanged to ensure consistent database operations.
2024-10-16 15:06:34 +02:00
Marco Minerva 31b2a79b9f Update package dependencies in SqlDatabaseVectorSearch.csproj
Updated the following package dependencies:
- MinimalHelpers.OpenApi from 2.0.15 to 2.0.16
- Swashbuckle.AspNetCore from 6.8.1 to 6.9.0
- TinyHelpers.AspNetCore from 3.1.17 to 3.1.19
2024-10-15 14:53:41 +02:00
Marco Minerva 3445059746 Enhance ChatService response instructions with example
Updated the `AskQuestionAsync` method in `ChatService.cs` to include an additional example in the `ChatHistory` object. This example clarifies how the service should respond when the requested information is not available in the given context, such as responding with "This information isn't available in the given context" if a user asks "What is the capital of France?" and there is no information about France in the chat.
2024-10-14 12:11:25 +02:00
Marco Minerva 5c0cf1cbd0 Update dependencies and remove unused EF Core
Removed the Microsoft.EntityFrameworkCore namespace from Program.cs.
In SqlDatabaseVectorSearch.csproj:
- Removed EntityFrameworkCore.Exceptions.SqlServer package.
- Updated Microsoft.AspNetCore.OpenApi from 8.0.8 to 8.0.10.
- Updated Microsoft.SemanticKernel from 1.21.1 to 1.22.0.
- Updated TinyHelpers from 3.1.16 to 3.1.18.
2024-10-14 09:58:59 +02:00
Marco Minerva c86bea6645 Merge branch 'master' of https://github.com/marcominerva/SqlDatabaseVectorSearch 2024-10-08 09:53:58 +02:00
Marco Minerva 8c1915f964 Update PdfPig package to version 0.1.9
The version of the PdfPig package has been updated from 0.1.8 to 0.1.9.
2024-10-08 09:53:53 +02:00
Marco Minerva a0f3679262 Update README.md 2024-10-01 17:57:25 +02:00
Marco Minerva a362083227 Merge pull request #1 from marcominerva/vector-type
Add support for native VECTOR type
2024-10-01 17:39:00 +02:00
Marco Minerva 8c6cc3c969 Improve README, add comments, and clean up VectorSearchService
Updated README.md for clarity and additional setup instructions:
- Refined repository description to highlight native Vector type.
- Rephrased note on Vector Support feature for readability.
- Removed mention of EFCore.SqlServer.VectorSearch library.
- Added instructions for updating VECTOR column size and setting Dimension property.

Added comment in Scripts.sql to guide vector size setting in Embedding column.

Cleaned up VectorSearchService.cs by removing unused and commented-out SQL command execution code.
2024-10-01 17:35:59 +02:00
Marco Minerva 1b2ebbd6a3 Update PK constraints, API description, and config comment
Updated primary key constraint names in Scripts.sql for Documents
and DocumentChunks tables. Enhanced document upload API endpoint
description in Program.cs to reflect the use of the new native
Vector type for embeddings. Added a comment in appsettings.json
to clarify the Dimensions setting in the Embedding section.
2024-10-01 14:37:01 +02:00
Marco Minerva 4355f72dab Refactor DB operations, rename tables, add Dapper
Refactored `VectorSearchService.cs` to use Dapper for DB operations, replacing raw ADO.NET commands. Updated methods for inserting, retrieving, and deleting documents and chunks. Modified vector search query to use Dapper's `QueryAsync`.

Updated `SqlDatabaseVectorSearch.csproj` to include Dapper package reference, version `2.1.35`.
2024-10-01 11:39:21 +02:00
Marco Minerva 2dff0aae55 Add dimensions parameter for embeddings; reformat SQL
Updated Program.cs to include dimensions parameter for AddAzureOpenAITextEmbeddingGeneration sourced from aiSettings.Embedding.Dimensions. Reformatted SQL command texts in VectorSearchService.cs for better readability. Introduced EmbeddingServiceSettings class in AzureOpenAISettings.cs to allow optional dimensions configuration. Updated appsettings.json to include new Dimensions property under Embedding section.
2024-09-30 17:53:59 +02:00
Marco Minerva 3e95251485 Refactor to use the native VECTOR type 2024-09-30 17:08:28 +02:00
Marco Minerva 1ef2076ba6 Update package dependencies in SqlDatabaseVectorSearch.csproj
Updated the following package dependencies:
- Microsoft.SemanticKernel: 1.18.2 -> 1.21.1
- MinimalHelpers.OpenApi: 2.0.12 -> 2.0.15
- Swashbuckle.AspNetCore: 6.7.3 -> 6.8.1
- TinyHelpers.AspNetCore: 3.1.9 -> 3.1.17
2024-09-30 14:55:57 +02:00
Marco Minerva 3c7b076659 Remove custom Swagger UI stylesheet and checkbox width
The custom stylesheet injection for Swagger UI has been removed.
Specific width constraints for checkbox inputs in the Swagger UI
have been removed from the CSS.
2024-09-05 14:39:44 +02:00
Marco Minerva 6757631511 Update package dependencies in SqlDatabaseVectorSearch.csproj
Updated the following package dependencies:
- Microsoft.SemanticKernel from 1.17.2 to 1.18.2
- MinimalHelpers.OpenApi from 2.0.11 to 2.0.12
- TinyHelpers from 3.1.11 to 3.1.16
- TinyHelpers.AspNetCore from 3.1.8 to 3.1.9
2024-09-04 11:12:08 +02:00
Marco Minerva 05d18c5f97 Fix typos 2024-09-02 10:48:23 +02:00
Marco Minerva b6a09d0926 Data access optimizations 2024-09-02 10:42:30 +02:00
Marco Minerva e4570008e0 Update package dependencies in SqlDatabaseVectorSearch.csproj
Updated the following package versions:
- EntityFrameworkCore.Exceptions.SqlServer: 8.1.2 -> 8.1.3
- Microsoft.AspNetCore.OpenApi: 8.0.7 -> 8.0.8
- Microsoft.EntityFrameworkCore.SqlServer: 8.0.7 -> 8.0.8
- Microsoft.SemanticKernel: 1.16.2 -> 1.17.2
- Swashbuckle.AspNetCore: 6.7.0 -> 6.7.3
2024-09-02 10:39:21 +02:00
Marco Minerva b628c8996e Fix a typo in the documentation 2024-08-02 15:33:51 +02:00
Marco Minerva 17eee5f775 Optimize query performance and memory usage 2024-08-02 14:56:19 +02:00
Marco Minerva 1264b7f502 Correct a typo 2024-08-02 12:24:34 +02:00
Marco Minerva 3c78af133b Merge branch 'master' of https://github.com/marcominerva/SqlDatabaseVectorSearch 2024-08-01 15:41:45 +02:00
Marco Minerva e54a091106 Update Swagger config and package versions
- Removed AddFormFile method from Swagger config in Program.cs
- Updated package versions in SqlDatabaseVectorSearch.csproj:
  - Microsoft.SemanticKernel to 1.16.2
  - MinimalHelpers.OpenApi to 2.0.11
  - Swashbuckle.AspNetCore to 6.7.0
  - TinyHelpers to 3.1.11
  - TinyHelpers.AspNetCore to 3.1.8
- Removed old package references from SqlDatabaseVectorSearch.csproj
2024-08-01 15:41:42 +02:00
Marco Minerva 468b6e7c5c Update README.md 2024-07-22 12:48:51 +02:00
Marco Minerva e59941cb0f Update documentation 2024-07-22 12:40:00 +02:00
Marco Minerva 80dfac47e5 Delete unused setting 2024-07-19 12:49:01 +02:00
Marco Minerva 6e716f3984 Optimize delete logic 2024-07-19 11:31:54 +02:00
Marco Minerva c98a230586 Fix class declaration 2024-07-19 11:09:50 +02:00
Marco Minerva c1180d3a4f Optimize chunks retrieval 2024-07-19 11:01:44 +02:00
Marco Minerva 21b61281a7 Fix documentation 2024-07-19 10:58:56 +02:00
Marco Minerva b66e64f6a2 Fix documentation 2024-07-19 10:48:51 +02:00
Marco Minerva 0f7b0da0f0 Update Microsoft.SemanticKernel to 1.16.0
Updated the Microsoft.SemanticKernel package version from 1.15.1 to 1.16.0 in the SqlDatabaseVectorSearch.csproj file.
2024-07-17 15:06:44 +02:00
Marco Minerva 45de38d87a Enhanced document chunk handling and API
- Updated `Scripts.sql` to add a new `[Index]` column to `[dbo].[DocumentChunks]` for order tracking.
- Modified `DocumentChunk.cs` to include a new `Index` property, and introduced a new immutable record class for document chunks.
- Introduced new API endpoints in `Program.cs` for document and chunk retrieval, including embedding details, with OpenAPI documentation enhancements.
- Updated an API endpoint description in `Program.cs` to clarify document embedding handling.
- Updated `VectorSearchService.cs` to reflect schema changes in service logic, adding methods for fetching document chunks and specific embeddings.
2024-07-10 11:25:50 +02:00
Marco Minerva ad6faee370 Update package versions for project dependencies
- Updated `Microsoft.AspNetCore.OpenApi` from `8.0.6` to `8.0.7`
- Updated `Microsoft.EntityFrameworkCore.SqlServer` from `8.0.6` to `8.0.7`
- Updated `Microsoft.SemanticKernel` from `1.15.0` to `1.15.1`
- Updated `TinyHelpers` from `3.1.7` to `3.1.10`
2024-07-10 10:44:25 +02:00
Marco Minerva 01016e54e8 Refactor and update Swagger docs in Program.cs
Updated Swagger documentation title and endpoint description in Program.cs to reflect a shift towards general SQL Database usage instead of specific SQL Server implementation. Simplified the document upload endpoint by removing the `LinkGenerator` parameter and enhancing clarity in operation descriptions, emphasizing support for uploading documents to SQL databases for indexing and question answering purposes.
2024-07-02 10:48:03 +02:00
Marco Minerva f3a0ec7c31 Little refactoring 2024-07-01 09:49:34 +02:00
Marco Minerva 8ef8836075 Minor updates 2024-06-26 11:05:00 +02:00
Marco Minerva 1840a63d75 Better transaction on document save 2024-06-24 10:31:57 +02:00
Marco Minerva 7a97000c10 Update libraries 2024-06-24 09:45:05 +02:00
Marco Minerva c72ed3054b Update Semantical Kernel comment 2024-06-20 17:21:07 +02:00
Marco Minerva fa58e02709 Refactor and enhance config management
Refactored code to centralize configuration access through a single `AppSettings` instance in `ChatService` and `VectorSearchService`, improving maintainability and reducing verbosity. Introduced new configuration settings (`MaxTokensPerLine`, `MaxTokensPerParagraph`, `OverlapTokens`, `MaxChunksCount`) in `AppSettings.cs` and `appsettings.json` for enhanced flexibility in content processing. Adjusted existing settings usage (`MessageLimit`, `MessageExpiration`) to align with the new access method, and removed obsolete settings (`StoragePath`, `VectorDbPath`, `QueuePath`). These changes simplify the codebase, make the application more configurable and adaptable to different content characteristics, and allow for more controlled vector search operations.
2024-06-17 11:58:30 +02:00
Marco Minerva 7892f01f84 Refactor AskQuestionAsync in ChatService 2024-06-17 11:02:51 +02:00
Marco Minerva 6790850afe Update README.md 2024-06-14 17:56:07 +02:00
Marco Minerva 7848252fae Update README.md 2024-06-14 17:49:48 +02:00
Marco Minerva a51618fd91 Rename Script.sql to Scripts.sql 2024-06-14 17:47:46 +02:00
Marco Minerva 7251e4c902 Update README.md 2024-06-14 17:47:17 +02:00