ToolUp.AI.Wire
0.22.0
Prefix Reserved
dotnet add package ToolUp.AI.Wire --version 0.22.0
NuGet\Install-Package ToolUp.AI.Wire -Version 0.22.0
<PackageReference Include="ToolUp.AI.Wire" Version="0.22.0" />
<PackageVersion Include="ToolUp.AI.Wire" Version="0.22.0" />
<PackageReference Include="ToolUp.AI.Wire" />
paket add ToolUp.AI.Wire --version 0.22.0
#r "nuget: ToolUp.AI.Wire, 0.22.0"
#:package ToolUp.AI.Wire@0.22.0
#addin nuget:?package=ToolUp.AI.Wire&version=0.22.0
#tool nuget:?package=ToolUp.AI.Wire&version=0.22.0
ToolUp.AI.Wire
A small, portable JSON value model for building and reading wire payloads,
compilable to both .NET and Fable (browser). It
depends on FSharp.Core + Fable.Core only — no System.Net.Http, no
unguarded System.Text.Json — so one mapping can serve a server host and a
browser host without re-deriving the translation.
What it gives you
JsonValue— a JSON value DU (JNull/JBool/JNumber/JString/JArray/JObject). Object members are an ordered list, so serialization preserves insertion order and is byte-stable.- Builders —
jnull/jbool/jnum/jint/jstr/jarr/jobj, auto-opened for terse construction. - Total accessors —
tryField/asString/asInt/asFloat/asBool/asArray/asObject/tryItem. Every one returnsoptionand never throws. - A host-bridged seam —
JsonHost.serialize(a single portable canonical writer, identical on every host) andJsonHost.parse(bridged to the browser'sJSON.parseunder Fable, toSystem.Text.Jsonotherwise), returningJsonValue option. - The connector contract (
Contract.fs, namespaceToolUp.Platform.AI) — the portableIAIProvidervalue types a browser host can reference directly:AIProviderMessage/AIProviderToolCall/AIProviderToolResult/AIProviderToolDef/AIProviderResponse/TokenUsage/AIProviderCapabilities/AIProviderError/AIContentPart(+ImageSource/ImagePayload) and their companion modules. They keep theToolUp.Platform.AInamespace so aToolUp.Platformconsumer sees them unchanged; theIAIProviderinterface itself stays inToolUp.Platform.Core(it references the server-tierRetryPolicy).
Example
open ToolUp.AI.Wire
let body =
jobj
[ "model", jstr "example-model"
"stream", jbool true
"messages", jarr [ jobj [ "role", jstr "user"; "content", jstr "hi" ] ] ]
let json = JsonHost.serialize body
// {"model":"example-model","stream":true,"messages":[{"role":"user","content":"hi"}]}
let model =
JsonHost.parse json
|> Option.bind (JsonValue.tryField "model")
|> Option.bind JsonValue.asString
// Some "example-model"
Byte-stable output
JsonHost.serialize is a hand-rolled canonical writer rather than a passthrough
to two different host JSON engines, so its bytes are identical on .NET and
Fable for the same JsonValue. Object keys emit in JObject order; output is
compact (no insignificant whitespace).
Licensed under Apache-2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Fable.Core (>= 5.0.0)
- FSharp.Core (>= 10.1.300)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ToolUp.AI.Wire:
| Package | Downloads |
|---|---|
|
ToolUp.Platform.Core
ToolUp.Platform Core — shared types and interfaces (ILogger, IBlobStorage, IAuthProvider, IAIProvider, INotificationChannel, IHealthCheck, IConfigValidator, etc.). No server or client deps; the "minimum viable module" floor for downstream packages. |
|
|
ToolUp.AIProviders.Claude
Claude (Anthropic) IAIProvider implementation for ToolUp.AI. BYOK-capable; reads API keys from ISecretStore. |
GitHub repositories
This package is not used by any popular GitHub repositories.