Documentation ¶
Overview ¶
runway is a Go library for interfacing with RunwayML Hosted Models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrPermissionDenied = errors.New("Permission denied, this model is private. Did you include the correct token?") ErrNotFound = errors.New("Model not found. Make sure the url is correct and that the model is \"active\".") ErrInvalidURL = errors.New("The hosted model url you've provided is invalid. It must be in a format like: https://my-model.hosted-models.runwayml.cloud/v1.") ErrModelError = errors.New("The model experienced an error while processing your input. Double-check that you are sending properly formed input parameters in HostedModel.Query(). You can use the HostedModel.Info() method to check the input parameters the model expects. If the error persists, contact support (https://support.runwayml.com).") )
Functions ¶
This section is empty.
Types ¶
type ErrInvalidArgument ¶
func (*ErrInvalidArgument) Error ¶ added in v0.2.0
func (err *ErrInvalidArgument) Error() string
type ErrNetworkError ¶
type ErrNetworkError struct {
Err error
}
func (*ErrNetworkError) Error ¶ added in v0.2.0
func (err *ErrNetworkError) Error() string
func (*ErrNetworkError) Unwrap ¶ added in v0.2.0
func (err *ErrNetworkError) Unwrap() error
type ErrUnexpectedError ¶
type ErrUnexpectedError struct {
Err error
}
func (*ErrUnexpectedError) Error ¶ added in v0.2.0
func (err *ErrUnexpectedError) Error() string
func (*ErrUnexpectedError) Unwrap ¶ added in v0.2.0
func (err *ErrUnexpectedError) Unwrap() error
type HostedModel ¶
type HostedModel struct {
// contains filtered or unexported fields
}
HostedModel represents a RunwayML Hosted Model. See learn.runwayml.com/#/how-to/hosted-models for more details.
func NewHostedModel ¶
func NewHostedModel(url, token string) (*HostedModel, error)
NewHostedModel instantiates a HostedModel object and returns a pointer to it. "url" is the full URL of your hosted model in the format "https://my-model.hosted-models.runwayml.cloud/v1". "token" is the secret token associated with this model, if the model is private. Use an empty string "" if the model has no token.
func (*HostedModel) GetURL ¶ added in v0.2.0
func (model *HostedModel) GetURL() string
GetURL returns the hosted model's url with trailing slashes removed if they were present during creation
func (*HostedModel) Info ¶
func (model *HostedModel) Info() (JSONObject, error)
Info returns a JSONObject containing the input/output spec provided by the model. It makes a GET request to the /v1/info route of a hosted model under the hood.
func (*HostedModel) IsAwake ¶
func (model *HostedModel) IsAwake() (bool, error)
IsAwake returns true if this model is awake, and false if it is still waking up. See the Awake, Awakening, and Awake in the Hosted Models docs for more info: https://learn.runwayml.com/#/how-to/hosted-models?id=asleep-awakening-and-awake-states.
func (*HostedModel) Query ¶
func (model *HostedModel) Query(input JSONObject) (JSONObject, error)
Query runs the model on your input and produce an output. This is how you "run" the model. "input" is an object containing input parameters to be sent to the model. Use the HostedModel.Info() method to get the correct format for this JSONobject, as each model expects different inputs.
func (*HostedModel) WaitUntilAwake ¶
func (model *HostedModel) WaitUntilAwake(pollIntervalMillis int) error
WaitUntilAwake returns once the model is awake. This method is never required, as HostedModel.Info() and HostedModel.Query() will always return results eventually, but it can be useful for managing UI if you want to postpone making Info() and Query() requests until you know that they will resolve more quickly. pollIntervalMillis controls the frequency this method will make HTTP requests to the underlying Hosted Model to check if it is awake yet.
type JSONObject ¶
type JSONObject map[string]interface{}
JSONObject is used to represent JSON structures which are variable or unknown at compile time.