Skip to main content

React Native Intelligence Service

Functions

isModelFilesDownloaded

IntelligenceService.isModelFilesDownloaded(
name: string
)

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
)

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

Parameters:

  • key: string — Session key from loadModel.

stopModelInference

IntelligenceService.stopModelInference(
key: string
)

Requests cancellation of generation for the given session key.

Parameters:

  • key: string — Session key.

isModelLoaded

IntelligenceService.isModelLoaded(
key: string
)

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
)

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
)

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

Parameters:

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

deleteModelFiles

IntelligenceService.deleteModelFiles(
name: string
)

Deletes all downloaded local files for the given model.

Parameters:

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

getDownloadedModelsList

IntelligenceService.getDownloadedModelsList(): Promise

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

Parameters: None.

invokeModel

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

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?: (string) → void — Optional partial — output stream callback.

syncManagedAIModels

IntelligenceService.syncManagedAIModels(): Promise

Synchronizes the list of managed AI models with the Orchestrator.

Parameters: None.

getManagedAIModels

IntelligenceService.getManagedAIModels(): Promise

Retrieves all managed AI models stored locally.

Parameters: None.

getManagedAIModel

IntelligenceService.getManagedAIModel(
name: string
)

Retrieves a specific managed AI model by name.

Parameters:

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

syncRules

IntelligenceService.syncRules(): Promise

Synchronizes rule definitions with the Orchestrator.

Parameters: None.

getRules

IntelligenceService.getRules(): Promise

Returns all stored rules.

Parameters: None.

getRule

IntelligenceService.getRule(
name: string
)

Retrieves a rule by its name.

Parameters:

  • name: string — Rule name.

runRule

IntelligenceService.runRule(
name: string
)

Evaluates a rule and returns its updated state.

Parameters:

  • name: string — Rule name.

runRules

IntelligenceService.runRules(
onlyOnInit: boolean
)

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;
}