Skip to content

Commit 651ec4a

Browse files
authored
Equatable conformance for ModelConfiguration and ModelConfiguration.Identifier (#246)
* Make the initializer public for GenerateResult and sampler and processor methods of GenerateParameters.
1 parent c9e2b8f commit 651ec4a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Libraries/MLXLMCommon/ModelConfiguration.swift

+20
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,23 @@ public struct ModelConfiguration: Sendable {
7373
}
7474
}
7575
}
76+
77+
extension ModelConfiguration: Equatable {
78+
79+
}
80+
81+
extension ModelConfiguration.Identifier: Equatable {
82+
83+
public static func == (lhs: ModelConfiguration.Identifier, rhs: ModelConfiguration.Identifier)
84+
-> Bool
85+
{
86+
switch (lhs, rhs) {
87+
case (.id(let lhsID), .id(let rhsID)):
88+
lhsID == rhsID
89+
case (.directory(let lhsURL), .directory(let rhsURL)):
90+
lhsURL == rhsURL
91+
default:
92+
false
93+
}
94+
}
95+
}

0 commit comments

Comments
 (0)