This repository demonstrates how to use Ollama System One in .NET applications.
System One is Ollama's decision API. An application provides a state and questions with explicit criteria; the model evaluates them and returns structured results, such as a choice, a yes/no probability, or a score. Unlike a chat response, the result is designed for applications to consume directly.
Prerequisites: .NET 10 SDK and Ollama v0.35.0 or later running locally. Pull the models used by the examples:
ollama pull nimble
ollama pull tev1:4bFrom the repository root, build the solution:
dotnet build SystemOne.slnOllama uses http://localhost:11434/ by default. To use a different model or server URL, set OLLAMA_MODEL or OLLAMA_BASE_URL before running an example.
dotnet run --project examples/SupportTicket/SupportTicket.csprojSubmits a support ticket and evaluates three aspects: the responsible team (choice), whether a refund was explicitly requested (noul), and urgency (score).
The state contains the ticket details:
{
"CustomerMessage": "I was charged twice. Please refund the extra payment.",
"ServiceStatus": "The checkout service is returning HTTP 500 errors."
}For the intent question, the instructions and criteria are:
Instructions: Which support team should handle this ticket?
Criteria:
billing: Payments, duplicate charges, and refunds
technical: Software errors, outages, and integrations
other: None of the listed teams applies
Illustrative output:
Model: nimble
Input tokens: 245
Team: billing (confidence: 82.4%)
billing: 82.4%
technical: 12.1%
other: 5.5%
Probability refund was requested: 98.7%
Urgency score: 1.42 (scale 0-2)
Score confidence: 71.3%
dotnet run --project examples/TicTacToe/TicTacToe.csprojYou play as X; System One chooses an empty square as O. The application provides the legal moves and validates the result locally.
After X chooses square 1, the state for O's turn is:
{
"Board": ["X--", "---", "---"],
"Player": "O"
}The move question includes the current board and only the available squares:
Instructions: You are playing Tic-Tac-Toe as O. The board is a 3x3 grid where...
Criteria:
2: Square 2 (row 1, column 2)
3: Square 3 (row 1, column 3)
4: Square 4 (row 2, column 1)
5: Square 5 (row 2, column 2)
6: Square 6 (row 2, column 3)
7: Square 7 (row 3, column 1)
8: Square 8 (row 3, column 2)
9: Square 9 (row 3, column 3)
The board, legal-move criteria, and board-specific instructions are rebuilt for each O turn.
Illustrative output:
Tic-tac-toe: you are X; System One is O.
1 | 2 | 3
---+---+---
4 | 5 | 6
---+---+---
7 | 8 | 9
Choose an empty square (1-9), or press Enter to quit: 1
System One chose square 5 in 1250 ms (confidence: 76.0%).
dotnet run --project examples/LiveChatModeration/LiveChatModeration.csprojReplays a short stream of sample chat messages, submitting each message as a separate event. For every message, System One classifies the moderation category (choice), estimates the probability of a rules violation (noul), and scores its severity (score). The example prints the complete assessment and request latency before sending the next event. The feed is local and deterministic; it does not connect to a live chat platform.
Illustrative output:
Replaying 6 chat messages with model 'nimble'. Press Ctrl+C to stop.
[10:15:32.104] Mira: Good morning! Has anyone tried the new release yet?
Model: nimble
Category: allow (confidence: 91.2%)
Policy violation probability: 2.1%
Severity: 0.04 / 4 (confidence: 88.5%)
Decision time: 740 ms
Tokens: 198 in, 42 out
Latency and assessments vary by model and environment. Each event receives a complete response; the current client does not stream partial answers. Press Ctrl+C to stop the replay.
src/SystemOne.Ollama: shared HTTP client and models.examples/SupportTicket: classification usingchoice,noul, andscore.examples/TicTacToe: choosing among legal moves in a game.examples/LiveChatModeration: event-by-event chat moderation using all three question types.