You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,8 @@ Tests use xUnit over VSTest. NuGet versions are centrally managed in `Directory.
39
39
40
40
## Boundaries
41
41
42
+
- Expose FileContext behavior and limits through typed options registered with the standard `IOptions<T>` pattern; hosts bind configuration and consumers use those resolved options rather than introducing fixed capacity constants.
43
+
- Expose image content as binary bytes, base64, and URL references through typed package APIs so hosts can select the correct model-visible representation.
42
44
-`ManagedCode.Storage.Core.IStorage` is the only storage contract the product package may require.
43
45
- Do not depend on a concrete storage provider in product code.
44
46
- Keep Microsoft Agent Framework adaptation separate from Markdown graph materialization.
Copy file name to clipboardExpand all lines: README.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,7 +187,7 @@ Results include `StartLine`, `EndLine`, `HasMore`, and `TotalLines` when the end
187
187
188
188
`IFileContextPdf.ReadPdfTextAsync(path)` returns bounded text, `PageCount`, and one-based `PagesWithoutText`. It does not perform OCR. A scanned page can instead be rendered with `RenderPdfPageAsync(path, pageNumber)`, which returns PNG `DataContent`. Use `CountPdfPageImagesAsync` and `ExtractPdfImageAsync` when the original embedded pictures are needed rather than the complete page. The four read-only `file_context_pdf_*` tools expose the same operations from scoped storage.
189
189
190
-
For an authenticated PDF already held as bytes, `FileContextPdfTextExtractor.Extract`, `FileContextPdfImages.RenderPagePng`, and `FileContextPdfImages.ExtractPageImagesPng` work without storing it. PDF source reads are capped at 100 MiB by default; page rasterization caps pixels and PNG size. A host must pass image `DataContent` to its model as image content. A generic OpenAI Chat function result serializes it as text, so hosts must explicitly bridge image tool results into a multimodal model message.
190
+
For an authenticated PDF already held as bytes, `FileContextPdfTextExtractor.Extract`, `FileContextPdfImages.RenderPagePng`, and `FileContextPdfImages.ExtractPageImagesPng` work without storing it. PDF source reads default to 100 MiB and accept `FileContextOptions` for a different limit; page rasterization also uses configured pixel and PNG limits. `FileContextImageContent` creates model-visible `DataContent` from PNG bytes or base64 and `UriContent` from an HTTPS URL. A URL reference is not fetched by FileContext, so the model provider must be able to access it. A host must pass image content to its model as image content. A generic OpenAI Chat function result serializes it as text, so hosts must explicitly bridge image tool results into a multimodal model message.
191
191
192
192
`file_context_docx_text(path, startParagraph?, startCharacter?, paragraphCount?)` reads ordinary paragraph and table text from a scoped DOCX package. The result contains numbered paragraph segments and `nextParagraph`/`nextCharacter`; use that cursor to continue a long document. Reads are limited to 50 paragraphs and 20,000 characters per call, with a configurable 25 MiB source limit (`MaximumDocxReadBytes`). It does not OCR embedded images. DOCX and XLSX packages are excluded from generic text reads and grep.
193
193
@@ -245,6 +245,11 @@ Paths are logical, relative, and `/`-separated. `RootPrefix` scopes storage acce
@@ -263,7 +268,7 @@ These settings are available through `FileContextOptions`; their named defaults
263
268
264
269
### Configure limits and timeouts
265
270
266
-
Every option in the table is configurable through `FileContextOptions`, for both default and keyed registrations. Configure the options before building your service provider:
271
+
Every option in the table is configurable through `IOptions<FileContextOptions>`, for both default and keyed registrations. Configure the options before building your service provider:
In a host that uses Microsoft configuration binding, the same options can come from `appsettings.json`, environment variables, or another configuration source:
The host supplies `configuration` and the `Microsoft.Extensions.Configuration.Binder` package. For example:
314
+
The URL form is a reference only; FileContext does not download it. Use a URL only when the model provider can fetch that resource.
301
315
302
316
```json
303
317
{
304
318
"FileContext": {
319
+
"MaximumPdfReadBytes": 104857600,
305
320
"MaximumFullReadBytes": 4194304,
306
321
"MaximumRangeReadBytes": 524288,
307
322
"DefaultRangeLineCount": 100,
@@ -325,7 +340,7 @@ The host supplies `configuration` and the `Microsoft.Extensions.Configuration.Bi
325
340
326
341
Configured deadline expiry surfaces as `TimeoutException`, which the function-invocation loop can return as a tool error. Caller cancellation remains `OperationCanceledException`. Cancellation is cooperative: a provider that ignores the token or a synchronous regex/graph operation can finish later than the deadline; FileContext awaits the work and checks cancellation before returning a successful result. Regex matching retains its own `RegexTimeout`.
327
342
328
-
Options are bound at registration time; changing the configuration later does not automatically reconfigure an existing provider. To set a per-call deadline or allow the caller to cancel earlier, pass a cancellation token:
343
+
`IOptions<FileContextOptions>` resolves the configured values when the provider is created. Existing providers keep their resolved options. To set a per-call deadline or allow the caller to cancel earlier, pass a cancellation token:
Copy file name to clipboardExpand all lines: docs/Architecture.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ flowchart TD
77
77
78
78
## Operational limits
79
79
80
-
All potentially large operations are controlled by `FileContextOptions`: full-read bytes, range bytes, files scanned, bytes per searched file, matches per file, total search results, graph documents, graph source bytes, and exported graph characters. Non-seekable cloud streams are supported by sequential streaming.
80
+
All potentially large operations are controlled by `IOptions<FileContextOptions>`: PDF source/page/image budgets, full-read bytes, range bytes, files scanned, bytes per searched file, matches per file, total search results, graph documents, graph source bytes, and exported graph characters. Non-seekable cloud streams are supported by sequential streaming.
0 commit comments