19 instantiations of IngestionChunk
Microsoft.Extensions.DataIngestion (3)
Chunkers\DocumentTokenChunker.cs (1)
94
IngestionChunk<string> chunk = new
IngestionChunk
<string>(
Chunkers\ElementsChunker.cs (2)
199
chunks.Add(
new
(_currentChunk.ToString(), document, context));
208
chunks.Add(
new
(_currentChunk.ToString(), document, context));
Microsoft.Extensions.DataIngestion.Tests (16)
IngestionPipelineTests.cs (1)
181
.Select(image => new
IngestionChunk
<DataContent>(
Processors\ClassificationEnricherTests.cs (3)
122
new
(".NET developers need to integrate and interact with a growing variety of artificial intelligence (AI) services in their apps. " +
125
new
("Rabbits are small mammals in the family Leporidae of the order Lagomorpha (along with the hare and the pika)." +
127
new
("This text does not belong to any category.", _document),
Processors\KeywordEnricherTests.cs (2)
122
new
("The Microsoft.Extensions.AI libraries provide a unified approach for representing generative AI components", _document),
123
new
("Rabbits are great pets. They are friendly and make excellent companions.", _document)
Processors\SentimentEnricherTests.cs (4)
109
new
("I love programming! It's so much fun and rewarding.", _document),
110
new
("I hate bugs. They are so frustrating and time-consuming.", _document),
111
new
("The weather is okay, not too bad but not great either.", _document),
112
new
("I hate you. I am sorry, I actually don't. I am not sure myself what my feelings are.", _document)
Processors\SummaryEnricherTests.cs (2)
106
new
("I love programming! It's so much fun and rewarding.", _document),
107
new
("I hate bugs. They are so frustrating and time-consuming.", _document)
Writers\VectorStoreWriterTests.cs (4)
29
new
("some content", document)
78
new
("first chunk", document)
85
new
("second chunk", document)
98
new
("different content", document)
89 references to IngestionChunk
Microsoft.Extensions.DataIngestion (38)
Chunkers\DocumentTokenChunker.cs (3)
43
public override async IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IngestionDocument document, [EnumeratorCancellation] CancellationToken cancellationToken = default)
92
IngestionChunk
<string> FinalizeChunk()
94
IngestionChunk
<string> chunk = new IngestionChunk<string>(
Chunkers\ElementsChunker.cs (2)
35
internal IEnumerable<
IngestionChunk
<string>> Process(IngestionDocument document, string context, List<IngestionDocumentElement> elements)
38
List<
IngestionChunk
<string>> chunks = [];
Chunkers\HeaderChunker.cs (5)
32
public override async IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IngestionDocument document,
46
foreach (
var
chunk in SplitIntoChunks(document, headers, elements))
62
foreach (
var
chunk in SplitIntoChunks(document, headers, elements))
68
private IEnumerable<
IngestionChunk
<string>> SplitIntoChunks(IngestionDocument document, string?[] headers, List<IngestionDocumentElement> elements)
74
foreach (
var
chunk in _elementsChunker.Process(document, chunkHeader, elements))
Chunkers\SectionChunker.cs (5)
29
public override async IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IngestionDocument document, [EnumeratorCancellation] CancellationToken cancellationToken = default)
33
List<
IngestionChunk
<string>> chunks = [];
39
foreach (
var
chunk in chunks)
47
private void Process(IngestionDocument document, IngestionDocumentSection section, List<
IngestionChunk
<string>> chunks, string? parentContext = null)
79
foreach (
var
chunk in _elementsChunker.Process(document, context, elements))
Chunkers\SemanticSimilarityChunker.cs (4)
47
public override async IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IngestionDocument document,
53
foreach (
var
chunk in MakeChunks(document, distances))
96
private IEnumerable<
IngestionChunk
<string>> MakeChunks(IngestionDocument document, List<(IngestionDocumentElement element, float distance)> elementDistances)
109
foreach (
var
chunk in _elementsChunker.Process(document, context, elementAccumulator))
IngestionPipeline.cs (1)
183
IAsyncEnumerable<
IngestionChunk
<T>> chunks = _chunker.ProcessAsync(document, cancellationToken);
Processors\ClassificationEnricher.cs (2)
52
public override IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IAsyncEnumerable<
IngestionChunk
<string>> chunks, CancellationToken cancellationToken = default)
Processors\KeywordEnricher.cs (2)
60
public override IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IAsyncEnumerable<
IngestionChunk
<string>> chunks, CancellationToken cancellationToken = default)
Processors\SentimentEnricher.cs (2)
50
public override IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IAsyncEnumerable<
IngestionChunk
<string>> chunks, CancellationToken cancellationToken = default)
Processors\SummaryEnricher.cs (2)
45
public override IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync(IAsyncEnumerable<
IngestionChunk
<string>> chunks, CancellationToken cancellationToken = default)
Utils\Batching.cs (4)
18
internal static async IAsyncEnumerable<
IngestionChunk
<string>> ProcessAsync<TMetadata>(IAsyncEnumerable<
IngestionChunk
<string>> chunks,
31
foreach (
var
chunk in batch)
64
foreach (
var
chunk in batch)
Writers\VectorStoreWriter.cs (6)
35
/// <param name="vectorStore">The <see cref="VectorStore"/> to use to store the <see cref="
IngestionChunk
{T}"/> instances.</param>
51
/// The collection is initialized when <see cref="WriteAsync(IAsyncEnumerable{
IngestionChunk
{T}}, CancellationToken)"/> is called for the first time.
54
/// Call <see cref="WriteAsync(IAsyncEnumerable{
IngestionChunk
{T}}, CancellationToken)"/> first.</exception>
59
public override async Task WriteAsync(IAsyncEnumerable<
IngestionChunk
<T>> chunks, CancellationToken cancellationToken = default)
64
await foreach (
IngestionChunk
<T> chunk in chunks.WithCancellation(cancellationToken))
119
private VectorStoreCollectionDefinition GetVectorStoreRecordDefinition(
IngestionChunk
<T> representativeChunk)
Microsoft.Extensions.DataIngestion.Abstractions (5)
IngestionChunk.cs (1)
21
/// Initializes a new instance of the <see cref="
IngestionChunk
{T}"/> class.
IngestionChunker.cs (1)
21
public abstract IAsyncEnumerable<
IngestionChunk
<T>> ProcessAsync(IngestionDocument document, CancellationToken cancellationToken = default);
IngestionChunkProcessor.cs (2)
21
public abstract IAsyncEnumerable<
IngestionChunk
<T>> ProcessAsync(IAsyncEnumerable<
IngestionChunk
<T>> chunks, CancellationToken cancellationToken = default);
IngestionChunkWriter.cs (1)
23
public abstract Task WriteAsync(IAsyncEnumerable<
IngestionChunk
<T>> chunks, CancellationToken cancellationToken = default);
Microsoft.Extensions.DataIngestion.Tests (46)
Chunkers\DocumentChunkerTests.cs (1)
29
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(emptyDoc).ToListAsync();
Chunkers\DocumentTokenChunkerTests.cs (2)
27
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
29
IngestionChunk
<string> chunk = Assert.Single(chunks);
Chunkers\HeaderChunkerTests.cs (5)
40
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
72
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
120
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
147
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(document).ToListAsync();
177
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(document).ToListAsync();
Chunkers\NoOverlapTokenChunkerTests.cs (3)
33
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
54
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
56
foreach (
var
chunk in chunks)
Chunkers\OverlapTokenChunkerTests.cs (3)
39
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
49
var
currentChunk = chunks[i];
50
var
nextChunk = chunks[i + 1];
Chunkers\SectionChunkerTests.cs (7)
33
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
66
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
84
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
127
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
156
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
177
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
178
IngestionChunk
<string> chunk = Assert.Single(chunks);
Chunkers\SemanticSimilarityChunkerTests.cs (3)
57
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
100
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
176
IReadOnlyList<
IngestionChunk
<string>> chunks = await chunker.ProcessAsync(doc).ToListAsync();
IngestionPipelineTests.cs (1)
178
public override IAsyncEnumerable<
IngestionChunk
<DataContent>> ProcessAsync(IngestionDocument document, CancellationToken cancellationToken = default)
Processors\ClassificationEnricherTests.cs (5)
58
await foreach (
var
_ in sut.ProcessAsync(null!))
90
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(CreateChunks().ToAsyncEnumerable()).ToListAsync();
109
List<
IngestionChunk
<string>> chunks = CreateChunks();
111
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(chunks.ToAsyncEnumerable()).ToListAsync();
120
private static List<
IngestionChunk
<string>> CreateChunks() =>
Processors\KeywordEnricherTests.cs (5)
56
await foreach (
var
_ in sut.ProcessAsync(null!))
92
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(chunks).ToListAsync();
109
List<
IngestionChunk
<string>> chunks = CreateChunks();
111
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(chunks.ToAsyncEnumerable()).ToListAsync();
120
private static List<
IngestionChunk
<string>> CreateChunks() =>
Processors\SentimentEnricherTests.cs (4)
42
await foreach (
var
_ in sut.ProcessAsync(null!))
96
List<
IngestionChunk
<string>> chunks = CreateChunks();
98
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(chunks.ToAsyncEnumerable()).ToListAsync();
107
private static List<
IngestionChunk
<string>> CreateChunks() =>
Processors\SummaryEnricherTests.cs (4)
42
await foreach (
var
_ in sut.ProcessAsync(null!))
93
List<
IngestionChunk
<string>> chunks = CreateChunks();
95
IReadOnlyList<
IngestionChunk
<string>> got = await sut.ProcessAsync(chunks.ToAsyncEnumerable()).ToListAsync();
104
private static List<
IngestionChunk
<string>> CreateChunks() =>
Writers\VectorStoreWriterTests.cs (3)
27
List<
IngestionChunk
<string>> chunks =
76
List<
IngestionChunk
<string>> chunks =
96
List<
IngestionChunk
<string>> updatedChunks =