replicate-go
replicate-go copied to clipboard
Go client for Replicate
See https://replicate.com/docs/reference/http
It's more practical for retry logic to be handled by the underlying `http.Client`. For example, using github.com/hashicorp/go-retryablehttp
If the ctx used by StreamPrediction is canceled, StreamPrediction will throw an error. The expectation is that StreamPrediction stops processing without throwing an error.
The method signature for `CreatePrediction` is less than ideal: ```go func (r *Client) CreatePrediction(ctx context.Context, version string, input PredictionInput, webhook *Webhook, stream bool) (*Prediction, error) {} ``` - It's too...
Or how can i find the version for example for `black-forest-labs/flux-schnell` ? Other models have a "versions" tab, seems like this is missing here?
Streaming is now enabled by default for all predictions. For more information, see https://replicate.com/changelog/2024-07-15-streams-always-available-stream-parameter-deprecated
The helper function `Client.Run` only returns Prediction.Output https://github.com/replicate/replicate-go/blob/832859755ef4c465daf209271a889d120e4416d6/run.go#L25 I ran a prediction that failed and `Client.Run` returned non -nil error even though the Prediction had failed * Prediction.Status was "failed"...
This simplifies the streaming code. The previous code had three parallel goroutines, this does it all in one. I use bufio.Scanner to split response.Body on "\n\n" tokens. There was a...
the model does not seem to have a version ```go output, err := client.Run(ctx, "black-forest-labs/flux-schnell", inputData, nil) ``` `error: failed to run model: version must be specified`
I wanted to run evaluations for this model https://replicate.com/cuuupid/gte-qwen2-7b-instruct. But I kept getting this error when I triggered larger number of "run" requests: ``` Unknown Error: invalid character '