Skip to content

Commit 056dccd

Browse files
AsyncHTTPClient support for linux (#143)
* deps: add trait-based import of AsyncHTTPClient * feat: implement transparent AsyncHTTPClient wrapper * deps: conditionally include trait in EventSource * Increase HTTP request timeout from 60 to 180 seconds --------- Co-authored-by: Leonhard Solbach <49833472+KotlinFactory@users.noreply.github.com>
1 parent f13a136 commit 056dccd

9 files changed

Lines changed: 427 additions & 42 deletions

Package.resolved

Lines changed: 164 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,22 @@ let package = Package(
2525
.trait(name: "CoreML"),
2626
.trait(name: "MLX"),
2727
.trait(name: "Llama"),
28+
.trait(name: "AsyncHTTPClient"),
2829
.default(enabledTraits: []),
2930
],
3031
dependencies: [
3132
.package(url: "https://github.com/huggingface/swift-transformers", from: "1.0.0"),
32-
.package(url: "https://github.com/mattt/EventSource", from: "1.3.0"),
33+
.package(url: "https://github.com/mattt/EventSource", from: "1.3.0", traits: [
34+
.defaults,
35+
.trait(name: "AsyncHTTPClient", condition: .when(traits: ["AsyncHTTPClient"]))
36+
]),
3337
.package(url: "https://github.com/mattt/JSONSchema", from: "1.3.0"),
3438
.package(url: "https://github.com/mattt/llama.swift", .upToNextMajor(from: "2.7484.0")),
3539
.package(url: "https://github.com/mattt/PartialJSONDecoder", from: "1.0.0"),
3640
// mlx-swift-lm must be >= 2.25.5 for ToolSpec/tool calls and UserInput(chat:processing:tools:).
3741
.package(url: "https://github.com/ml-explore/mlx-swift-lm", from: "2.25.5"),
3842
.package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.0"),
43+
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.24.0"),
3944
],
4045
targets: [
4146
.target(
@@ -70,6 +75,11 @@ let package = Package(
7075
package: "llama.swift",
7176
condition: .when(traits: ["Llama"])
7277
),
78+
.product(
79+
name: "AsyncHTTPClient",
80+
package: "async-http-client",
81+
condition: .when(traits: ["AsyncHTTPClient"])
82+
),
7383
]
7484
),
7585
.macro(
@@ -83,7 +93,14 @@ let package = Package(
8393
),
8494
.testTarget(
8595
name: "AnyLanguageModelTests",
86-
dependencies: ["AnyLanguageModel"]
96+
dependencies: [
97+
"AnyLanguageModel",
98+
.product(
99+
name: "AsyncHTTPClient",
100+
package: "async-http-client",
101+
condition: .when(traits: ["AsyncHTTPClient"])
102+
),
103+
],
87104
),
88105
]
89106
)

0 commit comments

Comments
 (0)