replicate-api
Advanced tools
@@ -7,3 +7,8 @@ import { ReplicateRequestOptions } from "./helpers/makeApiRequest"; | ||
| /** Cancel a running prediction. | ||
| * | ||
| * ```typescript | ||
| * const result = await cancelPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * If you have a `PredictionStatusObject`, you don't have to use this function, just call `.cancel()` on that object. | ||
@@ -10,0 +15,0 @@ * |
| import { getPrediction } from "./getPrediction.js"; | ||
| import { makeApiRequest } from "./helpers/makeApiRequest.js"; | ||
| /** Cancel a running prediction. | ||
| * | ||
| * ```typescript | ||
| * const result = await cancelPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * If you have a `PredictionStatusObject`, you don't have to use this function, just call `.cancel()` on that object. | ||
@@ -6,0 +11,0 @@ * |
+10
-1
@@ -10,3 +10,12 @@ import { ReplicateRequestOptions } from "./helpers/makeApiRequest"; | ||
| }; | ||
| /** Get information about a model */ | ||
| /** Get information about a model | ||
| * ```typescript | ||
| * const model = await getModel({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * | ||
| * const version = model.version | ||
| * ``` | ||
| */ | ||
| export declare const getModel: (options: ResolveModelOptions) => Promise<{ | ||
@@ -13,0 +22,0 @@ url: string; |
+10
-1
| import { extractModelAndOwner } from "./helpers/extractModelAndOwner.js"; | ||
| import { makeApiRequest } from "./helpers/makeApiRequest.js"; | ||
| /** Get information about a model */ | ||
| /** Get information about a model | ||
| * ```typescript | ||
| * const model = await getModel({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * | ||
| * const version = model.version | ||
| * ``` | ||
| */ | ||
| export const getModel = async (options) => { | ||
@@ -5,0 +14,0 @@ const { owner, model } = extractModelAndOwner(options.model); |
@@ -7,3 +7,12 @@ import { ReplicateRequestOptions } from "./helpers/makeApiRequest"; | ||
| /** Get the `PredictionStatusObject` for a given ID. | ||
| * | ||
| * ```typescript | ||
| * const result = await getPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @returns A new `PredictionStatusObject`. | ||
| */ | ||
| export declare const getPrediction: (options: GetPredictionOptions) => Promise<import("./helpers/convertPrediction").PredictionStatusObject>; |
| import { convertPrediction } from "./helpers/convertPrediction.js"; | ||
| import { makeApiRequest } from "./helpers/makeApiRequest.js"; | ||
| /** Get the `PredictionStatusObject` for a given ID. | ||
| * | ||
| * ```typescript | ||
| * const result = await getPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @returns A new `PredictionStatusObject`. | ||
| */ | ||
@@ -5,0 +14,0 @@ export const getPrediction = async (options) => { |
@@ -5,3 +5,10 @@ import { ReplicateRequestOptions } from "./helpers/makeApiRequest"; | ||
| export declare type GetVersionsOptions = ModelNameOptions & ReplicateRequestOptions; | ||
| /** Get a list of all versions that are availabe for a model */ | ||
| /** Get a list of all versions that are availabe for a model | ||
| * ```typescript | ||
| * const {versions, version} = await getVersions({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| */ | ||
| export declare const getVersions: (options: GetVersionsOptions) => Promise<{ | ||
@@ -8,0 +15,0 @@ next: string | null; |
| import { extractModelAndOwner } from "./helpers/extractModelAndOwner.js"; | ||
| import { makeApiRequest } from "./helpers/makeApiRequest.js"; | ||
| /** Get a list of all versions that are availabe for a model */ | ||
| /** Get a list of all versions that are availabe for a model | ||
| * ```typescript | ||
| * const {versions, version} = await getVersions({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| */ | ||
| export const getVersions = async (options) => { | ||
@@ -5,0 +12,0 @@ const { owner, model } = extractModelAndOwner(options.model); |
@@ -13,2 +13,8 @@ import { PredictionStatusObject } from "./helpers/convertPrediction"; | ||
| * | ||
| * ```typescript | ||
| * const result = await pollPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * If you have a `PredictionStatusObject`, you don't have to use this function, just call `.poll()` on that object. | ||
@@ -15,0 +21,0 @@ * |
| import { getPrediction } from "./getPrediction.js"; | ||
| /** Poll a prediction by ID. | ||
| * | ||
| * ```typescript | ||
| * const result = await pollPrediction({ | ||
| * id: "ID of your prediction", | ||
| * token: "Get your token at https://replicate.com/account" | ||
| * }) | ||
| * ``` | ||
| * If you have a `PredictionStatusObject`, you don't have to use this function, just call `.poll()` on that object. | ||
@@ -5,0 +11,0 @@ * |
@@ -24,3 +24,8 @@ import { ReplicateRequestOptions } from "./helpers/makeApiRequest"; | ||
| * ```typescript | ||
| * const result = await predict({ model: "replicate/hello-world", input: { prompt: "..." }, token: "..." }) | ||
| * const result = await predict({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * input: { prompt: "multicolor hyperspace" }, | ||
| * token: "Get your token at https://replicate.com/account", | ||
| * poll: true, | ||
| * }) | ||
| * ``` | ||
@@ -27,0 +32,0 @@ * |
+6
-1
@@ -7,3 +7,8 @@ import { getModel } from "./getModel.js"; | ||
| * ```typescript | ||
| * const result = await predict({ model: "replicate/hello-world", input: { prompt: "..." }, token: "..." }) | ||
| * const result = await predict({ | ||
| * model: "stability-ai/stable-diffusion", | ||
| * input: { prompt: "multicolor hyperspace" }, | ||
| * token: "Get your token at https://replicate.com/account", | ||
| * poll: true, | ||
| * }) | ||
| * ``` | ||
@@ -10,0 +15,0 @@ * |
+1
-1
| { | ||
| "name": "replicate-api", | ||
| "version": "0.3.0", | ||
| "version": "0.3.1", | ||
| "description": "A typed client library for the replicate.com API", | ||
@@ -5,0 +5,0 @@ "author": { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
29666
7.63%528
18.39%