new features

This commit is contained in:
Mark Gregory
2026-11-16 13:41:54 +00:00
parent 87cdc990c3
commit 5338ae5751
16 changed files with 546 additions and 55 deletions
+8 -1
View File
@@ -16,6 +16,8 @@ struct Ollama: InferenceProvider {
struct ToolCall: Decodable {}
let message: Text?
let done: Bool?
let eval_count: Int?
let eval_duration: Double?
let error: String?
let status: String?
let total: Int64?
@@ -143,7 +145,12 @@ struct Ollama: InferenceProvider {
}
if let text = frame.message?.thinking, !text.isEmpty { continuation.yield(.thinking(text)) }
if let text = frame.message?.content, !text.isEmpty { continuation.yield(.answer(text)) }
if frame.done == true { return }
if frame.done == true {
if let count = frame.eval_count, let duration = frame.eval_duration {
continuation.yield(.metrics(ProviderMetrics(tokens: count, seconds: duration / 1_000_000_000)))
}
return
}
}
throw StudioError("Ollama disconnected before completing the response.")
}