Skip to content

Commit b9c1a82

Browse files
committed
docs(leap-sdk): bump SDK page version pins + exhaustive MessageResponse switches
Two related changes across the remaining SDK pages: 1. Version pins bumped 0.10.7 → 0.10.8 — every `ai.liquid.leap:*` Gradle coordinate, SPM `from: "0.10.7"`, `nativelibs` plugin version, the `gradle/libs.versions.toml` snippet, Maven `<version>` block, XCFramework binary-target URLs, and `*-natives@zip` classifier coordinates. Quick-start's XCFramework SHA-256 values were replaced with `<copy from the v0.10.8 release page>` placeholders since the v0.10.8 GitHub release wasn't live when these were drafted; a follow-up pass needs to drop in the real checksums. 2. Every Kotlin `when (response)` over `MessageResponse` and every Swift `switch onEnum(of: response)` that previously used an `else -> {}` / `else -> Unit` / `default: break` fallback was expanded into explicit arms covering all six `MessageResponse` subtypes (`Chunk`, `ReasoningChunk`, `FunctionCalls`, `AudioSample`, `Complete`, and the new `Error` case from v0.10.8). Rationale: the example code is what readers copy into their apps; under v0.10.8 a fallback-based pattern silently swallows the new `Error` arm on Kotlin (statement-`when` compiles with a warning, expression-`when` won't) and on Swift the compiler enforces exhaustiveness, so call sites stop compiling. Showing the explicit `.error` arm in every example puts the migration path right next to the surrounding code. Per-file detail: - `quick-start.mdx` — bump every dependency pin; XCFramework binary-target SHA-256s replaced with placeholders; iOS Swift streaming example gains `case .error(let err)` arm; Android Kotlin `when` gains `is MessageResponse.Error -> _errorMessage.value = ...` arm; Kotlin/Native quick-start `when` expanded from 2-arm + `else` to 6 explicit arms with `Error → System.err.println(...)`. - `ai-agent-usage-guide.mdx` — first handler example: Swift `switch onEnum(of:)` gains `case .error(let err): log(...)`; Kotlin `when` gains `is MessageResponse.Error -> Log.e(...)`. ChatViewModel example: same treatment, Kotlin path writes to `_errorMessage` so SwiftUI / Compose can surface it. Agent-loop example: Swift `default: break` replaced with `case .reasoningChunk, .audioSample: break` + `case .error(let err): throw NSError(...)`; Kotlin `else -> {}` replaced with explicit no-op arms plus `is MessageResponse.Error -> throw response.throwable`. - `function-calling.mdx` — Swift exhaustive case-list gains `.error` arm; Kotlin `when` expanded with explicit `ReasoningChunk` / `AudioSample` no-ops plus `Error → Log.e(...)`. - `cloud-ai-comparison.mdx` — Swift case-list gains `.error` arm surfacing via `print(...)`; Kotlin `when` expanded to 6 arms. - `voice-assistant.mdx` — bump SPM `from:` and Gradle pins; bump "stable release notes through v0.10.7" → "through v0.10.8"; Swift audio-streaming `switch` gains `case .error(let err): throw NSError(...)` so the surrounding `VoiceConversation` machinery surfaces the failure; Kotlin `when` expanded with explicit no-op arms plus `Error → throw response.throwable` matching the Swift shape. - `desktop-platforms.mdx` — bump every dependency pin, plugin version, Maven `<version>`, natives-zip coords, and the XCFramework binary-target URL; Kotlin K/N quick-start `when` expanded to 6 arms. - `model-loading.mdx` — rewrite the "Sideloaded `LiquidInferenceEngineOptions` (URL-based load)" callout from "does NOT ship a Swift convenience init in v0.10.7" to "...through v0.10.8" so the version stays accurate — v0.10.8's SKIE-on-openai-client change didn't touch `LiquidInferenceEngineOptions`, so the all-12- fields situation is unchanged.
1 parent 3f75316 commit b9c1a82

7 files changed

Lines changed: 87 additions & 50 deletions

File tree

deployment/on-device/sdk/ai-agent-usage-guide.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Every agent has the same shape: send a `ChatMessage`, iterate the response strea
5858
if let stats = completion.stats {
5959
log("Done: \(stats.totalTokens) tokens at \(stats.tokenPerSecond) tok/s")
6060
}
61+
case .error(let err):
62+
log("Generation failed: \(err.message)")
6163
}
6264
}
6365
```
@@ -76,6 +78,7 @@ Every agent has the same shape: send a `ChatMessage`, iterate the response strea
7678
_text.value = ""
7779
Log.d(TAG, "Done: ${response.stats?.totalTokens} tokens at ${response.stats?.tokenPerSecond} tok/s")
7880
}
81+
is MessageResponse.Error -> Log.e(TAG, "Generation failed: ${response.message}", response.throwable)
7982
}
8083
}
8184
```
@@ -103,8 +106,10 @@ The defining feature of an agent: the model emits `FunctionCalls`, you execute t
103106
toolCalls.append(contentsOf: payload.functionCalls)
104107
case .complete:
105108
break
106-
default:
109+
case .reasoningChunk, .audioSample:
107110
break
111+
case .error(let err):
112+
throw NSError(domain: "AgentLoop", code: 1, userInfo: [NSLocalizedDescriptionKey: err.message])
108113
}
109114
}
110115

@@ -139,7 +144,10 @@ The defining feature of an agent: the model emits `FunctionCalls`, you execute t
139144
when (response) {
140145
is MessageResponse.Chunk -> appendUI(response.text)
141146
is MessageResponse.FunctionCalls -> toolCalls.addAll(response.functionCalls)
142-
else -> {}
147+
is MessageResponse.ReasoningChunk -> {}
148+
is MessageResponse.AudioSample -> {}
149+
is MessageResponse.Complete -> {}
150+
is MessageResponse.Error -> throw response.throwable
143151
}
144152
}
145153

@@ -317,6 +325,8 @@ A `ChatViewModel` that loads the model, registers a tool, drives generation, and
317325
if let stats = c.stats {
318326
print("\nFinished — \(stats.totalTokens) tokens at \(stats.tokenPerSecond) tok/s")
319327
}
328+
case .error(let err):
329+
errorMessage = "Generation failed: \(err.message)"
320330
}
321331
}
322332
}
@@ -408,6 +418,7 @@ A `ChatViewModel` that loads the model, registers a tool, drives generation, and
408418
is MessageResponse.FunctionCalls -> response.functionCalls.forEach { dispatch(it) }
409419
is MessageResponse.AudioSample -> audioRenderer.enqueue(response.samples, response.sampleRate)
410420
is MessageResponse.Complete -> Log.d(TAG, "Done: ${response.stats?.totalTokens} tokens")
421+
is MessageResponse.Error -> _errorMessage.value = "Generation failed: ${response.message}"
411422
}
412423
}
413424

deployment/on-device/sdk/cloud-ai-comparison.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ Cloud APIs deliver deltas; you concatenate them. LEAP delivers `MessageResponse`
127127
print("\nDone! Tokens: \(completion.stats?.totalTokens ?? 0)")
128128
case .reasoningChunk, .audioSample, .functionCalls:
129129
break
130+
case .error(let err):
131+
print("\nGeneration failed: \(err.message)")
130132
}
131133
}
132134
```
@@ -137,7 +139,10 @@ Cloud APIs deliver deltas; you concatenate them. LEAP delivers `MessageResponse`
137139
when (response) {
138140
is MessageResponse.Chunk -> print(response.text)
139141
is MessageResponse.Complete -> println("\nDone! Tokens: ${response.stats?.totalTokens}")
140-
else -> {}
142+
is MessageResponse.ReasoningChunk -> {}
143+
is MessageResponse.FunctionCalls -> {}
144+
is MessageResponse.AudioSample -> {}
145+
is MessageResponse.Error -> println("\nGeneration failed: ${response.message}")
141146
}
142147
}.collect()
143148
```

deployment/on-device/sdk/desktop-platforms.mdx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ The JVM target supports Kotlin and Java projects on macOS (Apple Silicon), Linux
4949
}
5050

5151
dependencies {
52-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
52+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
5353

5454
// Optional: OpenAI-compatible cloud chat client (JVM support added in v0.10.7)
55-
// implementation("ai.liquid.leap:leap-openai-client:0.10.7")
55+
// implementation("ai.liquid.leap:leap-openai-client:0.10.8")
5656

5757
// Optional: Compose Multiplatform voice widget (also runs on JVM)
58-
// implementation("ai.liquid.leap:leap-ui:0.10.7")
58+
// implementation("ai.liquid.leap:leap-ui:0.10.8")
5959
}
6060

6161
application {
@@ -75,7 +75,7 @@ The JVM target supports Kotlin and Java projects on macOS (Apple Silicon), Linux
7575
}
7676
7777
dependencies {
78-
implementation 'ai.liquid.leap:leap-sdk:0.10.7'
78+
implementation 'ai.liquid.leap:leap-sdk:0.10.8'
7979
}
8080
8181
application {
@@ -89,7 +89,7 @@ The JVM target supports Kotlin and Java projects on macOS (Apple Silicon), Linux
8989
<dependency>
9090
<groupId>ai.liquid.leap</groupId>
9191
<artifactId>leap-sdk-jvm</artifactId>
92-
<version>0.10.7</version>
92+
<version>0.10.8</version>
9393
</dependency>
9494
</dependencies>
9595
```
@@ -137,7 +137,10 @@ fun main() = runBlocking {
137137
when (response) {
138138
is MessageResponse.Chunk -> print(response.text)
139139
is MessageResponse.Complete -> println("\n[${response.stats?.totalTokens} tokens]")
140-
else -> {}
140+
is MessageResponse.ReasoningChunk -> {}
141+
is MessageResponse.FunctionCalls -> {}
142+
is MessageResponse.AudioSample -> {}
143+
is MessageResponse.Error -> System.err.println("\n[error] ${response.message}")
141144
}
142145
}
143146

@@ -194,11 +197,11 @@ dependencyResolutionManagement {
194197
// build.gradle.kts
195198
plugins {
196199
kotlin("multiplatform") version "2.3.20"
197-
id("ai.liquid.leap.nativelibs") version "0.10.7"
200+
id("ai.liquid.leap.nativelibs") version "0.10.8"
198201
}
199202

200203
dependencies {
201-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
204+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
202205
}
203206

204207
kotlin {
@@ -227,7 +230,7 @@ plugins {
227230
}
228231

229232
dependencies {
230-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
233+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
231234
}
232235

233236
val nativesDir = layout.buildDirectory.dir("bin/linuxX64/releaseExecutable")
@@ -241,7 +244,7 @@ kotlin {
241244

242245
val leapSdkNatives by configurations.creating
243246
dependencies {
244-
leapSdkNatives("ai.liquid.leap:leap-sdk-linuxx64:0.10.7:natives@zip")
247+
leapSdkNatives("ai.liquid.leap:leap-sdk-linuxx64:0.10.8:natives@zip")
245248
}
246249

247250
val installLeapNatives by tasks.registering(Copy::class) {
@@ -259,8 +262,8 @@ tasks.named("linkReleaseExecutableLinuxX64") { dependsOn(installLeapNatives) }
259262

260263
The Maven coordinates for the `-natives.zip` artifacts:
261264

262-
- `ai.liquid.leap:leap-sdk-linuxx64:0.10.7:natives@zip`
263-
- `ai.liquid.leap:leap-sdk-linuxarm64:0.10.7:natives@zip`
265+
- `ai.liquid.leap:leap-sdk-linuxx64:0.10.8:natives@zip`
266+
- `ai.liquid.leap:leap-sdk-linuxarm64:0.10.8:natives@zip`
264267

265268
## Windows native (MinGW x64)
266269

@@ -269,11 +272,11 @@ The same Kotlin/Native flow works for Windows x86_64 via the MinGW-w64 toolchain
269272
```kotlin
270273
plugins {
271274
kotlin("multiplatform") version "2.3.20"
272-
id("ai.liquid.leap.nativelibs") version "0.10.7"
275+
id("ai.liquid.leap.nativelibs") version "0.10.8"
273276
}
274277

275278
dependencies {
276-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
279+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
277280
}
278281

279282
kotlin {
@@ -291,7 +294,7 @@ The plugin installs `inference_engine.dll`, `libinference_engine_llamacpp_backen
291294

292295
The Maven coordinates for the `-natives.zip` artifact:
293296

294-
- `ai.liquid.leap:leap-sdk-mingwx64:0.10.7:natives@zip`
297+
- `ai.liquid.leap:leap-sdk-mingwx64:0.10.8:natives@zip`
295298

296299
<Info>
297300
**Building from macOS or Linux for Windows?** Kotlin/Native does not support cross-compiling to MinGW from a non-Windows host as of 2.3.20 — the build must run on Windows (native or in CI). GitHub Actions `windows-latest` works without extra setup.
@@ -316,7 +319,7 @@ Identical Swift API to iOS — same `ModelDownloader`, `Conversation`, `ChatMess
316319
```swift
317320
.binaryTarget(
318321
name: "LeapSDK",
319-
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.7/LeapSDK.xcframework.zip",
322+
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.8/LeapSDK.xcframework.zip",
320323
checksum: "6f2721aa45d7555646f78cbcaedb57aba3d869f56b24d681ad332846e131ae3d"
321324
)
322325
```
@@ -329,8 +332,8 @@ If you're targeting macOS as a JVM host — for example with Compose Multiplatfo
329332

330333
```kotlin
331334
dependencies {
332-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
333-
implementation("ai.liquid.leap:leap-ui:0.10.7") // Compose voice widget runs on JVM too
335+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
336+
implementation("ai.liquid.leap:leap-ui:0.10.8") // Compose voice widget runs on JVM too
334337
}
335338
```
336339

deployment/on-device/sdk/function-calling.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ Function calls arrive as the `MessageResponse.FunctionCalls` variant on both pla
108108
}
109109
case .chunk, .reasoningChunk, .audioSample, .complete:
110110
break
111+
case .error(let err):
112+
print("Generation failed: \(err.message)")
111113
}
112114
}
113115
```
@@ -134,7 +136,9 @@ Function calls arrive as the `MessageResponse.FunctionCalls` variant on both pla
134136
// Tool calls are also surfaced on the assembled assistant message:
135137
response.fullMessage.functionCalls?.forEach { /* ... */ }
136138
}
137-
else -> {}
139+
is MessageResponse.ReasoningChunk -> {}
140+
is MessageResponse.AudioSample -> {}
141+
is MessageResponse.Error -> Log.e(TAG, "Generation failed: ${response.message}", response.throwable)
138142
}
139143
}.collect()
140144
```

deployment/on-device/sdk/model-loading.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ Per-load runtime overrides. Default values come from the model bundle's manifest
527527
.with(cacheOptions: .enabled(path: cacheDir.path))
528528
```
529529

530-
**Sideloaded `LiquidInferenceEngineOptions` (URL-based load).** The non-manifest variant does NOT ship a Swift convenience init in v0.10.7 — the K/N-generated designated init takes all 12 fields. Either build it fully (verbose) or use `loadSimpleModel(model: ModelSource(...))` on `ModelDownloader` (preferred for new code; see the Sideloaded files section). The builder `.with(...)` overloads exist but they create a new instance internally via the same 12-arg init, so you still need a fully-built starting instance — there is no `LiquidInferenceEngineOptions(bundlePath: …)` 1-arg form today.
530+
**Sideloaded `LiquidInferenceEngineOptions` (URL-based load).** The non-manifest variant does NOT ship a Swift convenience init through v0.10.8 — the K/N-generated designated init takes all 12 fields. Either build it fully (verbose) or use `loadSimpleModel(model: ModelSource(...))` on `ModelDownloader` (preferred for new code; see the Sideloaded files section). The builder `.with(...)` overloads exist but they create a new instance internally via the same 12-arg init, so you still need a fully-built starting instance — there is no `LiquidInferenceEngineOptions(bundlePath: …)` 1-arg form today.
531531
</Tab>
532532
<Tab title="Kotlin (all platforms)">
533533
```kotlin

deployment/on-device/sdk/quick-start.mdx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Quick Start"
33
description: "Install the LEAP SDK on iOS, macOS, Android, JVM, Linux, or Windows — same API everywhere."
44
---
55

6-
Latest version: `v0.10.7`
6+
Latest version: `v0.10.8`
77

88
The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conversation` / `MessageResponse` API runs on every supported target. The code differs only in **language** (Swift vs. Kotlin) and **packaging** (SPM, Gradle, or Kotlin/Native plugin) — the call shapes are identical. For background on what the SDK is and what first-class LFM support means in practice, see the [Overview](/deployment/on-device/sdk/overview).
99

@@ -68,7 +68,7 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
6868

6969
1. In Xcode choose **File → Add Package Dependencies**.
7070
2. Enter `https://github.com/Liquid4All/leap-sdk.git`.
71-
3. Select the `0.10.7` release (or newer).
71+
3. Select the `0.10.8` release (or newer).
7272
4. Add the products you need to your app target.
7373

7474
The package vends five products. Most apps only need one or two:
@@ -94,7 +94,7 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
9494
</Info>
9595

9696
<Accordion title="Pin to explicit binary XCFrameworks">
97-
For explicit pinning, declare each framework as a `.binaryTarget` in your `Package.swift`. The XCFramework assets live on the `Liquid4All/leap-sdk` v0.10.7 release page — copy the SHA-256 values from there.
97+
For explicit pinning, declare each framework as a `.binaryTarget` in your `Package.swift`. The XCFramework assets live on the `Liquid4All/leap-sdk` v0.10.8 release page — copy the SHA-256 values from there.
9898

9999
<Warning>
100100
The constrained-generation macros (`@Generatable`, `@Guide`) are Swift macros, not XCFrameworks — they ship as the `LeapSDKMacros` source target inside the SPM package and **cannot be installed as a `.binaryTarget`**. If you need them, use the standard SPM package URL above (or add the `LeapSDKMacros` source target separately on top of your binary targets).
@@ -103,23 +103,23 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
103103
```swift
104104
.binaryTarget(
105105
name: "LeapSDK",
106-
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.7/LeapSDK.xcframework.zip",
107-
checksum: "6f2721aa45d7555646f78cbcaedb57aba3d869f56b24d681ad332846e131ae3d"
106+
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.8/LeapSDK.xcframework.zip",
107+
checksum: "<copy from the v0.10.8 release page>"
108108
),
109109
.binaryTarget(
110110
name: "LeapModelDownloader",
111-
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.7/LeapModelDownloader.xcframework.zip",
112-
checksum: "f649aa6c1aa3e87bbeb1073d5aeeb7224879359a24b18eeccc665d24abc725d8"
111+
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.8/LeapModelDownloader.xcframework.zip",
112+
checksum: "<copy from the v0.10.8 release page>"
113113
),
114114
.binaryTarget(
115115
name: "LeapOpenAIClient",
116-
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.7/LeapOpenAIClient.xcframework.zip",
117-
checksum: "79bc5443a1cce6fcd4c49c91eeb85727034aaca10d3ef69582c061989c3d9b70"
116+
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.8/LeapOpenAIClient.xcframework.zip",
117+
checksum: "<copy from the v0.10.8 release page>"
118118
),
119119
.binaryTarget(
120120
name: "LeapUi",
121-
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.7/LeapUi.xcframework.zip",
122-
checksum: "f1b198cef88c2a37eaf6dc1f36395d6aed024b0c6c2b43724d942e25b60d22e0"
121+
url: "https://github.com/Liquid4All/leap-sdk/releases/download/v0.10.8/LeapUi.xcframework.zip",
122+
checksum: "<copy from the v0.10.8 release page>"
123123
),
124124
```
125125

@@ -131,14 +131,14 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
131131

132132
```kotlin
133133
dependencies {
134-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
135-
implementation("ai.liquid.leap:leap-model-downloader:0.10.7") // Android background downloads
134+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
135+
implementation("ai.liquid.leap:leap-model-downloader:0.10.8") // Android background downloads
136136

137137
// Optional: OpenAI-compatible cloud chat client
138-
// implementation("ai.liquid.leap:leap-openai-client:0.10.7")
138+
// implementation("ai.liquid.leap:leap-openai-client:0.10.8")
139139

140140
// Optional: Voice assistant widget (Compose Multiplatform)
141-
// implementation("ai.liquid.leap:leap-ui:0.10.7")
141+
// implementation("ai.liquid.leap:leap-ui:0.10.8")
142142
}
143143
```
144144

@@ -147,7 +147,7 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
147147

148148
```toml
149149
[versions]
150-
leapSdk = "0.10.7"
150+
leapSdk = "0.10.8"
151151

152152
[libraries]
153153
leap-sdk = { module = "ai.liquid.leap:leap-sdk", version.ref = "leapSdk" }
@@ -191,11 +191,11 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
191191
}
192192

193193
dependencies {
194-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
194+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
195195

196196
// Optional:
197-
// implementation("ai.liquid.leap:leap-openai-client:0.10.7")
198-
// implementation("ai.liquid.leap:leap-ui:0.10.7") // Compose for Desktop voice widget
197+
// implementation("ai.liquid.leap:leap-openai-client:0.10.8")
198+
// implementation("ai.liquid.leap:leap-ui:0.10.8") // Compose for Desktop voice widget
199199
}
200200
```
201201

@@ -222,11 +222,11 @@ The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conver
222222
// build.gradle.kts
223223
plugins {
224224
kotlin("multiplatform") version "2.3.20"
225-
id("ai.liquid.leap.nativelibs") version "0.10.7"
225+
id("ai.liquid.leap.nativelibs") version "0.10.8"
226226
}
227227

228228
dependencies {
229-
implementation("ai.liquid.leap:leap-sdk:0.10.7")
229+
implementation("ai.liquid.leap:leap-sdk:0.10.8")
230230
}
231231

232232
kotlin {
@@ -378,7 +378,10 @@ The recommended path is **manifest-based** loading. On every platform, the platf
378378
when (resp) {
379379
is MessageResponse.Chunk -> print(resp.text)
380380
is MessageResponse.Complete -> println("\n[done]")
381-
else -> {}
381+
is MessageResponse.ReasoningChunk -> {}
382+
is MessageResponse.FunctionCalls -> {}
383+
is MessageResponse.AudioSample -> {}
384+
is MessageResponse.Error -> System.err.println("\n[error] ${resp.message}")
382385
}
383386
}
384387

@@ -473,6 +476,10 @@ Both platforms expose the same streaming shape: an async sequence of `MessageRes
473476
return nil
474477
}.joined()
475478
print("Final:", text)
479+
case .error(let err):
480+
// In-band failure (v0.10.8+) — SKIE bridges `Flow` with `Failure = Never`,
481+
// so generation failures arrive here instead of on the `catch` block above.
482+
print("Generation failed:", err.message)
476483
}
477484
}
478485
```
@@ -489,6 +496,7 @@ Both platforms expose the same streaming shape: an async sequence of `MessageRes
489496
is MessageResponse.FunctionCalls -> handleFunctionCalls(response.functionCalls)
490497
is MessageResponse.AudioSample -> audioRenderer.enqueue(response.samples, response.sampleRate)
491498
is MessageResponse.Complete -> Log.d(TAG, "Done. Stats: ${response.stats}")
499+
is MessageResponse.Error -> _errorMessage.value = "Generation failed: ${response.message}"
492500
}
493501
}
494502
?.onCompletion { _isGenerating.value = false }

0 commit comments

Comments
 (0)