Skip to content

Commit dc697f0

Browse files
committed
Use : not @ to delimit model version
We use `:` on the website and in other places, and it's as good a delimiter as any, so this change follows the prevailing winds.
1 parent 449235a commit dc697f0

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import replicate from "replicate";
2323

2424
const prediction = await replicate
2525
.model(
26-
"stability-ai/stable-diffusion@db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
26+
"stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
2727
)
2828
.predict({
2929
prompt: "painting of a cat by andy warhol",
@@ -41,7 +41,7 @@ import replicate from "replicate";
4141

4242
await replicate
4343
.model(
44-
"stability-ai/stable-diffusion@db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
44+
"stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
4545
)
4646
.predict(
4747
{
@@ -63,7 +63,7 @@ import replicate from "replicate";
6363

6464
const prediction = await replicate
6565
.model(
66-
"stability-ai/stable-diffusion@db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
66+
"stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
6767
)
6868
.createPrediction({
6969
prompt: "painting of a cat by andy warhol",

lib/Model.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ beforeEach(() => {
1919
process.env.REPLICATE_API_TOKEN = "test-token-from-env";
2020

2121
client = new ReplicateClient({});
22-
model = client.model("test-owner/test-name@testversion");
22+
model = client.model("test-owner/test-name:testversion");
2323
});
2424

2525
describe("constructor()", () => {

lib/ReplicateClient.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ export default class ReplicateClient {
6262
let owner, name, version;
6363

6464
if (typeof idOrParams === "string") {
65-
const idComponents = /^([\w-]+)\/([\w-]+)@(\w+)$/.exec(idOrParams);
65+
const idComponents = /^([\w-]+)\/([\w-]+):(\w+)$/.exec(idOrParams);
6666

6767
if (!idComponents) {
6868
throw new ReplicateError(
69-
`Invalid model ID: ${idOrParams}. This should be a string in the format {owner}/{name}@{version} or an object with owner, name, and version strings.`
69+
`Invalid model ID: ${idOrParams}. This should be a string in the format {owner}/{name}:{version} or an object with owner, name, and version strings.`
7070
);
7171
}
7272

lib/ReplicateClient.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ describe("getModelVersions()", () => {
122122

123123
describe("model()", () => {
124124
it("returns Model", () => {
125-
const model = client.model("test-owner/test-name@testversion");
125+
const model = client.model("test-owner/test-name:testversion");
126126

127127
expect(model).toBeInstanceOf(Model);
128128
});
129129

130130
it("parses ID string", () => {
131-
const model = client.model("test-owner/test-name@testversion");
131+
const model = client.model("test-owner/test-name:testversion");
132132

133133
expect(model.owner).toBe("test-owner");
134134
expect(model.name).toBe("test-name");

0 commit comments

Comments
 (0)