-
Notifications
You must be signed in to change notification settings - Fork 884
Extend IngestionPipeline to support processing documents without a file system reader #7488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: data-ingestion-preview2
Are you sure you want to change the base?
Changes from all commits
ec1d99d
dd77217
6258a67
5fd987a
991c14a
691fa74
a9b7f16
9d81ab6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.AI; | ||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.AI; | ||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.DataIngestion; | ||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.DataIngestion.Chunkers; | ||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.VectorData; | ||||||||||||||||||||||||||||||||
|
|
@@ -19,13 +19,13 @@ public async Task IngestDataAsync(DirectoryInfo directory, string searchPattern) | |||||||||||||||||||||||||||||||
| IncrementalIngestion = false, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| DocumentReader reader = new(directory); | ||||||||||||||||||||||||||||||||
| using var pipeline = new IngestionPipeline( | ||||||||||||||||||||||||||||||||
| reader: new DocumentReader(directory), | ||||||||||||||||||||||||||||||||
| chunker: new SemanticSimilarityChunker(embeddingGenerator, new(TiktokenTokenizer.CreateForModel("gpt-4o"))), | ||||||||||||||||||||||||||||||||
| writer: writer, | ||||||||||||||||||||||||||||||||
| loggerFactory: loggerFactory); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| await foreach (var result in pipeline.ProcessAsync(directory, searchPattern)) | ||||||||||||||||||||||||||||||||
| await foreach (var result in pipeline.ProcessAsync(reader, directory, searchPattern)) | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the reader already encapsulates the directory, why does it also need to be passed in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Encapsulating the directory is specific only to this particular reader implementation: Lines 5 to 19 in 2e5993e
Other readers don't do that. |
||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| logger.LogInformation("Completed processing '{id}'. Succeeded: '{succeeded}'.", result.DocumentId, result.Succeeded); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you show a code sample demonstrating error handling when processing the async enumerable under the proposed model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be sth like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that doesn't process the full stream E2E right? What if I wanted to skip over the ingestion result that failed?