Skip to content

Commit

Permalink
Fix concurrency warnings in SpeziLLM & SpeziLLMFog
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisho committed Dec 20, 2024
1 parent 258bca8 commit aeeadd8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions Sources/SpeziLLM/Helpers/LLMContext+Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// SPDX-License-Identifier: MIT
//

@preconcurrency
import SpeziChat

Check failure on line 10 in Sources/SpeziLLM/Helpers/LLMContext+Chat.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint / SwiftLint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)


Expand Down
2 changes: 1 addition & 1 deletion Sources/SpeziLLM/LLMPlatformState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// Describes the current state of the ``LLMPlatform`` which is responsible for sending ``LLMSchema``s to execution via ``LLMSession``s.
///
/// The ``LLMPlatformState`` is quite minimal with only ``LLMPlatformState/idle`` and ``LLMPlatformState/processing`` states.
public enum LLMPlatformState {
public enum LLMPlatformState: Sendable {
/// Indicates that the ``LLMPlatform`` is currently idle and doesn't execute any ``LLMSession``s.
case idle
/// Indicates that the ``LLMPlatform`` is currently processing and executing ``LLMSession``s.
Expand Down
1 change: 1 addition & 0 deletions Sources/SpeziLLM/LLMSessionProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public struct _LLMSessionProvider<Schema: LLMSchema>: DynamicProperty { // s
}

/// Creates a `Binding` to the ``LLMSession``that one can pass around. Useful for passing the ``LLMSession`` as a `Binding` to the ``LLMChatView``.
@MainActor
public var projectedValue: Binding<Schema.Platform.Session> {

Check failure on line 49 in Sources/SpeziLLM/LLMSessionProvider.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint / SwiftLint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)
Binding {
wrappedValue
Expand Down
6 changes: 3 additions & 3 deletions Sources/SpeziLLM/Models/LLMContextEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import Foundation
/// A ``LLMContextEntity`` can be thought of as a single message entity within a ``LLMContext``
/// It consists of a ``LLMContextEntity/Role``, a unique identifier, a timestamp in the form of a `Date` as well as an `String`-based ``LLMContextEntity/content`` property which can contain Markdown-formatted text.
/// Furthermore, the ``LLMContextEntity/complete`` flag indicates if the current state of the ``LLMContextEntity`` is final and the content will not be updated anymore.
public struct LLMContextEntity: Codable, Equatable, Hashable, Identifiable {
public struct LLMContextEntity: Codable, Equatable, Hashable, Identifiable, Sendable {
/// Represents a tool call by the LLM, including its parameters
public struct ToolCall: Codable, Equatable, Hashable {
public struct ToolCall: Codable, Equatable, Hashable, Sendable {
/// The ID of the function call, uniquely identifying the specific function call and matching the response to it.
public let id: String
/// The name of the function call.
Expand All @@ -39,7 +39,7 @@ public struct LLMContextEntity: Codable, Equatable, Hashable, Identifiable {
}

/// Indicates which ``LLMContextEntity/Role`` is associated with a ``LLMContextEntity``.
public enum Role: Codable, Equatable, Hashable {
public enum Role: Codable, Equatable, Hashable, Sendable {
case user
case assistant(toolCalls: [ToolCall] = [])
case system
Expand Down

0 comments on commit aeeadd8

Please sign in to comment.