new features
This commit is contained in:
@@ -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.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user