Skip to content

Commit a9490dc

Browse files
NinjaRocksclaude
andcommitted
Populate companion samples for chapters 1-6
Adds 35 runnable .NET 9 samples mapped to manuscript sections, central package management via Directory.Packages.props, and per-chapter + top-level READMEs plus docs/citation-index.md and docs/version-matrix.md. Coverage: ch01: hello-chat (multi-provider), embeddings, secrets-and-config ch02: chat loop, SSE streaming, structured output, function calling, middleware pipeline, custom token-budget middleware ch03: semantic search, basic RAG, ingestion pipeline, evaluation, vision extract, local-first RAG ch04: hello agent, anthropic agent, persistent session, tools+approval, agent middleware, text-processing workflow, content workflow, A2A server, agent with mixed function + MCP tools ch05: inventory MCP server, stdio/SSE/streamable-HTTP transports, MCP client REPL, McpAgentFactory, CachedMcpToolProvider fix ch06: OpenTelemetry observability, resilience pipeline, model routing, unit testing with stub IChatClient, LLM-as-judge, OutputGuard fix Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d5fe853 commit a9490dc

146 files changed

Lines changed: 4251 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Whitespace-only changes.

Directory.Packages.props

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
5+
</PropertyGroup>
6+
7+
<ItemGroup Label="Microsoft.Extensions.AI">
8+
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.0.0" />
9+
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.0" />
10+
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="9.0.0-preview" />
11+
<PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="9.0.0-preview" />
12+
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="9.0.0-preview" />
13+
</ItemGroup>
14+
15+
<ItemGroup Label="Microsoft Agent Framework">
16+
<PackageVersion Include="Microsoft.Agents.AI" Version="0.3.0-preview" />
17+
<PackageVersion Include="Microsoft.Agents.AI.OpenAI" Version="0.3.0-preview" />
18+
<PackageVersion Include="Microsoft.Agents.AI.Workflows" Version="0.3.0-preview" />
19+
<PackageVersion Include="Microsoft.Agents.AI.AzureAI" Version="0.3.0-preview" />
20+
<PackageVersion Include="Microsoft.Agents.AI.A2A" Version="0.3.0-preview" />
21+
<PackageVersion Include="Microsoft.Agents.AI.Hosting" Version="0.3.0-preview" />
22+
</ItemGroup>
23+
24+
<ItemGroup Label="Model Context Protocol">
25+
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview" />
26+
<PackageVersion Include="ModelContextProtocol.Client" Version="0.3.0-preview" />
27+
<PackageVersion Include="ModelContextProtocol.Server" Version="0.3.0-preview" />
28+
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.3.0-preview" />
29+
</ItemGroup>
30+
31+
<ItemGroup Label="Provider SDKs">
32+
<PackageVersion Include="Azure.AI.OpenAI" Version="2.1.0" />
33+
<PackageVersion Include="OpenAI" Version="2.1.0" />
34+
<PackageVersion Include="OllamaSharp" Version="4.0.0" />
35+
<PackageVersion Include="Anthropic.SDK" Version="5.0.0" />
36+
</ItemGroup>
37+
38+
<ItemGroup Label="Hosting and DI">
39+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
40+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
41+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
42+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
43+
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
44+
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
45+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
46+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
47+
</ItemGroup>
48+
49+
<ItemGroup Label="ASP.NET Core">
50+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
51+
</ItemGroup>
52+
53+
<ItemGroup Label="Resilience and Telemetry">
54+
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
55+
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
56+
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
57+
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
58+
</ItemGroup>
59+
60+
<ItemGroup Label="Testing">
61+
<PackageVersion Include="xunit" Version="2.9.2" />
62+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
63+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
64+
</ItemGroup>
65+
</Project>

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Generative AI in .NET -- Companion Code
2+
3+
Runnable code samples for **Generative AI in .NET** (Najaf Shaikh).
4+
5+
Every sample in this repo corresponds to a section of the printed book. The full map between book and code lives in [`docs/citation-index.md`](docs/citation-index.md). When the book has been condensed in favor of pointing here, the manuscript cites a **tag** (e.g. `v1.0-print-ready`) so the code stays aligned with the print run.
6+
7+
## Layout
8+
9+
```
10+
samples/
11+
ch01-foundations/
12+
01.3-hello-chat/ -- IChatClient with provider selection
13+
01.3-embeddings/ -- IEmbeddingGenerator + cosine similarity
14+
01.4-secrets-and-config/ -- appsettings + user-secrets + env vars
15+
ch02-extensions-ai/
16+
02.1-console-chat-loop/ -- Sliding-window chat REPL
17+
02.2-streaming-aspnet/ -- SSE streaming in a Minimal API
18+
02.2-structured-output/ -- GetResponseAsync<T>()
19+
02.3-function-calling/ -- Three-tool weather + calendar + reminders
20+
02.4-middleware-pipeline/ -- Logging + caching pipeline
21+
02.4-custom-middleware/ -- Token-budget DelegatingChatClient
22+
ch03-rag/
23+
03.1-semantic-search/ -- Embedding + cosine over a product catalog
24+
03.2-rag-basic/ -- Retrieve / augment / generate
25+
03.2-ingestion-pipeline/ -- Load + chunk + hash + embed + upsert
26+
03.2.7-evaluation/ -- LLM-as-judge for RAG (faithfulness + relevance)
27+
03.3-vision-extract/ -- Receipt image -> typed Receipt record
28+
03.5-local-rag/ -- Local-only RAG (Ollama)
29+
ch04-agent-framework/
30+
04.2.1-hello-agent/ -- ChatClientAgent hello world
31+
04.2.4-anthropic-agents/ -- Same agent API, Claude under the hood
32+
04.3-persistent-session/ -- AgentThread serialize / resume
33+
04.4-tools-and-approval/ -- Function tools + RequiresApproval marker
34+
04.5-agent-middleware/ -- Custom run-middleware
35+
04.6.3-text-processing-walkthrough/ -- Linear workflow walkthrough
36+
04.6.7-content-workflow/ -- Researcher / Writer / Editor multi-agent
37+
04.7-a2a-server/ -- Expose an agent via A2A protocol
38+
04.8-agent-with-mcp/ -- Agent with mixed local + MCP tools
39+
ch05-mcp/
40+
05.2.10-inventory-server/ -- Full MCP server (tools + resources + prompts)
41+
05.3.1-stdio-transport/ -- Minimal stdio server
42+
05.3.2-sse-transport/ -- ASP.NET Core SSE transport
43+
05.3.3-streamable-http/ -- Streamable HTTP (recommended)
44+
05.4-mcp-client/ -- Interactive MCP client REPL
45+
05.6.3-mcp-agent-factory/ -- McpAgentFactory
46+
cached-mcp-tool-provider/ -- CachedMcpToolProvider (Critical-1 fix)
47+
ch06-production/
48+
06.1-observability/ -- OpenTelemetry tracing + OTLP export
49+
06.2.1-resilience/ -- Standard resilience handler
50+
06.2.4-model-routing/ -- Classify-then-route cost optimization
51+
06.5.1-unit-testing/ -- xUnit + StubChatClient
52+
06.5.3-llm-as-judge/ -- Evaluation harness
53+
output-guard-chat-client/ -- OutputGuardChatClient (Critical-3 fix)
54+
docs/
55+
citation-index.md
56+
version-matrix.md
57+
.github/workflows/ci.yml
58+
Directory.Packages.props
59+
global.json
60+
```
61+
62+
## Prerequisites
63+
64+
- **.NET 9 SDK** (`dotnet --version` should be 9.0.x).
65+
- **Provider credentials** for samples that hit a live model -- each sample's README names what it needs:
66+
- `OPENAI_API_KEY` for OpenAI / GitHub Models samples.
67+
- `AZURE_OPENAI_ENDPOINT` + `AZURE_OPENAI_KEY` for Azure OpenAI samples.
68+
- `ANTHROPIC_API_KEY` for Claude samples.
69+
- **Local services** for offline samples: [Ollama](https://ollama.com/) for local inference; an MCP-compatible runtime (`dnx`) for some MCP samples.
70+
71+
The repo uses **central package management** -- versions live in [`Directory.Packages.props`](Directory.Packages.props), shared properties in [`samples/Directory.Build.props`](samples/Directory.Build.props). Project files only carry `<PackageReference Include="..." />` -- no version attributes.
72+
73+
## Running a sample
74+
75+
```bash
76+
dotnet run --project samples/ch04-agent-framework/04.6.3-text-processing-walkthrough
77+
```
78+
79+
Each sample folder has its own `README.md` with run instructions, expected output, and the manuscript section it backs.
80+
81+
## Building everything
82+
83+
```bash
84+
dotnet build
85+
```
86+
87+
## What's offline-runnable
88+
89+
These samples need **only** Ollama (no API keys, no cloud calls):
90+
91+
- `ch01/01.3-hello-chat` (default profile), `01.3-embeddings`, `01.4-secrets-and-config`
92+
- `ch02/02.1-console-chat-loop`, `02.2-streaming-aspnet`, `02.4-middleware-pipeline`, `02.4-custom-middleware`
93+
- `ch03/03.1-semantic-search`, `03.2-rag-basic`, `03.2-ingestion-pipeline`, `03.5-local-rag`
94+
- `ch04/04.2.1-hello-agent`, `04.3-persistent-session`, `04.5-agent-middleware`, `04.7-a2a-server`
95+
- `ch05/*` (all MCP samples; `05.4-mcp-client` needs a server to talk to)
96+
- `ch06/06.1-observability`, `06.2.1-resilience`, `06.5.1-unit-testing`, `output-guard-chat-client`
97+
98+
The rest assume an OpenAI / Anthropic / Azure OpenAI key.
99+
100+
## Versioning and tags
101+
102+
| Tag | Meaning |
103+
|---|---|
104+
| `v1.0-print-ready` | Code as it appears in the first print run. |
105+
| `v1.x-second-print` | Updated for subsequent print revisions. |
106+
| `main` | Always-current; may drift from any specific print run. |
107+
108+
Use a **tag** in any URL you cite from the book -- never `main`.
109+
110+
## Errata
111+
112+
Open an issue at [github.com/CodeShayk/generative-ai-dotnet-samples](https://github.com/CodeShayk/generative-ai-dotnet-samples). Confirmed errata roll into the next print tag and are noted in the parent book's errata page.
113+
114+
## License
115+
116+
MIT -- see [`LICENSE`](LICENSE).

docs/citation-index.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Citation Index
2+
3+
The map between book sections and their runnable companion code in this repository.
4+
5+
When the manuscript condenses a section and points at this repo, the citation should always reference a **tag** (e.g. `v1.0-print-ready`) rather than `main`. `main` will drift.
6+
7+
## Chapter 1 -- Foundations
8+
9+
| Section | Title | Sample path |
10+
|---|---|---|
11+
| 1.3.2 -- 1.3.3 | Hello, IChatClient (provider-selectable) | [`samples/ch01-foundations/01.3-hello-chat/`](../samples/ch01-foundations/01.3-hello-chat/) |
12+
| 1.3.4 | Hello, IEmbeddingGenerator | [`samples/ch01-foundations/01.3-embeddings/`](../samples/ch01-foundations/01.3-embeddings/) |
13+
| 1.4.4 | Secrets and configuration | [`samples/ch01-foundations/01.4-secrets-and-config/`](../samples/ch01-foundations/01.4-secrets-and-config/) |
14+
15+
## Chapter 2 -- Extensions.AI Techniques
16+
17+
| Section | Title | Sample path |
18+
|---|---|---|
19+
| 2.1.5 | Console chat loop with sliding-window history | [`samples/ch02-extensions-ai/02.1-console-chat-loop/`](../samples/ch02-extensions-ai/02.1-console-chat-loop/) |
20+
| 2.2.2 | Streaming over SSE in a Minimal API | [`samples/ch02-extensions-ai/02.2-streaming-aspnet/`](../samples/ch02-extensions-ai/02.2-streaming-aspnet/) |
21+
| 2.2.3 -- 2.2.4 | Structured output to a typed record | [`samples/ch02-extensions-ai/02.2-structured-output/`](../samples/ch02-extensions-ai/02.2-structured-output/) |
22+
| 2.3.6 | Function calling -- weather + calendar + reminders | [`samples/ch02-extensions-ai/02.3-function-calling/`](../samples/ch02-extensions-ai/02.3-function-calling/) |
23+
| 2.4.6 | Composing the middleware pipeline (logging + cache) | [`samples/ch02-extensions-ai/02.4-middleware-pipeline/`](../samples/ch02-extensions-ai/02.4-middleware-pipeline/) |
24+
| 2.4.5 | Custom middleware -- token-budget enforcement | [`samples/ch02-extensions-ai/02.4-custom-middleware/`](../samples/ch02-extensions-ai/02.4-custom-middleware/) |
25+
26+
## Chapter 3 -- RAG and Vision
27+
28+
| Section | Title | Sample path |
29+
|---|---|---|
30+
| 3.1.1 -- 3.1.5 | Semantic search over a product catalog | [`samples/ch03-rag/03.1-semantic-search/`](../samples/ch03-rag/03.1-semantic-search/) |
31+
| 3.2.1 -- 3.2.6 | Basic RAG (retrieve / augment / generate) | [`samples/ch03-rag/03.2-rag-basic/`](../samples/ch03-rag/03.2-rag-basic/) |
32+
| 3.2.2 | Document ingestion pipeline | [`samples/ch03-rag/03.2-ingestion-pipeline/`](../samples/ch03-rag/03.2-ingestion-pipeline/) |
33+
| 3.2.7 | LLM-as-judge RAG evaluation | [`samples/ch03-rag/03.2.7-evaluation/`](../samples/ch03-rag/03.2.7-evaluation/) |
34+
| 3.3.4 | Vision -- receipt image to typed record | [`samples/ch03-rag/03.3-vision-extract/`](../samples/ch03-rag/03.3-vision-extract/) |
35+
| 3.5.1 | Local-first RAG (Ollama, no cloud) | [`samples/ch03-rag/03.5-local-rag/`](../samples/ch03-rag/03.5-local-rag/) |
36+
37+
## Chapter 4 -- Microsoft Agent Framework
38+
39+
| Section | Title | Sample path |
40+
|---|---|---|
41+
| 4.2.1 | Hello, ChatClientAgent | [`samples/ch04-agent-framework/04.2.1-hello-agent/`](../samples/ch04-agent-framework/04.2.1-hello-agent/) |
42+
| 4.2.4 | Anthropic / Claude as an agent | [`samples/ch04-agent-framework/04.2.4-anthropic-agents/`](../samples/ch04-agent-framework/04.2.4-anthropic-agents/) |
43+
| 4.3.3 | Persistent agent sessions (serialize / resume) | [`samples/ch04-agent-framework/04.3-persistent-session/`](../samples/ch04-agent-framework/04.3-persistent-session/) |
44+
| 4.4.2 -- 4.4.3 | Tools + approval gate | [`samples/ch04-agent-framework/04.4-tools-and-approval/`](../samples/ch04-agent-framework/04.4-tools-and-approval/) |
45+
| 4.5.1 -- 4.5.4 | Custom agent run middleware | [`samples/ch04-agent-framework/04.5-agent-middleware/`](../samples/ch04-agent-framework/04.5-agent-middleware/) |
46+
| 4.6.3 | Text-processing workflow | [`samples/ch04-agent-framework/04.6.3-text-processing-walkthrough/`](../samples/ch04-agent-framework/04.6.3-text-processing-walkthrough/) |
47+
| 4.6.7 | Multi-agent content workflow | [`samples/ch04-agent-framework/04.6.7-content-workflow/`](../samples/ch04-agent-framework/04.6.7-content-workflow/) |
48+
| 4.7.3 | Expose an agent over A2A | [`samples/ch04-agent-framework/04.7-a2a-server/`](../samples/ch04-agent-framework/04.7-a2a-server/) |
49+
| 4.8.3 | Agent with mixed local + MCP tools | [`samples/ch04-agent-framework/04.8-agent-with-mcp/`](../samples/ch04-agent-framework/04.8-agent-with-mcp/) |
50+
51+
## Chapter 5 -- Model Context Protocol
52+
53+
| Section | Title | Sample path |
54+
|---|---|---|
55+
| 5.2.10 | Inventory MCP server (full walkthrough) | [`samples/ch05-mcp/05.2.10-inventory-server/`](../samples/ch05-mcp/05.2.10-inventory-server/) |
56+
| 5.3.1 | Stdio transport | [`samples/ch05-mcp/05.3.1-stdio-transport/`](../samples/ch05-mcp/05.3.1-stdio-transport/) |
57+
| 5.3.2 | SSE transport | [`samples/ch05-mcp/05.3.2-sse-transport/`](../samples/ch05-mcp/05.3.2-sse-transport/) |
58+
| 5.3.3 | Streamable HTTP transport | [`samples/ch05-mcp/05.3.3-streamable-http/`](../samples/ch05-mcp/05.3.3-streamable-http/) |
59+
| 5.4.1 -- 5.4.3 | Interactive MCP client REPL | [`samples/ch05-mcp/05.4-mcp-client/`](../samples/ch05-mcp/05.4-mcp-client/) |
60+
| 5.4.2 | `CachedMcpToolProvider` (Critical-1 fix) | [`samples/ch05-mcp/cached-mcp-tool-provider/`](../samples/ch05-mcp/cached-mcp-tool-provider/) |
61+
| 5.6.3 | `McpAgentFactory` | [`samples/ch05-mcp/05.6.3-mcp-agent-factory/`](../samples/ch05-mcp/05.6.3-mcp-agent-factory/) |
62+
63+
## Chapter 6 -- Production Readiness
64+
65+
| Section | Title | Sample path |
66+
|---|---|---|
67+
| 6.1.2 -- 6.1.4 | OpenTelemetry tracing | [`samples/ch06-production/06.1-observability/`](../samples/ch06-production/06.1-observability/) |
68+
| 6.2.1 | Standard resilience handler | [`samples/ch06-production/06.2.1-resilience/`](../samples/ch06-production/06.2.1-resilience/) |
69+
| 6.2.4 | Cost-aware model routing | [`samples/ch06-production/06.2.4-model-routing/`](../samples/ch06-production/06.2.4-model-routing/) |
70+
| 6.3.2 | `OutputGuardChatClient` (Critical-3 fix) | [`samples/ch06-production/output-guard-chat-client/`](../samples/ch06-production/output-guard-chat-client/) |
71+
| 6.5.1 | xUnit tests with stub `IChatClient` | [`samples/ch06-production/06.5.1-unit-testing/`](../samples/ch06-production/06.5.1-unit-testing/) |
72+
| 6.5.3 | LLM-as-judge evaluation harness | [`samples/ch06-production/06.5.3-llm-as-judge/`](../samples/ch06-production/06.5.3-llm-as-judge/) |
73+
74+
## Citation format for the manuscript
75+
76+
When a manuscript section is condensed in favor of pointing here, use this exact wording (substitute the tag and path):
77+
78+
> *Full implementation: <https://github.com/CodeShayk/generative-ai-dotnet-samples/tree/v1.0-print-ready/samples/ch04-agent-framework/04.6.3-text-processing-walkthrough>*
79+
80+
## Pending (scaffolded but not populated)
81+
82+
- `samples/appendix-a-packages/` -- one-call quick-start bundles per scenario from Appendix A.10.

docs/version-matrix.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Version Matrix
2+
3+
Mirrors the package matrix in `Appendix-C-Provider-Support-Matrix.md` and `Appendix-A-Package-Reference.md`. Maintain independently of the manuscript so readers can see the *currently-validated* set without rebuying the book.
4+
5+
> **Note.** Versions below are the build-time pins from `Directory.Packages.props`. Run the package sweep documented in `Manuscript/user-action-plan.md` (Critical-5) on the cadence noted there, and update both files together.
6+
7+
## Core abstractions
8+
9+
| Package | Pinned version | Stability |
10+
|---|---|---|
11+
| `Microsoft.Extensions.AI` | 9.0.0 | Stable |
12+
| `Microsoft.Extensions.AI.Abstractions` | 9.0.0 | Stable |
13+
| `Microsoft.Extensions.AI.OpenAI` | 9.0.0-preview | Preview |
14+
| `Microsoft.Extensions.AI.Ollama` | 9.0.0-preview | Preview |
15+
| `Microsoft.Extensions.AI.AzureAIInference` | 9.0.0-preview | Preview |
16+
17+
## Microsoft Agent Framework
18+
19+
| Package | Pinned version | Stability |
20+
|---|---|---|
21+
| `Microsoft.Agents.AI` | 0.3.0-preview | Preview |
22+
| `Microsoft.Agents.AI.OpenAI` | 0.3.0-preview | Preview |
23+
| `Microsoft.Agents.AI.Workflows` | 0.3.0-preview | Preview |
24+
| `Microsoft.Agents.AI.AzureAI` | 0.3.0-preview | Preview |
25+
| `Microsoft.Agents.AI.A2A` | 0.3.0-preview | Preview |
26+
| `Microsoft.Agents.AI.Hosting` | 0.3.0-preview | Preview |
27+
28+
## Model Context Protocol
29+
30+
| Package | Pinned version | Stability |
31+
|---|---|---|
32+
| `ModelContextProtocol` | 0.3.0-preview | Preview |
33+
| `ModelContextProtocol.Client` | 0.3.0-preview | Preview |
34+
| `ModelContextProtocol.Server` | 0.3.0-preview | Preview |
35+
| `ModelContextProtocol.AspNetCore` | 0.3.0-preview | Preview |
36+
37+
## Provider SDKs
38+
39+
| Package | Pinned version |
40+
|---|---|
41+
| `Azure.AI.OpenAI` | 2.1.0 |
42+
| `OpenAI` | 2.1.0 |
43+
| `OllamaSharp` | 4.0.0 |
44+
| `Anthropic.SDK` | 5.0.0 |
45+
46+
## Last validated
47+
48+
- **2026-04-29** -- initial pin, set during companion repo scaffolding. Re-verify against live NuGet before tagging `v1.0-print-ready`.

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "9.0.100",
4+
"rollForward": "latestFeature"
5+
}
6+
}

samples/Directory.Build.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFramework>net9.0</TargetFramework>
4+
<Nullable>enable</Nullable>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<LangVersion>latest</LangVersion>
7+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
8+
<NoWarn>$(NoWarn);CS1591</NoWarn>
9+
</PropertyGroup>
10+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<RootNamespace>Ch01.HelloEmbeddings</RootNamespace>
6+
<AssemblyName>HelloEmbeddings</AssemblyName>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.Extensions.AI" />
11+
<PackageReference Include="OllamaSharp" />
12+
</ItemGroup>
13+
14+
</Project>

0 commit comments

Comments
 (0)