-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
rai-sdk-javascript/src/api/model/modelApi.ts
Lines 26 to 41 in fdbf90d
| async installModels(database: string, engine: string, models: Model[]) { | |
| const action: InstallAction = { | |
| type: 'InstallAction', | |
| sources: models, | |
| }; | |
| return await this.runActions(database, engine, [action], false); | |
| } | |
| async listModels(database: string, engine: string) { | |
| const action: ListSourceAction = { | |
| type: 'ListSourceAction', | |
| }; | |
| return await this.runActions(database, engine, [action]); | |
| } |
It's currently using the v1 actions API. It should instead be issuing an exec() query that loads the models, similar to this implementation of load_json in the julia SDK:
https://github.com/RelationalAI/rai-sdk-julia/blob/6c9ddf55fe791d82b15c8a9e9f80c0bcdec04064/src/api.jl#L650-L655
Ideally it should construct a query string + inputs, that would look something like either of these options:
query = `def insert:rel:catalog:model = model_insertions`;
inputs = {
name: "model_insertions",
value: models.map((m, index) => {
[m.name, m.value],
})
};or like this (copied from the current Console code):
models.forEach((m, index) => {
const inputRelation = `__model_value__${index}__`;
queryStrings.push(
`def delete:rel:catalog:model["${m.name}"] = rel:catalog:model["${m.name}"]`,
`def insert:rel:catalog:model["${m.name}"] = ${inputRelation}`,
);
queryInputs.push({
name: inputRelation,
value: m.value,
});
});