@tensorify.io/sdk
Version:
TypeScript SDK for developing Tensorify plugins with V2-Alpha definition/execution pattern and legacy compatibility
74 lines (64 loc) • 1.49 kB
text/typescript
// V2-Alpha SDK Types
export interface GenerateCodeResult {
code: string;
imports?: string[];
requirements?: string[];
}
export interface GenerateCodeContext {
node: NodeInstance;
inputs: Record<string, any>;
settings: Record<string, any>;
nodeId: string;
getGlobalInputVarName: (inputId: string) => string | undefined;
}
export interface NodeInstance {
id: string;
pluginId: string;
config: Record<string, any>;
inputs: string[];
outputs: string[];
}
export interface Port {
id: string;
name: string;
type: DataType;
required?: boolean;
}
export interface NodeManifest {
id: string;
name: string;
description: string;
version: string;
inputs: Port[];
outputs: Port[];
isFlow?: boolean;
canHaveSubworkflow?: boolean;
}
export enum DataType {
ANY = "Any",
MODEL = "Model",
DATASET = "Dataset",
DATALOADER = "DataLoader",
OPTIMIZER = "Optimizer",
LOSS_FUNCTION = "LossFunction",
TENSOR = "Tensor",
NUMBER = "Number",
STRING = "String",
BOOLEAN = "Boolean",
ARRAY = "Array",
OBJECT = "Object",
// Dataset types
TRAIN_DATASET = "TrainDataset",
VAL_DATASET = "ValDataset",
TEST_DATASET = "TestDataset",
PREPROCESSED_DATASET = "PreprocessedDataset",
}
export interface PluginSettings {
[key: string]: any;
variableName?: string;
labelName?: string;
}
export interface NodeRegistry {
getManifest(pluginId: string): NodeManifest | undefined;
getNode(nodeId: string): NodeInstance | undefined;
}