Skip to content

Commit 48ddf67

Browse files
committed
address code review feedback
1 parent c3c710c commit 48ddf67

File tree

10 files changed

+77
-107
lines changed

10 files changed

+77
-107
lines changed

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionChunk.cs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Diagnostics;
7-
using System.Diagnostics.CodeAnalysis;
87
using Microsoft.Shared.Diagnostics;
98

109
namespace Microsoft.Extensions.DataIngestion;
@@ -13,37 +12,11 @@ namespace Microsoft.Extensions.DataIngestion;
1312
/// Represents a chunk of content extracted from an <see cref="IngestionDocument"/>.
1413
/// </summary>
1514
/// <typeparam name="T">The type of the content.</typeparam>
16-
[DebuggerDisplay("{Content}")]
17-
[Experimental("MEDI001")]
15+
[DebuggerDisplay("Content = {Content}")]
1816
public sealed class IngestionChunk<T>
1917
{
2018
private Dictionary<string, object>? _metadata;
2119

22-
/// <summary>
23-
/// Gets the content of the chunk.
24-
/// </summary>
25-
public T Content { get; }
26-
27-
/// <summary>
28-
/// Gets the document from which this chunk was extracted.
29-
/// </summary>
30-
public IngestionDocument Document { get; }
31-
32-
/// <summary>
33-
/// Gets additional context for the chunk.
34-
/// </summary>
35-
public string? Context { get; }
36-
37-
/// <summary>
38-
/// Gets a value indicating whether this chunk has metadata.
39-
/// </summary>
40-
public bool HasMetadata => _metadata?.Count > 0;
41-
42-
/// <summary>
43-
/// Gets the metadata associated with this chunk.
44-
/// </summary>
45-
public IDictionary<string, object> Metadata => _metadata ??= [];
46-
4720
/// <summary>
4821
/// Initializes a new instance of the <see cref="IngestionChunk{T}"/> class.
4922
/// </summary>
@@ -70,4 +43,29 @@ public IngestionChunk(T content, IngestionDocument document, string? context = n
7043
Document = Throw.IfNull(document);
7144
Context = context;
7245
}
46+
47+
/// <summary>
48+
/// Gets the content of the chunk.
49+
/// </summary>
50+
public T Content { get; }
51+
52+
/// <summary>
53+
/// Gets the document from which this chunk was extracted.
54+
/// </summary>
55+
public IngestionDocument Document { get; }
56+
57+
/// <summary>
58+
/// Gets additional context for the chunk.
59+
/// </summary>
60+
public string? Context { get; }
61+
62+
/// <summary>
63+
/// Gets a value indicating whether this chunk has metadata.
64+
/// </summary>
65+
public bool HasMetadata => _metadata?.Count > 0;
66+
67+
/// <summary>
68+
/// Gets the metadata associated with this chunk.
69+
/// </summary>
70+
public IDictionary<string, object> Metadata => _metadata ??= [];
7371
}

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionChunkProcessor.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Generic;
5-
using System.Diagnostics.CodeAnalysis;
65
using System.Threading;
76

87
namespace Microsoft.Extensions.DataIngestion;
@@ -11,7 +10,6 @@ namespace Microsoft.Extensions.DataIngestion;
1110
/// Processes chunks in a pipeline.
1211
/// </summary>
1312
/// <typeparam name="T">The type of the chunk content.</typeparam>
14-
[Experimental("MEDI001")]
1513
public abstract class IngestionChunkProcessor<T>
1614
{
1715
/// <summary>

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionChunkWriter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Diagnostics.CodeAnalysis;
76
using System.Threading;
87
using System.Threading.Tasks;
98

@@ -13,7 +12,6 @@ namespace Microsoft.Extensions.DataIngestion;
1312
/// Writes chunks to a destination.
1413
/// </summary>
1514
/// <typeparam name="T">The type of the chunk content.</typeparam>
16-
[Experimental("MEDI001")]
1715
public abstract class IngestionChunkWriter<T> : IDisposable
1816
{
1917
/// <summary>

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionChunker.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Generic;
5-
using System.Diagnostics.CodeAnalysis;
65
using System.Threading;
76

87
namespace Microsoft.Extensions.DataIngestion;
@@ -11,7 +10,6 @@ namespace Microsoft.Extensions.DataIngestion;
1110
/// Splits an <see cref="IngestionDocument"/> into chunks.
1211
/// </summary>
1312
/// <typeparam name="T">The type of the chunk content.</typeparam>
14-
[Experimental("MEDI001")]
1513
public abstract class IngestionChunker<T>
1614
{
1715
/// <summary>

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionDocument.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Diagnostics.CodeAnalysis;
76
using Microsoft.Shared.Diagnostics;
87

98
namespace Microsoft.Extensions.DataIngestion;
109

1110
/// <summary>
1211
/// A format-agnostic container that normalizes diverse input formats into a structured hierarchy.
1312
/// </summary>
14-
[Experimental("MEDI001")]
1513
public sealed class IngestionDocument
1614
{
1715
/// <summary>

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionDocumentElement.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Diagnostics;
7-
using System.Diagnostics.CodeAnalysis;
87
using System.Linq;
98
using Microsoft.Shared.Diagnostics;
109

@@ -15,11 +14,12 @@ namespace Microsoft.Extensions.DataIngestion;
1514
/// <summary>
1615
/// Represents an element within an <see cref="IngestionDocument"/>.
1716
/// </summary>
18-
[DebuggerDisplay("{GetType().Name}: {GetMarkdown()}")]
19-
[Experimental("MEDI001")]
17+
[DebuggerDisplay("Type = {GetType().Name}, Markdown = {GetMarkdown()}")]
2018
public abstract class IngestionDocumentElement
2119
{
22-
private protected string Markdown;
20+
#pragma warning disable IDE1006 // Naming Styles
21+
private protected string _markdown;
22+
#pragma warning restore IDE1006 // Naming Styles
2323

2424
/// <summary>
2525
/// Initializes a new instance of the <see cref="IngestionDocumentElement"/> class.
@@ -28,12 +28,12 @@ public abstract class IngestionDocumentElement
2828
/// <exception cref="ArgumentNullException"><paramref name="markdown"/> is <see langword="null"/> or empty.</exception>
2929
private protected IngestionDocumentElement(string markdown)
3030
{
31-
Markdown = string.IsNullOrEmpty(markdown) ? throw new ArgumentNullException(nameof(markdown)) : markdown;
31+
_markdown = string.IsNullOrEmpty(markdown) ? throw new ArgumentNullException(nameof(markdown)) : markdown;
3232
}
3333

3434
private protected IngestionDocumentElement()
3535
{
36-
Markdown = null!;
36+
_markdown = null!;
3737
}
3838

3939
private Dictionary<string, object?>? _metadata;
@@ -47,7 +47,7 @@ private protected IngestionDocumentElement()
4747
/// Gets the markdown representation of the element.
4848
/// </summary>
4949
/// <returns>The markdown representation.</returns>
50-
public virtual string GetMarkdown() => Markdown;
50+
public virtual string GetMarkdown() => _markdown;
5151

5252
/// <summary>
5353
/// Gets or sets the page number where this element appears.
@@ -68,7 +68,6 @@ private protected IngestionDocumentElement()
6868
/// <summary>
6969
/// A section can be just a page or a logical grouping of elements in a document.
7070
/// </summary>
71-
[Experimental("MEDI001")]
7271
public sealed class IngestionDocumentSection : IngestionDocumentElement
7372
{
7473
/// <summary>
@@ -100,7 +99,6 @@ public override string GetMarkdown()
10099
/// <summary>
101100
/// Represents a paragraph in a document.
102101
/// </summary>
103-
[Experimental("MEDI001")]
104102
public sealed class IngestionDocumentParagraph : IngestionDocumentElement
105103
{
106104
/// <summary>
@@ -116,7 +114,6 @@ public IngestionDocumentParagraph(string markdown)
116114
/// <summary>
117115
/// Represents a header in a document.
118116
/// </summary>
119-
[Experimental("MEDI001")]
120117
public sealed class IngestionDocumentHeader : IngestionDocumentElement
121118
{
122119
/// <summary>
@@ -137,7 +134,6 @@ public IngestionDocumentHeader(string markdown)
137134
/// <summary>
138135
/// Represents a footer in a document.
139136
/// </summary>
140-
[Experimental("MEDI001")]
141137
public sealed class IngestionDocumentFooter : IngestionDocumentElement
142138
{
143139
/// <summary>
@@ -153,7 +149,6 @@ public IngestionDocumentFooter(string markdown)
153149
/// <summary>
154150
/// Represents a table in a document.
155151
/// </summary>
156-
[Experimental("MEDI001")]
157152
public sealed class IngestionDocumentTable : IngestionDocumentElement
158153
{
159154
/// <summary>
@@ -188,7 +183,6 @@ public IngestionDocumentTable(string markdown, IngestionDocumentElement?[,] cell
188183
/// <summary>
189184
/// Represents an image in a document.
190185
/// </summary>
191-
[Experimental("MEDI001")]
192186
public sealed class IngestionDocumentImage : IngestionDocumentElement
193187
{
194188
/// <summary>

src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/IngestionDocumentProcessor.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics.CodeAnalysis;
54
using System.Threading;
65
using System.Threading.Tasks;
76

@@ -10,7 +9,6 @@ namespace Microsoft.Extensions.DataIngestion;
109
/// <summary>
1110
/// Part of the document processing pipeline that takes a <see cref="IngestionDocument"/> as input and produces a (potentially modified) <see cref="IngestionDocument"/> as output.
1211
/// </summary>
13-
[Experimental("MEDI001")]
1412
public abstract class IngestionDocumentProcessor
1513
{
1614
/// <summary>

0 commit comments

Comments
 (0)