Skip to content

Commit 1760779

Browse files
committed
convert this to the new structured format
1 parent c15e408 commit 1760779

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

Tools/llm-tool/LLMTool.swift

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -235,31 +235,12 @@ struct EvaluateCommand: AsyncParsableCommand {
235235
?? modelConfiguration.defaultPrompt
236236
let images = image.map { UserInput.Image.url($0) }
237237
let videos = video.map { UserInput.Video.url($0) }
238-
let messages: [[String: Any]] =
239-
if !images.isEmpty || !videos.isEmpty {
240-
[
241-
[
242-
"role": "user",
243-
"content": [
244-
[
245-
"type": "text",
246-
"text": generate.system,
247-
]
248-
]
249-
// Messages format for Qwen 2 VL, Qwen 2.5 VL. May need to be adapted for other models.
250-
+ images.map { _ in ["type": "image"] }
251-
+ videos.map { _ in ["type": "video"] },
252-
]
253-
]
254-
} else {
255-
[
256-
[
257-
"role": "user",
258-
"content": prompt,
259-
]
260-
]
261-
}
262-
var userInput = UserInput(messages: messages, images: images, videos: videos)
238+
var userInput = UserInput(
239+
chat: [
240+
.system(generate.system),
241+
.user(prompt, images: images, videos: videos),
242+
],
243+
)
263244
if !resize.isEmpty {
264245
let size: CGSize
265246
if resize.count == 1 {

0 commit comments

Comments
 (0)