Skip to main content

React Native Intelligence Service

Functions

isModelFilesDownloaded

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

unloadModel(key: string): Promise<boolean>

Unloads the model for the given session key and releases memory.

Parameters:

  • key: string — Session key from loadModel.

stopModelInference

stopModelInference(key: string): Promise<boolean>

Requests cancellation of generation for the given session key.

Parameters:

  • key: string — Session key.

isModelLoaded

isModelLoaded(key: string): Promise<boolean>

Returns whether a model is loaded for the given session key.

Parameters:

  • key: string — Session key.

loadModel

loadModel(
name: string,
key: string,
modelParams?: ModelParams
): Promise<boolean>

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

downloadModelFiles(name: string): Promise<boolean>

Downloads model files for the given model. Resolves when the download completes.

Parameters:

  • name: String — Model name (Orchestrator → Managed AI Models → Programmatic name)

deleteModelFiles

deleteModelFiles(name: string): Promise<boolean>

Deletes all downloaded local files for the given model.

Parameters:

  • name: String — Model name (Orchestrator → Managed AI Models → Programmatic name)

getDownloadedModelsList

getDownloadedModelsList(): Promise<string[]>

Returns the list of model names whose files are downloaded locally.

Parameters: None.

invokeModel

invokeModel(
key: string,
prompts: Prompt[],
inferenceParams?: InferenceParams,
onStream?: (chunk: string) => void
): Promise<string>

Sends prompts to the model and returns the generated output. When onStream is provided, stream chunks are delivered via DeviceEventEmitter; events are keyed by the same key passed to this method.

Parameters:

  • key: string — Session key from loadModel (not the catalog model name).
  • prompts: Prompt[] — Array of messages.
  • inferenceParams?: InferenceParams — Optional inference settings.
  • onStream?: (chunk: string) => void — Optional callback for streamed partial output.

getMeDataPrompt

getMeDataPrompt(): Promise<Prompt | null>

Returns a system prompt built from the user's MeData, for use as model context. Returns null if no prompt is available.

Parameters: None.

syncManagedAIModels

syncManagedAIModels(): Promise<boolean>

Synchronizes the list of managed AI models with the Orchestrator.

Parameters: None.

getManagedAIModels

getManagedAIModels(): Promise<ManagedAIModel[]>

Retrieves all managed AI models stored locally.

Parameters: None.

getManagedAIModel

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

syncRules(): Promise<boolean>

Synchronizes rule definitions with the Orchestrator.

Parameters: None.

getRules

getRules(): Promise<Rule[]>

Returns all stored rules.

Parameters: None.

getRule

getRule(name: string): Promise<Rule | null>

Retrieves a rule by its name.

Parameters:

  • name: string — Rule name.

runRule

runRule(name: string): Promise<Rule | null>

Evaluates a rule and returns its updated state.

Parameters:

  • name: string — Rule name.

runRules

runRules(onlyOnInit: boolean): Promise<Rule[]>

Evaluates multiple rules at once.

Parameters:

  • onlyOnInit: boolean — If true, only initialization rules run.

Classes

InferenceParams

export interface InferenceParams {
temperature?: number;
maxTokens?: number;
topP?: number;
topK?: number;
}

ModelParams

export interface ModelParams {
nCtx?: number;
nThreads?: number;
nGpuLayers?: number;
nBatchSize?: number;
}

ManagedAIModel

export interface ManagedAIModel {
id: string;
name?: string;
text?: string;
description?: string;
downloadUrl?: string;
imageUrl?: string;
thinking?: boolean;
vendor?: string;
multimodal?: boolean;
}

Rule

export interface Rule {
id: string;
name: string;
text?: string;
trigger?: string;
condition: any;
action: any;
}

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

export interface Prompt {
role: 'system' | 'user' | 'assistant';
content: string;
}