Open
Description
Hi there! I’ve recently started playing with Replicate in SwiftUI and this library has been super helpful.
In my previous custom implementation of the Replicate HTTP API, I was doing some manual polling to get a stream of updates in predictions:
// Illustrative pseudocode
Task {
while prediction.completedAt == nil {
do {
try await Task.sleep(nanoseconds: 1_000_000_000)
prediction = try await fetchPrediction(prediction.id)
} catch {
print(error)
}
}
}
// 1 second
print(prediction.output) // ["Hello", "!", " "]
// 2 seconds
print(prediction.output) // ["Hello", "!", " ", "As", " ", "a", " ", "helpful", ...]
It'd be great if this library included a polling/streaming method alongside the wait
method, especially for chat-like models.
Metadata
Metadata
Assignees
Labels
No labels