diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/IngestedDocument.cs b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/IngestedDocument.cs index 5306dc3f408..c99a2c78423 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/IngestedDocument.cs +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/IngestedDocument.cs @@ -21,6 +21,6 @@ public class IngestedDocument public required string DocumentVersion { get; set; } // The vector is not used but required for some vector databases - [VectorStoreRecordVector(1, DistanceFunction = DistanceFunction.CosineSimilarity)] - public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0]); + [VectorStoreRecordVector(2, DistanceFunction = DistanceFunction.CosineSimilarity)] + public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0, 0]); } diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/Ingestion/PDFDirectorySource.cs b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/Ingestion/PDFDirectorySource.cs index 7d9e4b4b08d..7970123b73d 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/Ingestion/PDFDirectorySource.cs +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/Ingestion/PDFDirectorySource.cs @@ -30,7 +30,7 @@ public Task> GetNewOrModifiedDocumentsAsync(IReadO #if (UseQdrant) results.Add(new() { Key = Guid.CreateVersion7(), SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); #else - results.Add(new() { Key = $"{SourceId}_{sourceFileId}", SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); + results.Add(new() { Key = Guid.CreateVersion7().ToString(), SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); #endif } } @@ -58,7 +58,7 @@ public async Task> CreateChunksForDocumentAsync(IEmbe #if (UseQdrant) Key = Guid.CreateVersion7(), #else - Key = $"{Path.GetFileNameWithoutExtension(document.DocumentId)}_{pair.First.PageNumber}_{pair.First.IndexOnPage}", + Key = Guid.CreateVersion7().ToString(), #endif DocumentId = document.DocumentId, PageNumber = pair.First.PageNumber, diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/IngestedDocument.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/IngestedDocument.cs index 60a42535c79..cc852657143 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/IngestedDocument.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/IngestedDocument.cs @@ -17,6 +17,6 @@ public class IngestedDocument public required string DocumentVersion { get; set; } // The vector is not used but required for some vector databases - [VectorStoreRecordVector(1, DistanceFunction = DistanceFunction.CosineSimilarity)] - public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0]); + [VectorStoreRecordVector(2, DistanceFunction = DistanceFunction.CosineSimilarity)] + public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0, 0]); } diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs index 6bd64f345cc..2ede5add217 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs @@ -27,7 +27,7 @@ public Task> GetNewOrModifiedDocumentsAsync(IReadO var existingDocumentVersion = existingDocumentsById.TryGetValue(sourceFileId, out var existingDocument) ? existingDocument.DocumentVersion : null; if (existingDocumentVersion != sourceFileVersion) { - results.Add(new() { Key = $"{SourceId}_{sourceFileId}", SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); + results.Add(new() { Key = Guid.CreateVersion7().ToString(), SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); } } @@ -51,7 +51,7 @@ public async Task> CreateChunksForDocumentAsync(IEmbe return paragraphs.Zip(embeddings).Select((pair, index) => new IngestedChunk { - Key = $"{Path.GetFileNameWithoutExtension(document.DocumentId)}_{pair.First.PageNumber}_{pair.First.IndexOnPage}", + Key = Guid.CreateVersion7().ToString(), DocumentId = document.DocumentId, PageNumber = pair.First.PageNumber, Text = pair.First.Text, diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/IngestedDocument.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/IngestedDocument.cs index 303cdc806b4..4be3b2980d7 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/IngestedDocument.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/IngestedDocument.cs @@ -17,6 +17,6 @@ public class IngestedDocument public required string DocumentVersion { get; set; } // The vector is not used but required for some vector databases - [VectorStoreRecordVector(1, DistanceFunction = DistanceFunction.CosineSimilarity)] - public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0]); + [VectorStoreRecordVector(2, DistanceFunction = DistanceFunction.CosineSimilarity)] + public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0, 0]); } diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/Ingestion/PDFDirectorySource.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/Ingestion/PDFDirectorySource.cs index 32e7c88196f..2bd7a97bd7b 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/Ingestion/PDFDirectorySource.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/Services/Ingestion/PDFDirectorySource.cs @@ -27,7 +27,7 @@ public Task> GetNewOrModifiedDocumentsAsync(IReadO var existingDocumentVersion = existingDocumentsById.TryGetValue(sourceFileId, out var existingDocument) ? existingDocument.DocumentVersion : null; if (existingDocumentVersion != sourceFileVersion) { - results.Add(new() { Key = $"{SourceId}_{sourceFileId}", SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); + results.Add(new() { Key = Guid.CreateVersion7().ToString(), SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); } } @@ -51,7 +51,7 @@ public async Task> CreateChunksForDocumentAsync(IEmbe return paragraphs.Zip(embeddings).Select((pair, index) => new IngestedChunk { - Key = $"{Path.GetFileNameWithoutExtension(document.DocumentId)}_{pair.First.PageNumber}_{pair.First.IndexOnPage}", + Key = Guid.CreateVersion7().ToString(), DocumentId = document.DocumentId, PageNumber = pair.First.PageNumber, Text = pair.First.Text, diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/IngestedDocument.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/IngestedDocument.cs index 60a42535c79..cc852657143 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/IngestedDocument.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/IngestedDocument.cs @@ -17,6 +17,6 @@ public class IngestedDocument public required string DocumentVersion { get; set; } // The vector is not used but required for some vector databases - [VectorStoreRecordVector(1, DistanceFunction = DistanceFunction.CosineSimilarity)] - public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0]); + [VectorStoreRecordVector(2, DistanceFunction = DistanceFunction.CosineSimilarity)] + public ReadOnlyMemory Vector { get; set; } = new ReadOnlyMemory([0, 0]); } diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs index 6bd64f345cc..2ede5add217 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/Services/Ingestion/PDFDirectorySource.cs @@ -27,7 +27,7 @@ public Task> GetNewOrModifiedDocumentsAsync(IReadO var existingDocumentVersion = existingDocumentsById.TryGetValue(sourceFileId, out var existingDocument) ? existingDocument.DocumentVersion : null; if (existingDocumentVersion != sourceFileVersion) { - results.Add(new() { Key = $"{SourceId}_{sourceFileId}", SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); + results.Add(new() { Key = Guid.CreateVersion7().ToString(), SourceId = SourceId, DocumentId = sourceFileId, DocumentVersion = sourceFileVersion }); } } @@ -51,7 +51,7 @@ public async Task> CreateChunksForDocumentAsync(IEmbe return paragraphs.Zip(embeddings).Select((pair, index) => new IngestedChunk { - Key = $"{Path.GetFileNameWithoutExtension(document.DocumentId)}_{pair.First.PageNumber}_{pair.First.IndexOnPage}", + Key = Guid.CreateVersion7().ToString(), DocumentId = document.DocumentId, PageNumber = pair.First.PageNumber, Text = pair.First.Text,