Skip to content

Commit 53cc3a2

Browse files
committed
Restructure chat option files
1 parent 3c14a21 commit 53cc3a2

File tree

4 files changed

+81
-78
lines changed

4 files changed

+81
-78
lines changed

Sources/Swollama/ChatOptions.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Foundation
2+
3+
/// Options for chat completion
4+
public struct ChatOptions {
5+
public let tools: [ToolDefinition]?
6+
public let format: ResponseFormat?
7+
public let modelOptions: ModelOptions?
8+
public let keepAlive: TimeInterval?
9+
10+
public init(
11+
tools: [ToolDefinition]? = nil,
12+
format: ResponseFormat? = nil,
13+
modelOptions: ModelOptions? = nil,
14+
keepAlive: TimeInterval? = nil
15+
) {
16+
self.tools = tools
17+
self.format = format
18+
self.modelOptions = modelOptions
19+
self.keepAlive = keepAlive
20+
}
21+
22+
public static let `default` = ChatOptions()
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
3+
/// Options for embedding generation
4+
public struct EmbeddingOptions {
5+
public let truncate: Bool?
6+
public let modelOptions: ModelOptions?
7+
public let keepAlive: TimeInterval?
8+
9+
public init(
10+
truncate: Bool? = true,
11+
modelOptions: ModelOptions? = nil,
12+
keepAlive: TimeInterval? = nil
13+
) {
14+
self.truncate = truncate
15+
self.modelOptions = modelOptions
16+
self.keepAlive = keepAlive
17+
}
18+
19+
public static let `default` = EmbeddingOptions()
20+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Foundation
2+
3+
/// Options for text generation
4+
public struct GenerationOptions {
5+
public let suffix: String?
6+
public let images: [String]?
7+
public let format: ResponseFormat?
8+
public let modelOptions: ModelOptions?
9+
public let systemPrompt: String?
10+
public let template: String?
11+
public let context: [Int]?
12+
public let raw: Bool?
13+
public let keepAlive: TimeInterval?
14+
15+
public init(
16+
suffix: String? = nil,
17+
images: [String]? = nil,
18+
format: ResponseFormat? = nil,
19+
modelOptions: ModelOptions? = nil,
20+
systemPrompt: String? = nil,
21+
template: String? = nil,
22+
context: [Int]? = nil,
23+
raw: Bool? = nil,
24+
keepAlive: TimeInterval? = nil
25+
) {
26+
self.suffix = suffix
27+
self.images = images
28+
self.format = format
29+
self.modelOptions = modelOptions
30+
self.systemPrompt = systemPrompt
31+
self.template = template
32+
self.context = context
33+
self.raw = raw
34+
self.keepAlive = keepAlive
35+
}
36+
37+
public static let `default` = GenerationOptions()
38+
}

Sources/Swollama/OllamaClient+Generation.swift

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -203,81 +203,3 @@ extension OllamaClient {
203203
return try decode(data, as: EmbeddingResponse.self)
204204
}
205205
}
206-
207-
/// Options for text generation
208-
public struct GenerationOptions {
209-
public let suffix: String?
210-
public let images: [String]?
211-
public let format: ResponseFormat?
212-
public let modelOptions: ModelOptions?
213-
public let systemPrompt: String?
214-
public let template: String?
215-
public let context: [Int]?
216-
public let raw: Bool?
217-
public let keepAlive: TimeInterval?
218-
219-
public init(
220-
suffix: String? = nil,
221-
images: [String]? = nil,
222-
format: ResponseFormat? = nil,
223-
modelOptions: ModelOptions? = nil,
224-
systemPrompt: String? = nil,
225-
template: String? = nil,
226-
context: [Int]? = nil,
227-
raw: Bool? = nil,
228-
keepAlive: TimeInterval? = nil
229-
) {
230-
self.suffix = suffix
231-
self.images = images
232-
self.format = format
233-
self.modelOptions = modelOptions
234-
self.systemPrompt = systemPrompt
235-
self.template = template
236-
self.context = context
237-
self.raw = raw
238-
self.keepAlive = keepAlive
239-
}
240-
241-
public static let `default` = GenerationOptions()
242-
}
243-
244-
/// Options for chat completion
245-
public struct ChatOptions {
246-
public let tools: [ToolDefinition]?
247-
public let format: ResponseFormat?
248-
public let modelOptions: ModelOptions?
249-
public let keepAlive: TimeInterval?
250-
251-
public init(
252-
tools: [ToolDefinition]? = nil,
253-
format: ResponseFormat? = nil,
254-
modelOptions: ModelOptions? = nil,
255-
keepAlive: TimeInterval? = nil
256-
) {
257-
self.tools = tools
258-
self.format = format
259-
self.modelOptions = modelOptions
260-
self.keepAlive = keepAlive
261-
}
262-
263-
public static let `default` = ChatOptions()
264-
}
265-
266-
/// Options for embedding generation
267-
public struct EmbeddingOptions {
268-
public let truncate: Bool?
269-
public let modelOptions: ModelOptions?
270-
public let keepAlive: TimeInterval?
271-
272-
public init(
273-
truncate: Bool? = true,
274-
modelOptions: ModelOptions? = nil,
275-
keepAlive: TimeInterval? = nil
276-
) {
277-
self.truncate = truncate
278-
self.modelOptions = modelOptions
279-
self.keepAlive = keepAlive
280-
}
281-
282-
public static let `default` = EmbeddingOptions()
283-
}

0 commit comments

Comments
 (0)