const model = new HostedModel({
url: 'https://my-model.hosted-models.runwayml.cloud/v1',
token: 'my-secret-token', # token is only required for private models
})
Return info about the input/output spec provided by the model. Makes a GET request to the /v1/info route of a hosted model under the hood.
Returns true if this model is awake, false if it is still waking up.
See Awake, Awakening, and Awake in the
Hosted Models docs.
Run the model on your input and produce an output. This is how you "run" the model.
An object containing input parameters to be sent to the model. Use the info method to get the correct format for this object, as each model expects different inputs.
Returns a promise that will resolve once the model is awake. This method is never required, as info and 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.
// This is pseudo code
const model = new HostedModel({
url: 'https://my-model.hosted-models.runwayml.cloud/v1',
token: 'my-secret-token', # token is only required for private models
})
// Enter some loading state in the UI.
loading(true)
await model.waitUntilAwake() // This method is never required, but can sometimes be useful
loading(false)
while (true) {
const input = getSomeInput()
const output = await model.query(input)
doSomething(output)
}
waitUntilAwake The rate that this function will poll the hosted model endpoint to check if it is awake yet.
Generated using TypeDoc
A class representing a Runway Hosted Model. This is the main interface provided by this package. Exposes two main methods for interfacing with a model.
info()query(input)Exposes two helper methods for checking the "awake" status of a hosted model.
isAwake()waitUntilAwake()