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
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,8 @@ Target capabilities:
62
62
- Tests must verify the real Markdown -> graph -> query/search flow, including success, malformed input, and empty/no-match paths where relevant.
63
63
- Tests must not use mocks, stubs, or fakes, except one local test implementation of `Microsoft.Extensions.AI.IChatClient` used to prove the LLM extraction boundary without network access.
64
64
- Use TUnit for tests and Shouldly for assertions.
65
+
- Fallbacks are forbidden. Do not silently substitute generic/default behaviour when parsing, extraction, graph building, query execution, or AI extraction fails; fail explicitly or skip the invalid fact with a caller-visible test.
66
+
- Legacy or leftover old code is forbidden. Do not keep deprecated duplicate paths, compatibility shims, or unused old implementations; remove them immediately unless an ADR documents a temporary migration path.
65
67
66
68
## Global Skills
67
69
@@ -85,9 +87,9 @@ List only the skills this solution actually uses.
@@ -135,17 +124,24 @@ internal static class FileGraphDemo
135
124
136
125
`KnowledgeSourceDocumentConverter` supports Markdown and other text-like knowledge inputs: `.md`, `.markdown`, `.mdx`, `.txt`, `.text`, `.log`, `.csv`, `.json`, `.jsonl`, `.yaml`, and `.yml`.
137
126
127
+
You do not need to pass a base URI for normal use. Document identity is resolved in this order:
128
+
129
+
-`canonicalUrl` or `canonical_url` in Markdown front matter
130
+
- the file path, normalized the same way as the upstream project: `content/notes/rdf.md` becomes a stable document IRI
131
+
- the generated inline document path when `BuildFromMarkdownAsync` is called without a path
132
+
133
+
The library uses `urn:managedcode:markdown-ld-kb:/` as an internal default base URI only to create valid RDF IRIs when the Markdown does not provide a canonical URL. Pass `new MarkdownKnowledgePipeline(new Uri("https://your-domain/"))` only when you want generated document/entity IRIs to live under your own domain.
134
+
138
135
## Optional AI Extraction
139
136
140
-
The core library depends on `Microsoft.Extensions.AI.IChatClient`, not on a provider-specific SDK. Your host application owns the concrete provider, credentials, model choice, and optional Microsoft Agent Framework orchestration.
137
+
Optional AI extraction enriches the deterministic Markdown graph with entities and assertions returned by an injected `Microsoft.Extensions.AI.IChatClient`. The package stays provider-neutral: it does not reference OpenAI, Azure OpenAI, Anthropic, or any other model-specific SDK. If no chat client is provided, the pipeline still runs fully locally and builds the graph from Markdown/front matter/link extraction only.
The built-in chat extractor requests structured output through `GetResponseAsync<T>()` and normalizes the returned entity/assertion payload before graph construction. Tests use one local non-network `IChatClient` implementation so the full flow is covered without a live model.
180
+
The built-in chat extractor requests structured output through `GetResponseAsync<T>()`, normalizes the returned entity/assertion payload, merges it with deterministic facts, and then builds the same in-memory RDF graph used by search and SPARQL. Tests use one local non-network `IChatClient` implementation so the full extraction-to-graph flow is covered without a live model.
SPARQL execution is intentionally read-only. `SELECT` and `ASK` are allowed; mutation forms such as `INSERT`, `DELETE`, `LOAD`, `CLEAR`, `DROP`, and `CREATE` are rejected before execution.
228
225
226
+
## Thread Safety
227
+
228
+
`KnowledgeGraph` is safe for shared in-memory read/write use through its public API. Search, read-only SPARQL, and serialization run under a read lock; `MergeAsync` snapshots a built graph and merges it under a write lock.
229
+
230
+
Use this when many workers convert Markdown independently and publish their results into one graph:
0 commit comments