@runanywhere/core 0.17.7 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +218 -2
- package/RunAnywhereCore.podspec +1 -0
- package/android/CMakeLists.txt +24 -2
- package/android/build.gradle +61 -9
- package/android/src/main/cpp/cpp-adapter.cpp +51 -3
- package/android/src/main/include/rac/backends/rac_vlm_llamacpp.h +216 -0
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +3 -1
- package/android/src/main/include/rac/core/rac_core.h +11 -0
- package/android/src/main/include/rac/core/rac_types.h +8 -6
- package/android/src/main/include/rac/features/diffusion/rac_diffusion.h +22 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_component.h +263 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_model_registry.h +358 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_service.h +187 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_tokenizer.h +167 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_types.h +454 -0
- package/android/src/main/include/rac/features/llm/rac_tool_calling.h +373 -0
- package/android/src/main/include/rac/features/platform/rac_diffusion_platform.h +305 -0
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +1 -1
- package/android/src/main/include/rac/features/vlm/rac_vlm.h +16 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_component.h +168 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_service.h +206 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_types.h +417 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +15 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +3 -0
- package/android/src/main/include/rac/utils/rac_image_utils.h +215 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +201 -1
- package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
- package/android/src/main/jniLibs/x86_64/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/x86_64/libomp.so +0 -0
- package/android/src/main/jniLibs/x86_64/librac_commons.so +0 -0
- package/android/src/main/jniLibs/x86_64/librunanywhere_jni.so +0 -0
- package/cpp/HybridRunAnywhereCore.cpp +259 -160
- package/cpp/HybridRunAnywhereCore.hpp +11 -0
- package/cpp/bridges/InitBridge.cpp +234 -3
- package/cpp/bridges/PlatformDownloadBridge.h +44 -0
- package/cpp/bridges/ToolCallingBridge.cpp +188 -0
- package/cpp/bridges/ToolCallingBridge.hpp +98 -0
- package/cpp/third_party/nlohmann/json.hpp +24765 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +18 -4
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion.h +22 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_component.h +263 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_model_registry.h +358 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_platform.h +305 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_service.h +187 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_tokenizer.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_types.h +454 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +3 -17
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_image_utils.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +3 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +4 -20
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +15 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +3 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tool_calling.h +373 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +8 -6
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +1 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm.h +16 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_component.h +168 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_llamacpp.h +216 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_service.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_types.h +417 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +18 -4
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion.h +22 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_component.h +263 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_model_registry.h +358 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_platform.h +305 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_service.h +187 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_tokenizer.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_types.h +454 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +3 -17
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_image_utils.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +3 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +4 -20
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +15 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +3 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tool_calling.h +373 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +8 -6
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +1 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm.h +16 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_component.h +168 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_llamacpp.h +216 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_service.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_types.h +417 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
- package/ios/PlatformAdapterBridge.h +24 -1
- package/ios/PlatformAdapterBridge.m +243 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +4 -0
- package/package.json +8 -4
- package/src/Foundation/Security/SecureStorageService.ts +12 -6
- package/src/Public/Extensions/RunAnywhere+Models.ts +5 -3
- package/src/Public/Extensions/RunAnywhere+STT.ts +7 -2
- package/src/Public/Extensions/RunAnywhere+ToolCalling.ts +472 -0
- package/src/Public/Extensions/index.ts +16 -0
- package/src/Public/RunAnywhere.ts +18 -0
- package/src/index.ts +0 -1
- package/src/services/Network/index.ts +0 -1
- package/src/services/index.ts +0 -1
- package/src/specs/RunAnywhereCore.nitro.ts +72 -0
- package/src/types/ToolCallingTypes.ts +198 -0
- package/src/types/index.ts +13 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolCallingTypes.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Tool Calling functionality.
|
|
5
|
+
* Allows LLMs to request external actions (API calls, device functions, etc.)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Parameter Types
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Supported parameter types for tool arguments
|
|
14
|
+
*/
|
|
15
|
+
export type ParameterType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A single parameter definition for a tool
|
|
19
|
+
*/
|
|
20
|
+
export interface ToolParameter {
|
|
21
|
+
/** Parameter name */
|
|
22
|
+
name: string;
|
|
23
|
+
|
|
24
|
+
/** Data type of the parameter */
|
|
25
|
+
type: ParameterType;
|
|
26
|
+
|
|
27
|
+
/** Human-readable description */
|
|
28
|
+
description: string;
|
|
29
|
+
|
|
30
|
+
/** Whether this parameter is required */
|
|
31
|
+
required: boolean;
|
|
32
|
+
|
|
33
|
+
/** Default value if not provided */
|
|
34
|
+
defaultValue?: unknown;
|
|
35
|
+
|
|
36
|
+
/** Allowed values (for enum-like parameters) */
|
|
37
|
+
enum?: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// =============================================================================
|
|
41
|
+
// Tool Definition Types
|
|
42
|
+
// =============================================================================
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Definition of a tool that the LLM can use
|
|
46
|
+
*/
|
|
47
|
+
export interface ToolDefinition {
|
|
48
|
+
/** Unique name of the tool (e.g., "get_weather") */
|
|
49
|
+
name: string;
|
|
50
|
+
|
|
51
|
+
/** Human-readable description of what the tool does */
|
|
52
|
+
description: string;
|
|
53
|
+
|
|
54
|
+
/** Parameters the tool accepts */
|
|
55
|
+
parameters: ToolParameter[];
|
|
56
|
+
|
|
57
|
+
/** Category for organizing tools (optional) */
|
|
58
|
+
category?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// =============================================================================
|
|
62
|
+
// Tool Call Types (LLM requesting to use a tool)
|
|
63
|
+
// =============================================================================
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A request from the LLM to execute a tool
|
|
67
|
+
*/
|
|
68
|
+
export interface ToolCall {
|
|
69
|
+
/** Name of the tool to execute */
|
|
70
|
+
toolName: string;
|
|
71
|
+
|
|
72
|
+
/** Arguments to pass to the tool */
|
|
73
|
+
arguments: Record<string, unknown>;
|
|
74
|
+
|
|
75
|
+
/** Unique ID for this tool call (for tracking) */
|
|
76
|
+
callId?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// Tool Result Types (Result after execution)
|
|
81
|
+
// =============================================================================
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Result of executing a tool
|
|
85
|
+
*/
|
|
86
|
+
export interface ToolResult {
|
|
87
|
+
/** Name of the tool that was executed */
|
|
88
|
+
toolName: string;
|
|
89
|
+
|
|
90
|
+
/** Whether execution was successful */
|
|
91
|
+
success: boolean;
|
|
92
|
+
|
|
93
|
+
/** Result data (if successful) */
|
|
94
|
+
result?: Record<string, unknown>;
|
|
95
|
+
|
|
96
|
+
/** Error message (if failed) */
|
|
97
|
+
error?: string;
|
|
98
|
+
|
|
99
|
+
/** The original call ID (for tracking) */
|
|
100
|
+
callId?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// =============================================================================
|
|
104
|
+
// Tool Executor Types
|
|
105
|
+
// =============================================================================
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Function type for tool executors
|
|
109
|
+
* Takes arguments, returns a promise with the result
|
|
110
|
+
*/
|
|
111
|
+
export type ToolExecutor = (
|
|
112
|
+
args: Record<string, unknown>
|
|
113
|
+
) => Promise<Record<string, unknown>>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A registered tool with its definition and executor
|
|
117
|
+
*/
|
|
118
|
+
export interface RegisteredTool {
|
|
119
|
+
/** Tool definition (name, description, parameters) */
|
|
120
|
+
definition: ToolDefinition;
|
|
121
|
+
|
|
122
|
+
/** Function that executes the tool */
|
|
123
|
+
executor: ToolExecutor;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// =============================================================================
|
|
127
|
+
// Tool Calling Options
|
|
128
|
+
// =============================================================================
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Options for tool-enabled generation
|
|
132
|
+
*/
|
|
133
|
+
export interface ToolCallingOptions {
|
|
134
|
+
/** Available tools for this generation (if not provided, uses registered tools) */
|
|
135
|
+
tools?: ToolDefinition[];
|
|
136
|
+
|
|
137
|
+
/** Maximum number of tool calls allowed in one conversation turn */
|
|
138
|
+
maxToolCalls?: number;
|
|
139
|
+
|
|
140
|
+
/** Whether to automatically execute tools or return them for manual execution */
|
|
141
|
+
autoExecute?: boolean;
|
|
142
|
+
|
|
143
|
+
/** Temperature for generation */
|
|
144
|
+
temperature?: number;
|
|
145
|
+
|
|
146
|
+
/** Maximum tokens to generate */
|
|
147
|
+
maxTokens?: number;
|
|
148
|
+
|
|
149
|
+
/** System prompt to use (will be merged with tool instructions by default) */
|
|
150
|
+
systemPrompt?: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* If true, replaces the system prompt entirely instead of appending tool instructions.
|
|
154
|
+
* Use this if your system prompt already includes tool-calling instructions.
|
|
155
|
+
* Default: false (tool instructions are appended to systemPrompt)
|
|
156
|
+
*/
|
|
157
|
+
replaceSystemPrompt?: boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* If true, keeps tool definitions available after the first tool call.
|
|
161
|
+
* This allows the LLM to make multiple sequential tool calls if needed.
|
|
162
|
+
* Default: false (tool definitions are removed after first call to encourage natural response)
|
|
163
|
+
*/
|
|
164
|
+
keepToolsAvailable?: boolean;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Tool calling format to use.
|
|
168
|
+
* - 'default': JSON format with <tool_call> tags (Llama, Qwen, Mistral, etc.)
|
|
169
|
+
* - 'lfm2': Pythonic format for Liquid AI LFM2-Tool models
|
|
170
|
+
* Default: 'default'
|
|
171
|
+
*/
|
|
172
|
+
format?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// =============================================================================
|
|
176
|
+
// Tool Calling Result Types
|
|
177
|
+
// =============================================================================
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Result of a generation that may include tool calls
|
|
181
|
+
*/
|
|
182
|
+
export interface ToolCallingResult {
|
|
183
|
+
/** The final text response */
|
|
184
|
+
text: string;
|
|
185
|
+
|
|
186
|
+
/** Any tool calls the LLM made */
|
|
187
|
+
toolCalls: ToolCall[];
|
|
188
|
+
|
|
189
|
+
/** Results of executed tools (if autoExecute was true) */
|
|
190
|
+
toolResults: ToolResult[];
|
|
191
|
+
|
|
192
|
+
/** Whether the response is complete or waiting for tool results */
|
|
193
|
+
isComplete: boolean;
|
|
194
|
+
|
|
195
|
+
/** Conversation ID for continuing with tool results */
|
|
196
|
+
conversationId?: string;
|
|
197
|
+
}
|
|
198
|
+
|
package/src/types/index.ts
CHANGED
|
@@ -144,3 +144,16 @@ export type {
|
|
|
144
144
|
LLMStreamCompleteCallback,
|
|
145
145
|
LLMStreamErrorCallback,
|
|
146
146
|
} from './LLMTypes';
|
|
147
|
+
|
|
148
|
+
// Tool Calling Types
|
|
149
|
+
export type {
|
|
150
|
+
ParameterType,
|
|
151
|
+
ToolParameter,
|
|
152
|
+
ToolDefinition,
|
|
153
|
+
ToolCall,
|
|
154
|
+
ToolResult,
|
|
155
|
+
ToolExecutor,
|
|
156
|
+
RegisteredTool,
|
|
157
|
+
ToolCallingOptions,
|
|
158
|
+
ToolCallingResult,
|
|
159
|
+
} from './ToolCallingTypes';
|