Skip to content

Commit

Permalink
docs: handle throwing expression in the LLMOpenAIDemoView example
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhdk committed Aug 16, 2024
1 parent f52fe38 commit d08cb65
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 18 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ struct LLMLocalDemoView: View {
)
)
for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down Expand Up @@ -189,8 +193,12 @@ struct LLMOpenAIDemoView: View {
)
)
for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down Expand Up @@ -263,8 +271,12 @@ struct LLMFogDemoView: View {
)
)
for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMFog/LLMFogSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ import SpeziLLM
/// )
/// )
///
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// do {
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// }
/// } catch {
/// // Handle errors ...
/// }
/// }
/// }
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMFog/SpeziLLMFog.docc/SpeziLLMFog.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ struct LLMFogDemoView: View {
)
)

for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMLocal/LLMLocalSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ import SpeziLLM
/// )
/// )
///
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// do {
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// }
/// } catch {
/// // Handle errors ...
/// }
/// }
/// }
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMLocal/SpeziLLMLocal.docc/SpeziLLMLocal.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ struct LLMLocalDemoView: View {
)
)
for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMOpenAI/LLMOpenAISession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ import SpeziSecureStorage
/// )
/// )
///
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// do {
/// for try await token in try await llmSession.generate() {
/// responseText.append(token)
/// }
/// } catch {
/// // Handle errors ...
/// }
/// }
/// }
Expand Down
8 changes: 6 additions & 2 deletions Sources/SpeziLLMOpenAI/SpeziLLMOpenAI.docc/SpeziLLMOpenAI.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ struct LLMOpenAIDemoView: View {
)
)

for try await token in try await llmSession.generate() {
responseText.append(token)
do {
for try await token in try await llmSession.generate() {
responseText.append(token)
}
} catch {
// Handle errors ...
}
}
}
Expand Down

0 comments on commit d08cb65

Please sign in to comment.