Skip to content

Commit 0c41cd5

Browse files
committed
Refactor IngestedChunk and IngestedDocument properties to use string.Empty for initialization
- Updated IngestedChunk and IngestedDocument classes to initialize required string properties with string.Empty instead of using 'required' keyword. - Modified PDFDirectorySource to replace TextChunker with TextSplitter for paragraph splitting. - Updated project files to remove unnecessary comments and ensure consistent SDK declarations. - Changed service registration methods for SQLite collections to use the new ElBruno.Connectors.SqliteVec package. - Cleaned up code formatting and ensured proper usage of namespaces across various services.
1 parent 9e62c77 commit 0c41cd5

57 files changed

Lines changed: 132 additions & 157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

prompts/agentfx-vectordata-sqlite/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44

5-
🔴 **NOT STARTED**The 5 AgentFx projects still use `Microsoft.SemanticKernel.Connectors.SqliteVec` and `Microsoft.SemanticKernel.Core`. These are the **last SK dependencies** in the repo.
5+
🟢 **DONE**All 5 AgentFx projects now use `ElBruno.Connectors.SqliteVec` instead of `Microsoft.SemanticKernel.Connectors.SqliteVec` and `Microsoft.SemanticKernel.Core`.
66

77
## Goal
88

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.AppHost/AgentFx-AIWebChatApp-AG-UI.AppHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.0" />
44

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.ServiceDefaults/AgentFx-AIWebChatApp-AG-UI.ServiceDefaults.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.Web/AgentFx-AIWebChatApp-AG-UI.Web.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@
1212
<PackageReference Include="Microsoft.Agents.AI.AGUI" Version="1.0.0-preview.251114.1" />
1313
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
1414
<PackageReference Include="Microsoft.Extensions.AI" Version="10.3.0" />
15-
<!-- SK retained: SqliteVec provides the only VectorStoreCollection<TKey,TRecord> implementation for sqlite-vec.
16-
TextChunker (SK.Core) has no MEAI-native replacement. Remove when MEAI-native sqlite-vec + text chunker packages exist. -->
17-
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="1.71.0" />
15+
<PackageReference Include="ElBruno.Connectors.SqliteVec" Version="0.5.1-preview" />
1816
<PackageReference Include="PdfPig" Version="0.1.13-alpha-20251115-aef0a" />
1917
<PackageReference Include="System.Linq.Async" Version="7.0.0" />
20-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.SqliteVec" Version="1.68.0-preview" />
2118

2219
<!-- Microsoft Agent Framework packages -->
2320
<PackageReference Include="Microsoft.Agents.AI" Version="1.0.0-preview.260108.1" />

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.Web/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using AgentFx_AIWebChatApp_AG_UI.Web.Components;
22
using AgentFx_AIWebChatApp_AG_UI.Web.Services;
33
using AgentFx_AIWebChatApp_AG_UI.Web.Services.Ingestion;
4+
using ElBruno.Connectors.SqliteVec;
45
using Microsoft.Agents.AI;
56
using Microsoft.Agents.AI.AGUI;
67
using Microsoft.Agents.AI.Hosting;
@@ -57,8 +58,8 @@
5758

5859
var vectorStorePath = Path.Combine(AppContext.BaseDirectory, "vector-store.db");
5960
var vectorStoreConnectionString = $"Data Source={vectorStorePath}";
60-
builder.Services.AddSqliteCollection<string, IngestedChunk>("data-agentfx-aiwebchatapp-ag-ui-chunks", vectorStoreConnectionString);
61-
builder.Services.AddSqliteCollection<string, IngestedDocument>("data-agentfx-aiwebchatapp-ag-ui-documents", vectorStoreConnectionString);
61+
builder.Services.AddSqliteVecCollection<string, IngestedChunk>("data-agentfx-aiwebchatapp-ag-ui-chunks", vectorStoreConnectionString);
62+
builder.Services.AddSqliteVecCollection<string, IngestedDocument>("data-agentfx-aiwebchatapp-ag-ui-documents", vectorStoreConnectionString);
6263
builder.Services.AddScoped<DataIngestor>();
6364
builder.Services.AddSingleton<SemanticSearch>();
6465

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.Web/Services/IngestedChunk.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Extensions.VectorData;
1+
using Microsoft.Extensions.VectorData;
22

33
namespace AgentFx_AIWebChatApp_AG_UI.Web.Services;
44

@@ -8,16 +8,16 @@ public class IngestedChunk
88
private const string VectorDistanceFunction = DistanceFunction.CosineDistance;
99

1010
[VectorStoreKey]
11-
public required string Key { get; set; }
11+
public string Key { get; set; } = string.Empty;
1212

1313
[VectorStoreData(IsIndexed = true)]
14-
public required string DocumentId { get; set; }
14+
public string DocumentId { get; set; } = string.Empty;
1515

1616
[VectorStoreData]
1717
public int PageNumber { get; set; }
1818

1919
[VectorStoreData]
20-
public required string Text { get; set; }
20+
public string Text { get; set; } = string.Empty;
2121

2222
[VectorStoreVector(VectorDimensions, DistanceFunction = VectorDistanceFunction)]
2323
public string? Vector => Text;

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.Web/Services/IngestedDocument.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Extensions.VectorData;
1+
using Microsoft.Extensions.VectorData;
22

33
namespace AgentFx_AIWebChatApp_AG_UI.Web.Services;
44

@@ -8,16 +8,16 @@ public class IngestedDocument
88
private const string VectorDistanceFunction = DistanceFunction.CosineDistance;
99

1010
[VectorStoreKey]
11-
public required string Key { get; set; }
11+
public string Key { get; set; } = string.Empty;
1212

1313
[VectorStoreData(IsIndexed = true)]
14-
public required string SourceId { get; set; }
14+
public string SourceId { get; set; } = string.Empty;
1515

1616
[VectorStoreData]
17-
public required string DocumentId { get; set; }
17+
public string DocumentId { get; set; } = string.Empty;
1818

1919
[VectorStoreData]
20-
public required string DocumentVersion { get; set; }
20+
public string DocumentVersion { get; set; } = string.Empty;
2121

2222
// The vector is not used but required for some vector databases
2323
[VectorStoreVector(VectorDimensions, DistanceFunction = VectorDistanceFunction)]

samples/AgentFx/AgentFx-AIWebChatApp-AG-UI/AgentFx-AIWebChatApp-AG-UI.Web/Services/Ingestion/PDFDirectorySource.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// SK dependency: TextChunker has no MEAI-native replacement yet
2-
using Microsoft.SemanticKernel.Text;
1+
using ElBruno.Connectors.SqliteVec;
32
using UglyToad.PdfPig;
43
using UglyToad.PdfPig.Content;
54
using UglyToad.PdfPig.DocumentLayoutAnalysis.PageSegmenter;
@@ -64,9 +63,7 @@ public Task<IEnumerable<IngestedChunk>> CreateChunksForDocumentAsync(IngestedDoc
6463
var pageText = string.Join(Environment.NewLine + Environment.NewLine,
6564
textBlocks.Select(t => t.Text.ReplaceLineEndings(" ")));
6665

67-
#pragma warning disable SKEXP0050 // Type is for evaluation purposes only
68-
return TextChunker.SplitPlainTextParagraphs([pageText], 200)
66+
return TextSplitter.SplitParagraphs([pageText], 200)
6967
.Select((text, index) => (pdfPage.Number, index, text));
70-
#pragma warning restore SKEXP0050 // Type is for evaluation purposes only
7168
}
7269
}

samples/AgentFx/AgentFx-AIWebChatApp-Middleware/ChatApp20/ChatApp20.ServiceDefaults/ChatApp20.ServiceDefaults.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

samples/AgentFx/AgentFx-AIWebChatApp-Middleware/ChatApp20/ChatApp20.Web/ChatApp20.Web.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
<PackageReference Include="Microsoft.Agents.AI.OpenAI" Version="1.0.0-preview.260108.1" />
1717
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
1818
<PackageReference Include="Microsoft.Extensions.AI" Version="10.3.0" />
19-
<!-- SK retained: SqliteVec provides the only VectorStoreCollection<TKey,TRecord> implementation for sqlite-vec.
20-
TextChunker (SK.Core) has no MEAI-native replacement. Remove when MEAI-native sqlite-vec + text chunker packages exist. -->
21-
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="1.71.0" />
19+
<PackageReference Include="ElBruno.Connectors.SqliteVec" Version="0.5.1-preview" />
2220
<PackageReference Include="PdfPig" Version="0.1.12-alpha-20251029-e11dc" />
2321
<PackageReference Include="System.Linq.Async" Version="7.0.0" />
24-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.SqliteVec" Version="1.68.0-preview" />
2522
</ItemGroup>
2623

2724
<ItemGroup>

0 commit comments

Comments
 (0)