Skip to content

Commit 226542d

Browse files
matttJonasProgrammerKotlinFactory
authored
Serialize Linux URLSession request paths to mitigate _MultiHandle race (#134)
* Serialize Linux URLSession request paths to mitigate _MultiHandle race * Incorporate feedback from review * Replace withLock instance method with top-level withLinuxRequestLock helper * Fix Linux compiler bug around generic returning lock helper * More workarounds for Linux compiler bugs * Incorporate feedback from review * 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> * Incorporate feedback from review * swift format -i -r . --------- Co-authored-by: Jonas Stoehr <jonass@dev.jsje.de> Co-authored-by: Leonhard Solbach <49833472+KotlinFactory@users.noreply.github.com>
1 parent 7b311b1 commit 226542d

11 files changed

Lines changed: 760 additions & 94 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: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,26 @@ 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(
34+
url: "https://github.com/mattt/EventSource",
35+
from: "1.3.0",
36+
traits: [
37+
.defaults,
38+
.trait(name: "AsyncHTTPClient", condition: .when(traits: ["AsyncHTTPClient"])),
39+
]
40+
),
3341
.package(url: "https://github.com/mattt/JSONSchema", from: "1.3.0"),
3442
.package(url: "https://github.com/mattt/llama.swift", .upToNextMajor(from: "2.7484.0")),
3543
.package(url: "https://github.com/mattt/PartialJSONDecoder", from: "1.0.0"),
3644
// mlx-swift-lm must be >= 2.25.5 for ToolSpec/tool calls and UserInput(chat:processing:tools:).
3745
.package(url: "https://github.com/ml-explore/mlx-swift-lm", from: "2.25.5"),
3846
.package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.0"),
47+
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.24.0"),
3948
],
4049
targets: [
4150
.target(
@@ -70,6 +79,11 @@ let package = Package(
7079
package: "llama.swift",
7180
condition: .when(traits: ["Llama"])
7281
),
82+
.product(
83+
name: "AsyncHTTPClient",
84+
package: "async-http-client",
85+
condition: .when(traits: ["AsyncHTTPClient"])
86+
),
7387
]
7488
),
7589
.macro(
@@ -83,7 +97,14 @@ let package = Package(
8397
),
8498
.testTarget(
8599
name: "AnyLanguageModelTests",
86-
dependencies: ["AnyLanguageModel"]
100+
dependencies: [
101+
"AnyLanguageModel",
102+
.product(
103+
name: "AsyncHTTPClient",
104+
package: "async-http-client",
105+
condition: .when(traits: ["AsyncHTTPClient"])
106+
),
107+
],
87108
),
88109
]
89110
)

0 commit comments

Comments
 (0)