IntelligenceService
Functions
isModelFilesDownloaded
IntelligenceService.isModelFilesDownloaded(
name: string
): Promise<boolean>
Checks whether model files for the given model name are already downloaded.
Parameters:
name: String— Model name (Orchestrator → Managed AI Models → Programmatic name)
unloadModel
IntelligenceService.unloadModel(
key: string
): Promise<void>
Unloads the model for the given session key and releases memory.
Parameters:
key: string— Session key from loadModel.
stopModelInference
IntelligenceService.stopModelInference(
key: string
): Promise<void>
Requests cancellation of generation for the given session key.
Parameters:
key: string— Session key.
isModelLoaded
IntelligenceService.isModelLoaded(
key: string
): Promise<boolean>
Returns whether a model is loaded for the given session key.
Parameters:
key: string— Session key.
loadModel
IntelligenceService.loadModel(
name: string,
key: string,
modelParams?: ModelParams
): Promise<void>
Loads the specified model into memory with optional parameters. Use key as the session identifier for invoke, unload, and stop.
Parameters:
name: String— Model name (Orchestrator → Managed AI Models → Programmatic name)key: string— Session key for this load.modelParams?: ModelParams— Optional model configuration.
downloadModelFiles
IntelligenceService.downloadModelFiles(
name: string,
onProgress?: (progress: number) => void
): Promise<void>
Downloads model files for the given model. Resolves when the download completes. If onProgress is provided, it is called with values from 0.0 to 1.0.
Parameters:
name: String— Model name (Orchestrator → Managed AI Models → Programmatic name)onProgress: (number) → void— Optional progress callback (0.0–1.0).
deleteModelFiles
IntelligenceService.deleteModelFiles(
name: string
): Promise<void>
Deletes all downloaded local files for the given model.
Parameters:
name: String— Model name (Orchestrator → Managed AI Models → Programmatic name)
getDownloadedModelsList
IntelligenceService.getDownloadedModelsList(): Promise<string[]>
Returns model names whose files exist on the device.
Parameters: None.
getLoadedModels
IntelligenceService.getLoadedModels(): Promise<string[]>
Returns session keys for models currently loaded in memory.
Parameters: None.
invokeModel
IntelligenceService.invokeModel(
key: string,
prompts: Prompt[],
inferenceParams?: InferenceParams,
onStream?: (chunk: string) => void
): Promise<string>
Sends prompts to the model and returns the generated output.
Parameters:
key: string— Session key from loadModel (not the catalog model name).prompts: Prompt[]— Array of messages.inferenceParams?: InferenceParams— Optional inference settings.onStream?: (string) → void— Optional partial — output stream callback.
syncManagedAIModels
IntelligenceService.syncManagedAIModels(): Promise<void>
Synchronizes the list of managed AI models with the Orchestrator.
Parameters: None.
getManagedAIModels
IntelligenceService.getManagedAIModels(): Promise<ManagedAIModel[]>
Retrieves all managed AI models stored locally.
Parameters: None.
getManagedAIModel
IntelligenceService.getManagedAIModel(
name: string
): Promise<ManagedAIModel | null>
Retrieves a specific managed AI model by name.
Parameters:
name: string— Model name (Orchestrator → Managed AI Models → Programmatic name).
syncRules
IntelligenceService.syncRules(): Promise<void>
Synchronizes rule definitions with the Orchestrator.
Parameters: None.
getRules
IntelligenceService.getRules(): Promise<Rule[]>
Returns all stored rules.
Parameters: None.
getRule
IntelligenceService.getRule(
name: string
): Promise<Rule | null>
Retrieves a rule by its name.
Parameters:
name: string— Rule name.
runRule
IntelligenceService.runRule(
name: string
): Promise<Rule | null>
Evaluates a rule and returns its updated state.
Parameters:
name: string— Rule name.
runRules
IntelligenceService.runRules(
onlyOnInit: boolean
): Promise<Rule[]>
Evaluates multiple rules at once.
Parameters:
onlyOnInit: boolean— If true, only initialization rules run.
Classes
LlamaGrammarConfig
{
grammar: string;
grammarRoot?: string;
}
InferenceParams
{
temperature?: number;
maxTokens?: number;
topP?: number;
topK?: number;
grammarConfig?: LlamaGrammarConfig;
}
ModelParams
{
nCtx?: number;
nBatchSize?: number;
nThreads?: number;
nGpuLayers?: number;
}
ManagedAIModel
{
id: string;
name?: string | null;
text?: string | null;
modelDescription?: string | null;
downloadUrl?: string | null;
imageUrl?: string | null;
thinking?: boolean | null;
}
Rule
{
id: string;
name: string;
text: string;
description?: string | null;
trigger: string;
condition: Filter;
action: Action;
}
Action
{
type: string;
config?: ActionConfig | null;
}
ActionConfig
{
id: string;
script?: Script | null;
event?: string | null;
title?: string | null;
message?: string | null;
}
Criteria
{
field: string;
criteriaOperator: string;
value: string;
}
Filter
{
type?: string | null;
filters?: Filter[] | null;
filter?: Filter | null;
criteria?: Criteria | null;
}
Prompt
{
role: 'system' | 'user' | 'assistant';
content: string;
}