![]() |
VOOZH | about |
dotnet add package Harmony.Format.Core --version 1.0.1
NuGet\Install-Package Harmony.Format.Core -Version 1.0.1
<PackageReference Include="Harmony.Format.Core" Version="1.0.1" />
<PackageVersion Include="Harmony.Format.Core" Version="1.0.1" />Directory.Packages.props
<PackageReference Include="Harmony.Format.Core" />Project file
paket add Harmony.Format.Core --version 1.0.1
#r "nuget: Harmony.Format.Core, 1.0.1"
#:package Harmony.Format.Core@1.0.1
#addin nuget:?package=Harmony.Format.Core&version=1.0.1Install as a Cake Addin
#tool nuget:?package=Harmony.Format.Core&version=1.0.1Install as a Cake Tool
Harmony.Format is an open-source, framework-agnostic .NET library that implements a structured message and scripting format inspired by the Harmony Response Format (HRF) conventions used by modern LLMs. It provides:
It is designed to give enterprises and developers a predictable, safe, and extensible orchestration layer for LLM-powered workflows.
Important: This project does not claim full adherence to a finalized OpenAI HRF specification, as no such formal standard has been published.
Instead, Harmony.Format follows high-fidelity interpretations of observed HRF patterns and models exhibited by LLMs.
Use Harmony Response Format (HRF) in a Semantic Kernel project when you want a more reliable, model-native envelope for what the model is doing—especially around tool calling and structured multi-part outputs. SK is great at orchestration, plugins, and prompt templating (Handlebars), but those don’t guarantee the model’s output will be consistently parseable. HRF gives you a predictable structure for “this is the user-visible answer” vs “this is a tool call” vs “this is tool output,” which reduces brittle regex/heuristics and makes error handling, auditing, and retries much cleaner in production.
It’s particularly useful if you’re running or integrating gpt-oss models (which are trained to speak HRF) or you need portability across inference backends: you can keep SK’s planners/filters/tool pipeline while standardizing the I/O contract at the model boundary. Then you can still use SK Handlebars for what it’s best at—rendering the final response (including tables) from structured tool results—while HRF ensures those results and calls are represented consistently end-to-end.
| Project | Description |
|---|---|
| Harmony.Format.Core | Core envelope model, parser, validators, execution engine, converters |
| Harmony.Format.SemanticKernel | Semantic Kernel integration (ChatCompletionService, ToolExecutionService) |
| Harmony.Format.Cli (future) | CLI utilities for converting, validating, and executing HRF scripts |
| Harmony.Format.Extensions (future) | Experimental/advanced script features |
end, call, return)<|start|>, <|message|>, etc.)contentType=json and contentType=harmony-scriptvars initializationextract-inputtool-callassistant-messageif / then / elsehalt$input.x, $vars.y)analysis vs final channels)The executor depends only on two interfaces:
ILanguageModelChatService // provide LLM chat responses
IToolExecutionService // execute tool calls
This allows you to plug in:
Harmony.Format.Core
│
├── Envelope Model (HarmonyEnvelope, HarmonyMessage)
├── HarmonyScript (steps, vars, converters)
├── Parsing (native HRF → JSON → native HRF)
├── Validation (schema + semantic rules)
├── Execution (HarmonyExecutor)
│ ├── ILanguageModelChatService
│ └── IToolExecutionService
│
└── Conversion (HrfToJsonConverter, JsonToHrfConverter)
Harmony.Format.SemanticKernel
├── SkChatCompletionService (ILanguageModelChatService)
└── SkToolExecutionService (IToolExecutionService)
dotnet add package Harmony.Format.Core
dotnet add package Harmony.Format.SemanticKernel
For now, clone the repo:
git clone https://github.com/<you>/harmony-format-core.git
string hrfText = File.ReadAllText("sample.hrf");
var envelope = HrfToJsonConverter.ConvertHrfTextToEnvelope(hrfText);
// Optional: initialize schemas
HarmonySchemaValidator.Initialize("Schemas/");
var error = envelope.ValidateForHrf();
if (error != null)
{
Console.WriteLine($"Invalid: {error.Code}: {error.Message}");
}
var chat = new StubLanguageModelChatService();
var tools = new StubToolExecutionService();
var executor = new HarmonyExecutor(chat, tools);
var input = new Dictionary<string, object?>();
var result = await executor.ExecuteAsync(envelope, input);
Console.WriteLine(result.Message);
var chat = new SkChatCompletionService(kernel, chatService);
var tools = new SkToolExecutionService(kernel);
var executor = new HarmonyExecutor(chat, tools);
var result = await executor.ExecuteAsync(envelope, new Dictionary<string, object?>());
<|start|>
system
<|constrain|>
harmony-script
<|message|>
{
"vars": {
"location": "$input.location",
"forecast": null
},
"steps": [
{
"type": "tool-call",
"recipient": "weather.get_forecast",
"channel": "commentary",
"args": {
"location": "$vars.location"
},
"save_as": "forecast"
},
{
"type": "assistant-message",
"channel": "final",
"content_template": "Forecast for {{location}}: {{forecast}}"
}
]
}
<|end|>
harmony command)Harmony-format-js)Contributions are welcome!
.editorconfigThis project is open-source and available under the MIT License.
This project is inspired by the evolving Harmony Response Format concepts introduced by modern LLM systems.
While not an official implementation of any vendor’s standard, it strives for high fidelity with observed HRF behavior, delivering a safe and extensible foundation for enterprise LLM workflows.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Harmony.Format.Core:
| Package | Downloads |
|---|---|
|
Harmony.Format.SemanticKernel
Package Description |
This package is not used by any popular GitHub repositories.