-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-model.mjs
52 lines (47 loc) · 1.07 KB
/
deploy-model.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { OrbisDB } from "@useorbis/db-sdk";
import { OrbisKeyDidAuth } from "@useorbis/db-sdk/auth";
const db = new OrbisDB({
ceramic: {
gateway: "https://ceramic-orbisdb-mainnet-direct.hirenodes.io/",
},
nodes: [
{
gateway: "http://localhost:7008",
},
],
});
const embeddingModel = {
version: "2.0",
name: "EmbeddingModel",
description: "Embedding model",
accountRelation: { type: "list" },
interface: false,
implements: [],
schema: {
type: "object",
properties: {
embedding: {
type: "array",
items: {
type: "number",
},
},
content: {
type: "string",
},
},
additionalProperties: false,
},
};
const run = async () => {
const seed = await OrbisKeyDidAuth.generateSeed();
// Initiate the authenticator using the generated (or persisted) seed
const auth = await OrbisKeyDidAuth.fromSeed(seed);
// Authenticate the user
await db.connectUser({ auth });
const model = await db.ceramic.createModel(embeddingModel);
console.log({
model,
});
};
run();