Skip to content

Commit

Permalink
feat: conforms to Sendable (#4)
Browse files Browse the repository at this point in the history
* feat: conforms to `Sendable`

* update machine to macOS 15
  • Loading branch information
kevinhermawan authored Oct 27, 2024
1 parent 585de82 commit 5b42916
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ on:

jobs:
test-ios:
runs-on: macos-14
runs-on: macos-15

steps:
- uses: actions/checkout@v4

- name: Build and test
run: xcodebuild test -scheme AIModelRetriever -destination 'platform=iOS Simulator,name=iPhone 15 Pro'
run: xcodebuild test -scheme AIModelRetriever -destination 'platform=iOS Simulator,name=iPhone 16 Pro'

test-macos:
runs-on: macos-14
runs-on: macos-15

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:

jobs:
deploy:
runs-on: macos-14
runs-on: macos-15

environment:
name: github-pages
Expand Down
4 changes: 2 additions & 2 deletions Playground/Playground.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "ai.hermawan.swift-ai-model-retriever.Playground";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -306,7 +306,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "ai.hermawan.swift-ai-model-retriever.Playground";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ for model in models {

> Note: The Anthropic models are hardcoded. They do not require an API call to retrieve.
### Retrieving Cohere Models

```swift
let models = modelRetriever.cohere(apiKey: "your-cohere-api-key")

for model in models {
print("Model ID: \(model.id), Name: \(model.name)")
}
```

### Retrieving Google Models

```swift
Expand Down
2 changes: 1 addition & 1 deletion Sources/AIModelRetriever/AIModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// A struct that represents an AI model.
public struct AIModel: Identifiable {
public struct AIModel: Identifiable, Sendable {
/// The unique identifier of the model.
public let id: String

Expand Down
2 changes: 1 addition & 1 deletion Sources/AIModelRetriever/AIModelRetriever.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import FoundationNetworking
#endif

/// A struct that retrieves AI models from various providers.
public struct AIModelRetriever {
public struct AIModelRetriever: Sendable {
/// Initializes a new instance of ``AIModelRetriever``.
public init() {}

Expand Down
2 changes: 1 addition & 1 deletion Sources/AIModelRetriever/AIModelRetrieverError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// An enum that represents errors that can occur during AI model retrieval.
public enum AIModelRetrieverError: Error {
public enum AIModelRetrieverError: Error, Sendable {
/// Indicates that the server response was not in the expected format.
case badServerResponse

Expand Down
10 changes: 10 additions & 0 deletions Sources/AIModelRetriever/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ for model in models {

> Note: The Anthropic models are hardcoded. They do not require an API call to retrieve.
### Retrieving Cohere Models

```swift
let models = modelRetriever.cohere(apiKey: "your-cohere-api-key")

for model in models {
print("Model ID: \(model.id), Name: \(model.name)")
}
```

### Retrieving Google Models

```swift
Expand Down

0 comments on commit 5b42916

Please sign in to comment.