-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.swift
More file actions
77 lines (70 loc) · 2.96 KB
/
Copy pathPackage.swift
File metadata and controls
77 lines (70 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// swift-tools-version: 5.10
import Foundation
import PackageDescription
// Monorepo: sibling packages when present next to this repo (Alric layout).
// SPI / standalone clone: GitHub URLs when SPI_PROCESSING is set or sibling missing.
private let packageDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
private func siblingOrRemote(
siblingRelativePath: String,
url: String,
from version: Version
) -> Package.Dependency {
let siblingManifest = packageDirectory
.appendingPathComponent(siblingRelativePath)
.standardized
.appendingPathComponent("Package.swift")
let forceRemote = ProcessInfo.processInfo.environment["SPI_PROCESSING"] != nil
|| ProcessInfo.processInfo.environment["FORCE_REMOTE_PACKAGES"] != nil
if !forceRemote, FileManager.default.fileExists(atPath: siblingManifest.path) {
return .package(path: siblingRelativePath)
}
return .package(url: url, from: version)
}
let package = Package(
name: "AIChatKitMLX",
platforms: [.macOS(.v14), .iOS(.v17)],
products: [
.library(name: "AIChatMLX", targets: ["AIChatMLX"]),
],
dependencies: [
siblingOrRemote(
siblingRelativePath: "../AIChatKit",
url: "https://github.com/NerdSnipe-Inc/AIChatKit.git",
from: "1.0.0"
),
siblingOrRemote(
siblingRelativePath: "../mlx-swift-lm",
url: "https://github.com/ml-explore/mlx-swift-lm.git",
from: "3.0.0"
),
// Same constraint mlx-swift-lm declares — MLX is needed directly for the wired-memory
// ticket types (`WiredMemoryTicket`, `WiredMemoryManager`) used to bound model residency.
.package(url: "https://github.com/ml-explore/mlx-swift", .upToNextMinor(from: "0.31.3")),
.package(url: "https://github.com/huggingface/swift-huggingface.git", .upToNextMajor(from: "0.9.0")),
.package(url: "https://github.com/huggingface/swift-transformers.git", .upToNextMajor(from: "1.2.1")),
],
targets: [
.target(
name: "AIChatMLX",
dependencies: [
.product(name: "AIChatCore", package: "AIChatKit"),
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXLLM", package: "mlx-swift-lm"),
.product(name: "MLXVLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
.product(name: "MLXHuggingFace", package: "mlx-swift-lm"),
.product(name: "HuggingFace", package: "swift-huggingface"),
.product(name: "Tokenizers", package: "swift-transformers"),
],
path: "Sources/AIChatMLX"
),
.testTarget(
name: "AIChatMLXTests",
dependencies: [
"AIChatMLX",
.product(name: "MLX", package: "mlx-swift"),
],
path: "Tests/AIChatMLXTests"
),
]
)