@runanywhere/llamacpp 0.18.0 → 0.19.13
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 +85 -413
- package/RunAnywhereLlama.podspec +27 -13
- package/android/CMakeLists.txt +37 -20
- package/android/build.gradle +83 -8
- package/cpp/HybridRunAnywhereLlama.cpp +26 -269
- package/cpp/HybridRunAnywhereLlama.hpp +2 -58
- package/ios/{Frameworks → Binaries}/RABackendLLAMACPP.xcframework/Info.plist +8 -9
- package/ios/{Frameworks/RABackendLLAMACPP.xcframework/ios-arm64/RABackendLLAMACPP.framework/RABackendLLAMACPP → Binaries/RABackendLLAMACPP.xcframework/ios-arm64/librac_backend_llamacpp.a} +0 -0
- package/ios/{Frameworks/RABackendLLAMACPP.xcframework/ios-arm64_x86_64-simulator/RABackendLLAMACPP.framework/RABackendLLAMACPP → Binaries/RABackendLLAMACPP.xcframework/ios-arm64-simulator/librac_backend_llamacpp.a} +0 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/llama/runanywherellamaOnLoad.kt +1 -1
- package/nitrogen/generated/android/runanywherellama+autolinking.cmake +2 -2
- package/nitrogen/generated/android/runanywherellama+autolinking.gradle +1 -1
- package/nitrogen/generated/android/runanywherellamaOnLoad.cpp +23 -18
- package/nitrogen/generated/android/runanywherellamaOnLoad.hpp +14 -5
- package/nitrogen/generated/ios/RunAnywhereLlama+autolinking.rb +4 -2
- package/nitrogen/generated/ios/RunAnywhereLlama-Swift-Cxx-Bridge.cpp +2 -2
- package/nitrogen/generated/ios/RunAnywhereLlama-Swift-Cxx-Bridge.hpp +2 -2
- package/nitrogen/generated/ios/RunAnywhereLlama-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/RunAnywhereLlamaAutolinking.mm +1 -1
- package/nitrogen/generated/ios/RunAnywhereLlamaAutolinking.swift +6 -2
- package/nitrogen/generated/shared/c++/HybridRunAnywhereLlamaSpec.cpp +1 -11
- package/nitrogen/generated/shared/c++/HybridRunAnywhereLlamaSpec.hpp +2 -15
- package/package.json +13 -10
- package/react-native.config.js +1 -3
- package/src/LlamaCPP.ts +32 -160
- package/src/LlamaCppProvider.ts +32 -36
- package/src/index.ts +18 -23
- package/src/native/NativeRunAnywhereLlama.ts +19 -5
- package/src/specs/RunAnywhereLlama.nitro.ts +17 -126
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/cpp/cpp-adapter.cpp +0 -14
- package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +0 -218
- package/android/src/main/include/rac/backends/rac_stt_onnx.h +0 -99
- package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +0 -153
- package/android/src/main/include/rac/backends/rac_tts_onnx.h +0 -71
- package/android/src/main/include/rac/backends/rac_vad_onnx.h +0 -84
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +0 -290
- package/android/src/main/include/rac/core/rac_analytics_events.h +0 -610
- package/android/src/main/include/rac/core/rac_audio_utils.h +0 -88
- package/android/src/main/include/rac/core/rac_component_types.h +0 -160
- package/android/src/main/include/rac/core/rac_core.h +0 -331
- package/android/src/main/include/rac/core/rac_error.h +0 -469
- package/android/src/main/include/rac/core/rac_events.h +0 -334
- package/android/src/main/include/rac/core/rac_logger.h +0 -416
- package/android/src/main/include/rac/core/rac_platform_adapter.h +0 -340
- package/android/src/main/include/rac/core/rac_sdk_state.h +0 -292
- package/android/src/main/include/rac/core/rac_structured_error.h +0 -594
- package/android/src/main/include/rac/core/rac_types.h +0 -264
- package/android/src/main/include/rac/features/llm/rac_llm.h +0 -17
- package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +0 -188
- package/android/src/main/include/rac/features/llm/rac_llm_component.h +0 -228
- package/android/src/main/include/rac/features/llm/rac_llm_events.h +0 -215
- package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +0 -402
- package/android/src/main/include/rac/features/llm/rac_llm_service.h +0 -163
- package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +0 -141
- package/android/src/main/include/rac/features/llm/rac_llm_types.h +0 -384
- package/android/src/main/include/rac/features/platform/rac_llm_platform.h +0 -204
- package/android/src/main/include/rac/features/platform/rac_tts_platform.h +0 -197
- package/android/src/main/include/rac/features/stt/rac_stt.h +0 -17
- package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +0 -204
- package/android/src/main/include/rac/features/stt/rac_stt_component.h +0 -162
- package/android/src/main/include/rac/features/stt/rac_stt_events.h +0 -62
- package/android/src/main/include/rac/features/stt/rac_stt_service.h +0 -154
- package/android/src/main/include/rac/features/stt/rac_stt_types.h +0 -389
- package/android/src/main/include/rac/features/tts/rac_tts.h +0 -17
- package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +0 -181
- package/android/src/main/include/rac/features/tts/rac_tts_component.h +0 -158
- package/android/src/main/include/rac/features/tts/rac_tts_events.h +0 -54
- package/android/src/main/include/rac/features/tts/rac_tts_service.h +0 -162
- package/android/src/main/include/rac/features/tts/rac_tts_types.h +0 -374
- package/android/src/main/include/rac/features/vad/rac_vad.h +0 -17
- package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +0 -236
- package/android/src/main/include/rac/features/vad/rac_vad_component.h +0 -185
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +0 -443
- package/android/src/main/include/rac/features/vad/rac_vad_events.h +0 -76
- package/android/src/main/include/rac/features/vad/rac_vad_service.h +0 -167
- package/android/src/main/include/rac/features/vad/rac_vad_types.h +0 -244
- package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +0 -612
- package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +0 -176
- package/android/src/main/include/rac/infrastructure/download/rac_download.h +0 -418
- package/android/src/main/include/rac/infrastructure/events/rac_events.h +0 -177
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +0 -169
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +0 -258
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +0 -357
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +0 -374
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +0 -613
- package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +0 -335
- package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +0 -252
- package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +0 -85
- package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +0 -102
- package/android/src/main/include/rac/infrastructure/network/rac_environment.h +0 -220
- package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +0 -233
- package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +0 -286
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +0 -206
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +0 -234
- package/android/src/main/java/com/margelo/nitro/runanywhere/llama/RunAnywhereLlamaPackage.kt +0 -35
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_backend_llamacpp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_backend_llamacpp_jni.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/x86_64/libomp.so +0 -0
- package/android/src/main/jniLibs/x86_64/librac_backend_llamacpp.so +0 -0
- package/android/src/main/jniLibs/x86_64/librac_backend_llamacpp_jni.so +0 -0
- package/android/src/main/jniLibs/x86_64/librac_commons.so +0 -0
- package/cpp/bridges/LLMBridge.cpp +0 -209
- package/cpp/bridges/LLMBridge.hpp +0 -109
- package/cpp/bridges/StructuredOutputBridge.cpp +0 -151
- package/cpp/bridges/StructuredOutputBridge.hpp +0 -66
- package/cpp/rac_llm_llamacpp.h +0 -34
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64/RABackendLLAMACPP.framework/Headers/RABackendLLAMACPP.h +0 -2
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64/RABackendLLAMACPP.framework/Info.plist +0 -11
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64/RABackendLLAMACPP.framework/Modules/module.modulemap +0 -5
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64_x86_64-simulator/RABackendLLAMACPP.framework/Headers/RABackendLLAMACPP.h +0 -2
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64_x86_64-simulator/RABackendLLAMACPP.framework/Info.plist +0 -11
- package/ios/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64_x86_64-simulator/RABackendLLAMACPP.framework/Modules/module.modulemap +0 -5
- package/ios/LlamaCPPBackend.podspec +0 -127
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file StructuredOutputBridge.cpp
|
|
3
|
-
* @brief Structured Output bridge implementation
|
|
4
|
-
*
|
|
5
|
-
* Uses RACommons structured output API for prompt preparation and JSON extraction.
|
|
6
|
-
* Uses LLMBridge for actual text generation.
|
|
7
|
-
* RACommons is REQUIRED - no stub implementations.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#include "StructuredOutputBridge.hpp"
|
|
11
|
-
#include "LLMBridge.hpp"
|
|
12
|
-
#include <stdexcept>
|
|
13
|
-
#include <cstdlib> // For free()
|
|
14
|
-
|
|
15
|
-
// Unified logging via rac_logger.h
|
|
16
|
-
#include "rac_logger.h"
|
|
17
|
-
|
|
18
|
-
// Log category for this module
|
|
19
|
-
#define LOG_CATEGORY "LLM.StructuredOutput"
|
|
20
|
-
|
|
21
|
-
namespace runanywhere {
|
|
22
|
-
namespace bridges {
|
|
23
|
-
|
|
24
|
-
StructuredOutputBridge& StructuredOutputBridge::shared() {
|
|
25
|
-
static StructuredOutputBridge instance;
|
|
26
|
-
return instance;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
StructuredOutputResult StructuredOutputBridge::generate(
|
|
30
|
-
const std::string& prompt,
|
|
31
|
-
const std::string& schema,
|
|
32
|
-
const std::string& optionsJson
|
|
33
|
-
) {
|
|
34
|
-
StructuredOutputResult result;
|
|
35
|
-
|
|
36
|
-
if (!LLMBridge::shared().isLoaded()) {
|
|
37
|
-
throw std::runtime_error("StructuredOutputBridge: LLM model not loaded. Call loadModel() first.");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Prepare the prompt using RACommons structured output API
|
|
41
|
-
rac_structured_output_config_t config = RAC_STRUCTURED_OUTPUT_DEFAULT;
|
|
42
|
-
config.json_schema = schema.c_str();
|
|
43
|
-
config.include_schema_in_prompt = RAC_TRUE;
|
|
44
|
-
|
|
45
|
-
char* preparedPrompt = nullptr;
|
|
46
|
-
rac_result_t prepResult = rac_structured_output_prepare_prompt(
|
|
47
|
-
prompt.c_str(),
|
|
48
|
-
&config,
|
|
49
|
-
&preparedPrompt
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
std::string structuredPrompt;
|
|
53
|
-
if (prepResult == RAC_SUCCESS && preparedPrompt) {
|
|
54
|
-
structuredPrompt = preparedPrompt;
|
|
55
|
-
free(preparedPrompt);
|
|
56
|
-
} else {
|
|
57
|
-
// Fallback: Build prompt manually
|
|
58
|
-
RAC_LOG_DEBUG(LOG_CATEGORY, "Fallback to manual prompt preparation");
|
|
59
|
-
structuredPrompt =
|
|
60
|
-
"You must respond with valid JSON matching this schema:\n" +
|
|
61
|
-
schema + "\n\n" +
|
|
62
|
-
"User request: " + prompt + "\n\n" +
|
|
63
|
-
"Respond with valid JSON only, no other text:";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Generate using LLMBridge
|
|
67
|
-
LLMOptions opts;
|
|
68
|
-
opts.maxTokens = 1024;
|
|
69
|
-
opts.temperature = 0.1; // Lower temperature for structured output
|
|
70
|
-
// TODO: Parse optionsJson if provided
|
|
71
|
-
|
|
72
|
-
LLMResult llmResult;
|
|
73
|
-
try {
|
|
74
|
-
llmResult = LLMBridge::shared().generate(structuredPrompt, opts);
|
|
75
|
-
} catch (const std::runtime_error& e) {
|
|
76
|
-
throw std::runtime_error("StructuredOutputBridge: LLM generation failed: " + std::string(e.what()));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (llmResult.text.empty()) {
|
|
80
|
-
throw std::runtime_error("StructuredOutputBridge: LLM generation returned empty text.");
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Extract JSON using RACommons API
|
|
84
|
-
char* extractedJson = nullptr;
|
|
85
|
-
size_t jsonLength = 0;
|
|
86
|
-
rac_result_t extractResult = rac_structured_output_extract_json(
|
|
87
|
-
llmResult.text.c_str(),
|
|
88
|
-
&extractedJson,
|
|
89
|
-
&jsonLength
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
if (extractResult == RAC_SUCCESS && extractedJson && jsonLength > 0) {
|
|
93
|
-
result.json = std::string(extractedJson, jsonLength);
|
|
94
|
-
result.success = true;
|
|
95
|
-
free(extractedJson);
|
|
96
|
-
RAC_LOG_INFO(LOG_CATEGORY, "Successfully extracted JSON (%zu bytes)", jsonLength);
|
|
97
|
-
} else {
|
|
98
|
-
// Fallback: Try manual extraction
|
|
99
|
-
RAC_LOG_DEBUG(LOG_CATEGORY, "Fallback to manual JSON extraction");
|
|
100
|
-
|
|
101
|
-
std::string text = llmResult.text;
|
|
102
|
-
size_t start = 0, end = 0;
|
|
103
|
-
|
|
104
|
-
// Try using RACommons to find JSON boundaries
|
|
105
|
-
if (rac_structured_output_find_complete_json(text.c_str(), &start, &end) == RAC_TRUE) {
|
|
106
|
-
result.json = text.substr(start, end - start);
|
|
107
|
-
result.success = true;
|
|
108
|
-
} else {
|
|
109
|
-
// Manual fallback
|
|
110
|
-
start = text.find('{');
|
|
111
|
-
end = text.rfind('}');
|
|
112
|
-
|
|
113
|
-
if (start != std::string::npos && end != std::string::npos && end > start) {
|
|
114
|
-
result.json = text.substr(start, end - start + 1);
|
|
115
|
-
result.success = true;
|
|
116
|
-
} else {
|
|
117
|
-
// Try array
|
|
118
|
-
start = text.find('[');
|
|
119
|
-
end = text.rfind(']');
|
|
120
|
-
if (start != std::string::npos && end != std::string::npos && end > start) {
|
|
121
|
-
result.json = text.substr(start, end - start + 1);
|
|
122
|
-
result.success = true;
|
|
123
|
-
} else {
|
|
124
|
-
throw std::runtime_error("StructuredOutputBridge: Could not extract valid JSON from response: " + text);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Validate the extracted JSON (optional but good for debugging)
|
|
131
|
-
if (result.success) {
|
|
132
|
-
rac_structured_output_validation_t validation = {};
|
|
133
|
-
rac_result_t valResult = rac_structured_output_validate(
|
|
134
|
-
result.json.c_str(),
|
|
135
|
-
&config,
|
|
136
|
-
&validation
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
if (valResult != RAC_SUCCESS || validation.is_valid != RAC_TRUE) {
|
|
140
|
-
RAC_LOG_WARNING(LOG_CATEGORY, "Extracted JSON failed validation");
|
|
141
|
-
// Don't throw - the JSON was extracted, just log warning
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
rac_structured_output_validation_free(&validation);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
} // namespace bridges
|
|
151
|
-
} // namespace runanywhere
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file StructuredOutputBridge.hpp
|
|
3
|
-
* @brief Structured Output bridge for React Native
|
|
4
|
-
*
|
|
5
|
-
* Matches Swift's RunAnywhere+StructuredOutput.swift pattern, providing:
|
|
6
|
-
* - JSON schema-guided generation
|
|
7
|
-
* - Structured output extraction
|
|
8
|
-
*
|
|
9
|
-
* Aligned with rac_llm_structured_output.h API.
|
|
10
|
-
* RACommons is REQUIRED - no stub implementations.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
#pragma once
|
|
14
|
-
|
|
15
|
-
#include <string>
|
|
16
|
-
|
|
17
|
-
// RACommons structured output header - REQUIRED (flat include paths)
|
|
18
|
-
#include "rac_llm_structured_output.h"
|
|
19
|
-
#include "rac_llm_types.h"
|
|
20
|
-
|
|
21
|
-
namespace runanywhere {
|
|
22
|
-
namespace bridges {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @brief Structured output result
|
|
26
|
-
*/
|
|
27
|
-
struct StructuredOutputResult {
|
|
28
|
-
std::string json;
|
|
29
|
-
bool success = false;
|
|
30
|
-
std::string error;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @brief Structured Output bridge singleton
|
|
35
|
-
*
|
|
36
|
-
* Generates LLM output following a JSON schema.
|
|
37
|
-
* NOTE: RACommons is REQUIRED. All methods will throw std::runtime_error if
|
|
38
|
-
* the underlying C API calls fail.
|
|
39
|
-
*/
|
|
40
|
-
class StructuredOutputBridge {
|
|
41
|
-
public:
|
|
42
|
-
static StructuredOutputBridge& shared();
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Generate structured output following a JSON schema
|
|
46
|
-
* @param prompt User prompt
|
|
47
|
-
* @param schema JSON schema string
|
|
48
|
-
* @param optionsJson Generation options
|
|
49
|
-
* @return Structured output result
|
|
50
|
-
*/
|
|
51
|
-
StructuredOutputResult generate(
|
|
52
|
-
const std::string& prompt,
|
|
53
|
-
const std::string& schema,
|
|
54
|
-
const std::string& optionsJson = ""
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
private:
|
|
58
|
-
StructuredOutputBridge() = default;
|
|
59
|
-
~StructuredOutputBridge() = default;
|
|
60
|
-
|
|
61
|
-
StructuredOutputBridge(const StructuredOutputBridge&) = delete;
|
|
62
|
-
StructuredOutputBridge& operator=(const StructuredOutputBridge&) = delete;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
} // namespace bridges
|
|
66
|
-
} // namespace runanywhere
|
package/cpp/rac_llm_llamacpp.h
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file rac_llm_llamacpp.h
|
|
3
|
-
* @brief Backend registration API for LlamaCPP
|
|
4
|
-
*
|
|
5
|
-
* Forward declarations for LlamaCPP backend registration functions.
|
|
6
|
-
* These symbols are exported by RABackendLLAMACPP.xcframework.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#ifndef RAC_LLM_LLAMACPP_H
|
|
10
|
-
#define RAC_LLM_LLAMACPP_H
|
|
11
|
-
|
|
12
|
-
#include "rac_types.h"
|
|
13
|
-
|
|
14
|
-
#ifdef __cplusplus
|
|
15
|
-
extern "C" {
|
|
16
|
-
#endif
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Register the LlamaCPP backend with the RACommons service registry.
|
|
20
|
-
* @return RAC_SUCCESS on success, RAC_ERROR_MODULE_ALREADY_REGISTERED if already registered
|
|
21
|
-
*/
|
|
22
|
-
rac_result_t rac_backend_llamacpp_register(void);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Unregister the LlamaCPP backend from the RACommons service registry.
|
|
26
|
-
* @return RAC_SUCCESS on success
|
|
27
|
-
*/
|
|
28
|
-
rac_result_t rac_backend_llamacpp_unregister(void);
|
|
29
|
-
|
|
30
|
-
#ifdef __cplusplus
|
|
31
|
-
}
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
#endif /* RAC_LLM_LLAMACPP_H */
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleExecutable</key><string>RABackendLLAMACPP</string>
|
|
6
|
-
<key>CFBundleIdentifier</key><string>ai.runanywhere.RABackendLLAMACPP</string>
|
|
7
|
-
<key>CFBundlePackageType</key><string>FMWK</string>
|
|
8
|
-
<key>CFBundleShortVersionString</key><string>0.1.5</string>
|
|
9
|
-
<key>MinimumOSVersion</key><string>13.0</string>
|
|
10
|
-
</dict>
|
|
11
|
-
</plist>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleExecutable</key><string>RABackendLLAMACPP</string>
|
|
6
|
-
<key>CFBundleIdentifier</key><string>ai.runanywhere.RABackendLLAMACPP</string>
|
|
7
|
-
<key>CFBundlePackageType</key><string>FMWK</string>
|
|
8
|
-
<key>CFBundleShortVersionString</key><string>0.1.5</string>
|
|
9
|
-
<key>MinimumOSVersion</key><string>13.0</string>
|
|
10
|
-
</dict>
|
|
11
|
-
</plist>
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
|
|
4
|
-
|
|
5
|
-
# =============================================================================
|
|
6
|
-
# Version Constants (MUST match Swift Package.swift)
|
|
7
|
-
# =============================================================================
|
|
8
|
-
CORE_VERSION = "0.1.4"
|
|
9
|
-
|
|
10
|
-
# =============================================================================
|
|
11
|
-
# Binary Source - RABackendLlamaCPP from runanywhere-sdks
|
|
12
|
-
# =============================================================================
|
|
13
|
-
GITHUB_ORG = "RunanywhereAI"
|
|
14
|
-
CORE_REPO = "runanywhere-sdks"
|
|
15
|
-
|
|
16
|
-
# =============================================================================
|
|
17
|
-
# testLocal Toggle
|
|
18
|
-
# Set RA_TEST_LOCAL=1 or create .testlocal file to use local binaries
|
|
19
|
-
# =============================================================================
|
|
20
|
-
TEST_LOCAL = ENV['RA_TEST_LOCAL'] == '1' || File.exist?(File.join(__dir__, '.testlocal'))
|
|
21
|
-
|
|
22
|
-
Pod::Spec.new do |s|
|
|
23
|
-
s.name = "LlamaCPPBackend"
|
|
24
|
-
s.module_name = "RunAnywhereLlama"
|
|
25
|
-
s.version = package["version"]
|
|
26
|
-
s.summary = package["description"]
|
|
27
|
-
s.homepage = "https://runanywhere.com"
|
|
28
|
-
s.license = package["license"]
|
|
29
|
-
s.authors = "RunAnywhere AI"
|
|
30
|
-
|
|
31
|
-
s.platforms = { :ios => "15.1" }
|
|
32
|
-
s.source = { :git => "https://github.com/RunanywhereAI/sdks.git", :tag => "#{s.version}" }
|
|
33
|
-
|
|
34
|
-
# =============================================================================
|
|
35
|
-
# Llama Backend - RABackendLlamaCPP
|
|
36
|
-
# Downloads from runanywhere-sdks (NOT runanywhere-sdks)
|
|
37
|
-
# =============================================================================
|
|
38
|
-
if TEST_LOCAL
|
|
39
|
-
puts "[LlamaCPPBackend] Using LOCAL RABackendLlamaCPP from Frameworks/"
|
|
40
|
-
s.vendored_frameworks = "Frameworks/RABackendLLAMACPP.xcframework"
|
|
41
|
-
else
|
|
42
|
-
s.prepare_command = <<-CMD
|
|
43
|
-
set -e
|
|
44
|
-
|
|
45
|
-
FRAMEWORK_DIR="Frameworks"
|
|
46
|
-
VERSION="#{CORE_VERSION}"
|
|
47
|
-
VERSION_FILE="$FRAMEWORK_DIR/.llamacpp_version"
|
|
48
|
-
|
|
49
|
-
# Check if already downloaded with correct version
|
|
50
|
-
if [ -f "$VERSION_FILE" ] && [ -d "$FRAMEWORK_DIR/RABackendLLAMACPP.xcframework" ]; then
|
|
51
|
-
CURRENT_VERSION=$(cat "$VERSION_FILE")
|
|
52
|
-
if [ "$CURRENT_VERSION" = "$VERSION" ]; then
|
|
53
|
-
echo "✅ RABackendLLAMACPP.xcframework version $VERSION already downloaded"
|
|
54
|
-
exit 0
|
|
55
|
-
fi
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
echo "📦 Downloading RABackendLlamaCPP.xcframework version $VERSION..."
|
|
59
|
-
|
|
60
|
-
mkdir -p "$FRAMEWORK_DIR"
|
|
61
|
-
rm -rf "$FRAMEWORK_DIR/RABackendLLAMACPP.xcframework"
|
|
62
|
-
|
|
63
|
-
# Download from runanywhere-sdks
|
|
64
|
-
DOWNLOAD_URL="https://github.com/#{GITHUB_ORG}/#{CORE_REPO}/releases/download/core-v$VERSION/RABackendLlamaCPP-ios-v$VERSION.zip"
|
|
65
|
-
ZIP_FILE="/tmp/RABackendLlamaCPP.zip"
|
|
66
|
-
|
|
67
|
-
echo " URL: $DOWNLOAD_URL"
|
|
68
|
-
|
|
69
|
-
curl -L -f -o "$ZIP_FILE" "$DOWNLOAD_URL" || {
|
|
70
|
-
echo "❌ Failed to download RABackendLlamaCPP from $DOWNLOAD_URL"
|
|
71
|
-
exit 1
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
echo "📂 Extracting RABackendLLAMACPP.xcframework..."
|
|
75
|
-
unzip -q -o "$ZIP_FILE" -d "$FRAMEWORK_DIR/"
|
|
76
|
-
rm -f "$ZIP_FILE"
|
|
77
|
-
|
|
78
|
-
echo "$VERSION" > "$VERSION_FILE"
|
|
79
|
-
|
|
80
|
-
if [ -d "$FRAMEWORK_DIR/RABackendLLAMACPP.xcframework" ]; then
|
|
81
|
-
echo "✅ RABackendLLAMACPP.xcframework installed successfully"
|
|
82
|
-
else
|
|
83
|
-
echo "❌ RABackendLLAMACPP.xcframework extraction failed"
|
|
84
|
-
exit 1
|
|
85
|
-
fi
|
|
86
|
-
CMD
|
|
87
|
-
|
|
88
|
-
s.vendored_frameworks = "Frameworks/RABackendLLAMACPP.xcframework"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Source files - Llama C++ implementation
|
|
92
|
-
s.source_files = [
|
|
93
|
-
"../cpp/HybridRunAnywhereLlama.cpp",
|
|
94
|
-
"../cpp/HybridRunAnywhereLlama.hpp",
|
|
95
|
-
"../cpp/bridges/**/*.{cpp,hpp}",
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
# Build settings
|
|
99
|
-
s.pod_target_xcconfig = {
|
|
100
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
101
|
-
"HEADER_SEARCH_PATHS" => [
|
|
102
|
-
"$(PODS_TARGET_SRCROOT)/../cpp",
|
|
103
|
-
"$(PODS_TARGET_SRCROOT)/../cpp/bridges",
|
|
104
|
-
"$(PODS_TARGET_SRCROOT)/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64/Headers",
|
|
105
|
-
"$(PODS_TARGET_SRCROOT)/Frameworks/RABackendLLAMACPP.xcframework/ios-arm64_x86_64-simulator/Headers",
|
|
106
|
-
"$(PODS_ROOT)/Headers/Public",
|
|
107
|
-
].join(" "),
|
|
108
|
-
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) HAS_LLAMACPP=1",
|
|
109
|
-
"DEFINES_MODULE" => "YES",
|
|
110
|
-
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
# Required system libraries
|
|
114
|
-
s.libraries = "c++"
|
|
115
|
-
s.frameworks = "Accelerate", "Foundation", "CoreML"
|
|
116
|
-
|
|
117
|
-
# Dependencies
|
|
118
|
-
s.dependency 'RunAnywhereCore'
|
|
119
|
-
s.dependency 'React-jsi'
|
|
120
|
-
s.dependency 'React-callinvoker'
|
|
121
|
-
|
|
122
|
-
# Load Nitrogen-generated autolinking
|
|
123
|
-
load '../nitrogen/generated/ios/RunAnywhereLlama+autolinking.rb'
|
|
124
|
-
add_nitrogen_files(s)
|
|
125
|
-
|
|
126
|
-
install_modules_dependencies(s)
|
|
127
|
-
end
|