@runanywhere/core 0.17.1 → 0.17.2

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.
Files changed (65) hide show
  1. package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
  2. package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
  3. package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
  4. package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
  5. package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
  6. package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
  7. package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
  8. package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
  9. package/android/src/main/include/rac/core/rac_component_types.h +160 -0
  10. package/android/src/main/include/rac/core/rac_core.h +331 -0
  11. package/android/src/main/include/rac/core/rac_error.h +469 -0
  12. package/android/src/main/include/rac/core/rac_events.h +334 -0
  13. package/android/src/main/include/rac/core/rac_logger.h +416 -0
  14. package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
  15. package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
  16. package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
  17. package/android/src/main/include/rac/core/rac_types.h +264 -0
  18. package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
  19. package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
  20. package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
  21. package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
  22. package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
  23. package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
  24. package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
  25. package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
  26. package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
  27. package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
  28. package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
  29. package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
  30. package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
  31. package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
  32. package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
  33. package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
  34. package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
  35. package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
  36. package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
  37. package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
  38. package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
  39. package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
  40. package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
  41. package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
  42. package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
  43. package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
  44. package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
  45. package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
  46. package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
  47. package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
  48. package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
  49. package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
  50. package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
  51. package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
  52. package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
  53. package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
  54. package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
  55. package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
  56. package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
  57. package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
  58. package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
  59. package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
  60. package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
  61. package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
  62. package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
  63. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
  64. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
  65. package/package.json +1 -1
@@ -0,0 +1,218 @@
1
+ /**
2
+ * @file rac_llm_llamacpp.h
3
+ * @brief RunAnywhere Core - LlamaCPP Backend RAC API
4
+ *
5
+ * Direct RAC API export from runanywhere-core's LlamaCPP backend.
6
+ * This header defines the public C API for LLM inference using llama.cpp.
7
+ *
8
+ * Mirrors Swift's LlamaCPPService implementation pattern.
9
+ */
10
+
11
+ #ifndef RAC_LLM_LLAMACPP_H
12
+ #define RAC_LLM_LLAMACPP_H
13
+
14
+ #include "rac/core/rac_error.h"
15
+ #include "rac/core/rac_types.h"
16
+ #include "rac/features/llm/rac_llm.h"
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // EXPORT MACRO
24
+ // =============================================================================
25
+
26
+ #if defined(RAC_LLAMACPP_BUILDING)
27
+ #if defined(_WIN32)
28
+ #define RAC_LLAMACPP_API __declspec(dllexport)
29
+ #elif defined(__GNUC__) || defined(__clang__)
30
+ #define RAC_LLAMACPP_API __attribute__((visibility("default")))
31
+ #else
32
+ #define RAC_LLAMACPP_API
33
+ #endif
34
+ #else
35
+ #define RAC_LLAMACPP_API
36
+ #endif
37
+
38
+ // =============================================================================
39
+ // CONFIGURATION - Mirrors Swift's LlamaCPPGenerationConfig
40
+ // =============================================================================
41
+
42
+ /**
43
+ * LlamaCPP-specific configuration.
44
+ *
45
+ * Mirrors Swift's LlamaCPPGenerationConfig.
46
+ */
47
+ typedef struct rac_llm_llamacpp_config {
48
+ /** Context size (0 = auto-detect from model) */
49
+ int32_t context_size;
50
+
51
+ /** Number of threads (0 = auto-detect) */
52
+ int32_t num_threads;
53
+
54
+ /** Number of layers to offload to GPU (Metal on iOS/macOS) */
55
+ int32_t gpu_layers;
56
+
57
+ /** Batch size for prompt processing */
58
+ int32_t batch_size;
59
+ } rac_llm_llamacpp_config_t;
60
+
61
+ /**
62
+ * Default LlamaCPP configuration.
63
+ */
64
+ static const rac_llm_llamacpp_config_t RAC_LLM_LLAMACPP_CONFIG_DEFAULT = {
65
+ .context_size = 0, // Auto-detect
66
+ .num_threads = 0, // Auto-detect
67
+ .gpu_layers = -1, // All layers on GPU
68
+ .batch_size = 512};
69
+
70
+ // =============================================================================
71
+ // LLAMACPP-SPECIFIC API
72
+ // =============================================================================
73
+
74
+ /**
75
+ * Creates a LlamaCPP LLM service.
76
+ *
77
+ * Mirrors Swift's LlamaCPPService.initialize(modelPath:)
78
+ *
79
+ * @param model_path Path to the GGUF model file
80
+ * @param config LlamaCPP-specific configuration (can be NULL for defaults)
81
+ * @param out_handle Output: Handle to the created service
82
+ * @return RAC_SUCCESS or error code
83
+ */
84
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_create(const char* model_path,
85
+ const rac_llm_llamacpp_config_t* config,
86
+ rac_handle_t* out_handle);
87
+
88
+ /**
89
+ * Loads a GGUF model into an existing service.
90
+ *
91
+ * Mirrors Swift's LlamaCPPService.loadModel(path:config:)
92
+ *
93
+ * @param handle Service handle
94
+ * @param model_path Path to the GGUF model file
95
+ * @param config LlamaCPP configuration (can be NULL)
96
+ * @return RAC_SUCCESS or error code
97
+ */
98
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_load_model(rac_handle_t handle,
99
+ const char* model_path,
100
+ const rac_llm_llamacpp_config_t* config);
101
+
102
+ /**
103
+ * Unloads the current model.
104
+ *
105
+ * Mirrors Swift's LlamaCPPService.unloadModel()
106
+ *
107
+ * @param handle Service handle
108
+ * @return RAC_SUCCESS or error code
109
+ */
110
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_unload_model(rac_handle_t handle);
111
+
112
+ /**
113
+ * Checks if a model is loaded.
114
+ *
115
+ * Mirrors Swift's LlamaCPPService.isModelLoaded
116
+ *
117
+ * @param handle Service handle
118
+ * @return RAC_TRUE if model is loaded, RAC_FALSE otherwise
119
+ */
120
+ RAC_LLAMACPP_API rac_bool_t rac_llm_llamacpp_is_model_loaded(rac_handle_t handle);
121
+
122
+ /**
123
+ * Generates text completion.
124
+ *
125
+ * Mirrors Swift's LlamaCPPService.generate(prompt:config:)
126
+ *
127
+ * @param handle Service handle
128
+ * @param prompt Input prompt text
129
+ * @param options Generation options (can be NULL for defaults)
130
+ * @param out_result Output: Generation result (caller must free text with rac_free)
131
+ * @return RAC_SUCCESS or error code
132
+ */
133
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_generate(rac_handle_t handle, const char* prompt,
134
+ const rac_llm_options_t* options,
135
+ rac_llm_result_t* out_result);
136
+
137
+ /**
138
+ * Streaming text generation callback.
139
+ *
140
+ * Mirrors Swift's streaming callback pattern.
141
+ *
142
+ * @param token Generated token string
143
+ * @param is_final Whether this is the final token
144
+ * @param user_data User-provided context
145
+ * @return RAC_TRUE to continue, RAC_FALSE to stop
146
+ */
147
+ typedef rac_bool_t (*rac_llm_llamacpp_stream_callback_fn)(const char* token, rac_bool_t is_final,
148
+ void* user_data);
149
+
150
+ /**
151
+ * Generates text with streaming callback.
152
+ *
153
+ * Mirrors Swift's LlamaCPPService.generateStream(prompt:config:)
154
+ *
155
+ * @param handle Service handle
156
+ * @param prompt Input prompt text
157
+ * @param options Generation options
158
+ * @param callback Callback for each token
159
+ * @param user_data User context passed to callback
160
+ * @return RAC_SUCCESS or error code
161
+ */
162
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_generate_stream(
163
+ rac_handle_t handle, const char* prompt, const rac_llm_options_t* options,
164
+ rac_llm_llamacpp_stream_callback_fn callback, void* user_data);
165
+
166
+ /**
167
+ * Cancels ongoing generation.
168
+ *
169
+ * Mirrors Swift's LlamaCPPService.cancel()
170
+ *
171
+ * @param handle Service handle
172
+ */
173
+ RAC_LLAMACPP_API void rac_llm_llamacpp_cancel(rac_handle_t handle);
174
+
175
+ /**
176
+ * Gets model information as JSON.
177
+ *
178
+ * @param handle Service handle
179
+ * @param out_json Output: JSON string (caller must free with rac_free)
180
+ * @return RAC_SUCCESS or error code
181
+ */
182
+ RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_get_model_info(rac_handle_t handle, char** out_json);
183
+
184
+ /**
185
+ * Destroys a LlamaCPP LLM service.
186
+ *
187
+ * @param handle Service handle to destroy
188
+ */
189
+ RAC_LLAMACPP_API void rac_llm_llamacpp_destroy(rac_handle_t handle);
190
+
191
+ // =============================================================================
192
+ // BACKEND REGISTRATION
193
+ // =============================================================================
194
+
195
+ /**
196
+ * Registers the LlamaCPP backend with the commons module and service registries.
197
+ *
198
+ * Should be called once during SDK initialization.
199
+ * This registers:
200
+ * - Module: "llamacpp" with TEXT_GENERATION capability
201
+ * - Service provider: LlamaCPP LLM provider
202
+ *
203
+ * @return RAC_SUCCESS or error code
204
+ */
205
+ RAC_LLAMACPP_API rac_result_t rac_backend_llamacpp_register(void);
206
+
207
+ /**
208
+ * Unregisters the LlamaCPP backend.
209
+ *
210
+ * @return RAC_SUCCESS or error code
211
+ */
212
+ RAC_LLAMACPP_API rac_result_t rac_backend_llamacpp_unregister(void);
213
+
214
+ #ifdef __cplusplus
215
+ }
216
+ #endif
217
+
218
+ #endif /* RAC_LLM_LLAMACPP_H */
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @file rac_stt_onnx.h
3
+ * @brief RunAnywhere Core - ONNX Backend RAC API for STT
4
+ *
5
+ * Direct RAC API export from runanywhere-core's ONNX STT backend.
6
+ * Mirrors Swift's ONNXSTTService implementation pattern.
7
+ */
8
+
9
+ #ifndef RAC_STT_ONNX_H
10
+ #define RAC_STT_ONNX_H
11
+
12
+ #include "rac/core/rac_error.h"
13
+ #include "rac/core/rac_types.h"
14
+ #include "rac/features/stt/rac_stt.h"
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ // =============================================================================
21
+ // EXPORT MACRO
22
+ // =============================================================================
23
+
24
+ #if defined(RAC_ONNX_BUILDING)
25
+ #if defined(_WIN32)
26
+ #define RAC_ONNX_API __declspec(dllexport)
27
+ #elif defined(__GNUC__) || defined(__clang__)
28
+ #define RAC_ONNX_API __attribute__((visibility("default")))
29
+ #else
30
+ #define RAC_ONNX_API
31
+ #endif
32
+ #else
33
+ #define RAC_ONNX_API
34
+ #endif
35
+
36
+ // =============================================================================
37
+ // CONFIGURATION
38
+ // =============================================================================
39
+
40
+ /**
41
+ * ONNX STT model types.
42
+ */
43
+ typedef enum rac_stt_onnx_model_type {
44
+ RAC_STT_ONNX_MODEL_WHISPER = 0,
45
+ RAC_STT_ONNX_MODEL_ZIPFORMER = 1,
46
+ RAC_STT_ONNX_MODEL_PARAFORMER = 2,
47
+ RAC_STT_ONNX_MODEL_AUTO = 99
48
+ } rac_stt_onnx_model_type_t;
49
+
50
+ /**
51
+ * ONNX STT configuration.
52
+ */
53
+ typedef struct rac_stt_onnx_config {
54
+ rac_stt_onnx_model_type_t model_type;
55
+ int32_t num_threads;
56
+ rac_bool_t use_coreml;
57
+ } rac_stt_onnx_config_t;
58
+
59
+ static const rac_stt_onnx_config_t RAC_STT_ONNX_CONFIG_DEFAULT = {
60
+ .model_type = RAC_STT_ONNX_MODEL_AUTO, .num_threads = 0, .use_coreml = RAC_TRUE};
61
+
62
+ // =============================================================================
63
+ // ONNX STT API
64
+ // =============================================================================
65
+
66
+ RAC_ONNX_API rac_result_t rac_stt_onnx_create(const char* model_path,
67
+ const rac_stt_onnx_config_t* config,
68
+ rac_handle_t* out_handle);
69
+
70
+ RAC_ONNX_API rac_result_t rac_stt_onnx_transcribe(rac_handle_t handle, const float* audio_samples,
71
+ size_t num_samples,
72
+ const rac_stt_options_t* options,
73
+ rac_stt_result_t* out_result);
74
+
75
+ RAC_ONNX_API rac_bool_t rac_stt_onnx_supports_streaming(rac_handle_t handle);
76
+
77
+ RAC_ONNX_API rac_result_t rac_stt_onnx_create_stream(rac_handle_t handle, rac_handle_t* out_stream);
78
+
79
+ RAC_ONNX_API rac_result_t rac_stt_onnx_feed_audio(rac_handle_t handle, rac_handle_t stream,
80
+ const float* audio_samples, size_t num_samples);
81
+
82
+ RAC_ONNX_API rac_bool_t rac_stt_onnx_stream_is_ready(rac_handle_t handle, rac_handle_t stream);
83
+
84
+ RAC_ONNX_API rac_result_t rac_stt_onnx_decode_stream(rac_handle_t handle, rac_handle_t stream,
85
+ char** out_text);
86
+
87
+ RAC_ONNX_API void rac_stt_onnx_input_finished(rac_handle_t handle, rac_handle_t stream);
88
+
89
+ RAC_ONNX_API rac_bool_t rac_stt_onnx_is_endpoint(rac_handle_t handle, rac_handle_t stream);
90
+
91
+ RAC_ONNX_API void rac_stt_onnx_destroy_stream(rac_handle_t handle, rac_handle_t stream);
92
+
93
+ RAC_ONNX_API void rac_stt_onnx_destroy(rac_handle_t handle);
94
+
95
+ #ifdef __cplusplus
96
+ }
97
+ #endif
98
+
99
+ #endif /* RAC_STT_ONNX_H */
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @file rac_stt_whispercpp.h
3
+ * @brief RunAnywhere Core - WhisperCPP Backend for STT
4
+ *
5
+ * RAC API for WhisperCPP-based speech-to-text.
6
+ * Provides high-quality transcription using whisper.cpp.
7
+ *
8
+ * NOTE: WhisperCPP and LlamaCPP both use GGML, which can cause symbol
9
+ * conflicts if linked together. Use ONNX Whisper for STT when also
10
+ * using LlamaCPP for LLM, or build with symbol prefixing.
11
+ */
12
+
13
+ #ifndef RAC_STT_WHISPERCPP_H
14
+ #define RAC_STT_WHISPERCPP_H
15
+
16
+ #include "rac/core/rac_error.h"
17
+ #include "rac/core/rac_types.h"
18
+ #include "rac/features/stt/rac_stt.h"
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ // =============================================================================
25
+ // EXPORT MACRO
26
+ // =============================================================================
27
+
28
+ #if defined(RAC_WHISPERCPP_BUILDING)
29
+ #if defined(_WIN32)
30
+ #define RAC_WHISPERCPP_API __declspec(dllexport)
31
+ #elif defined(__GNUC__) || defined(__clang__)
32
+ #define RAC_WHISPERCPP_API __attribute__((visibility("default")))
33
+ #else
34
+ #define RAC_WHISPERCPP_API
35
+ #endif
36
+ #else
37
+ #define RAC_WHISPERCPP_API
38
+ #endif
39
+
40
+ // =============================================================================
41
+ // CONFIGURATION
42
+ // =============================================================================
43
+
44
+ /**
45
+ * WhisperCPP-specific configuration.
46
+ */
47
+ typedef struct rac_stt_whispercpp_config {
48
+ /** Number of threads (0 = auto) */
49
+ int32_t num_threads;
50
+
51
+ /** Enable GPU acceleration (Metal on Apple) */
52
+ rac_bool_t use_gpu;
53
+
54
+ /** Enable CoreML acceleration (Apple only) */
55
+ rac_bool_t use_coreml;
56
+
57
+ /** Language code for transcription (NULL = auto-detect) */
58
+ const char* language;
59
+
60
+ /** Translate to English (when source is non-English) */
61
+ rac_bool_t translate;
62
+ } rac_stt_whispercpp_config_t;
63
+
64
+ /**
65
+ * Default WhisperCPP configuration.
66
+ */
67
+ static const rac_stt_whispercpp_config_t RAC_STT_WHISPERCPP_CONFIG_DEFAULT = {
68
+ .num_threads = 0,
69
+ .use_gpu = RAC_TRUE,
70
+ .use_coreml = RAC_TRUE,
71
+ .language = NULL,
72
+ .translate = RAC_FALSE};
73
+
74
+ // =============================================================================
75
+ // WHISPERCPP STT API
76
+ // =============================================================================
77
+
78
+ /**
79
+ * Creates a WhisperCPP STT service.
80
+ *
81
+ * @param model_path Path to the Whisper GGML model file (.bin)
82
+ * @param config WhisperCPP-specific configuration (can be NULL for defaults)
83
+ * @param out_handle Output: Handle to the created service
84
+ * @return RAC_SUCCESS or error code
85
+ */
86
+ RAC_WHISPERCPP_API rac_result_t rac_stt_whispercpp_create(const char* model_path,
87
+ const rac_stt_whispercpp_config_t* config,
88
+ rac_handle_t* out_handle);
89
+
90
+ /**
91
+ * Transcribes audio data.
92
+ *
93
+ * @param handle Service handle
94
+ * @param audio_samples Float32 PCM samples (16kHz mono)
95
+ * @param num_samples Number of samples
96
+ * @param options STT options (can be NULL for defaults)
97
+ * @param out_result Output: Transcription result
98
+ * @return RAC_SUCCESS or error code
99
+ */
100
+ RAC_WHISPERCPP_API rac_result_t rac_stt_whispercpp_transcribe(rac_handle_t handle,
101
+ const float* audio_samples,
102
+ size_t num_samples,
103
+ const rac_stt_options_t* options,
104
+ rac_stt_result_t* out_result);
105
+
106
+ /**
107
+ * Gets detected language after transcription.
108
+ *
109
+ * @param handle Service handle
110
+ * @param out_language Output: Language code (caller must free)
111
+ * @return RAC_SUCCESS or error code
112
+ */
113
+ RAC_WHISPERCPP_API rac_result_t rac_stt_whispercpp_get_language(rac_handle_t handle,
114
+ char** out_language);
115
+
116
+ /**
117
+ * Checks if model is loaded and ready.
118
+ *
119
+ * @param handle Service handle
120
+ * @return RAC_TRUE if ready
121
+ */
122
+ RAC_WHISPERCPP_API rac_bool_t rac_stt_whispercpp_is_ready(rac_handle_t handle);
123
+
124
+ /**
125
+ * Destroys a WhisperCPP STT service.
126
+ *
127
+ * @param handle Service handle to destroy
128
+ */
129
+ RAC_WHISPERCPP_API void rac_stt_whispercpp_destroy(rac_handle_t handle);
130
+
131
+ // =============================================================================
132
+ // BACKEND REGISTRATION
133
+ // =============================================================================
134
+
135
+ /**
136
+ * Registers the WhisperCPP backend with the commons module and service registries.
137
+ *
138
+ * @return RAC_SUCCESS or error code
139
+ */
140
+ RAC_WHISPERCPP_API rac_result_t rac_backend_whispercpp_register(void);
141
+
142
+ /**
143
+ * Unregisters the WhisperCPP backend.
144
+ *
145
+ * @return RAC_SUCCESS or error code
146
+ */
147
+ RAC_WHISPERCPP_API rac_result_t rac_backend_whispercpp_unregister(void);
148
+
149
+ #ifdef __cplusplus
150
+ }
151
+ #endif
152
+
153
+ #endif /* RAC_STT_WHISPERCPP_H */
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @file rac_tts_onnx.h
3
+ * @brief RunAnywhere Core - ONNX Backend RAC API for TTS
4
+ *
5
+ * Direct RAC API export from runanywhere-core's ONNX TTS backend.
6
+ */
7
+
8
+ #ifndef RAC_TTS_ONNX_H
9
+ #define RAC_TTS_ONNX_H
10
+
11
+ #include "rac/core/rac_error.h"
12
+ #include "rac/core/rac_types.h"
13
+ #include "rac/features/tts/rac_tts.h"
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ // =============================================================================
20
+ // EXPORT MACRO
21
+ // =============================================================================
22
+
23
+ #if defined(RAC_ONNX_BUILDING)
24
+ #if defined(_WIN32)
25
+ #define RAC_ONNX_API __declspec(dllexport)
26
+ #elif defined(__GNUC__) || defined(__clang__)
27
+ #define RAC_ONNX_API __attribute__((visibility("default")))
28
+ #else
29
+ #define RAC_ONNX_API
30
+ #endif
31
+ #else
32
+ #define RAC_ONNX_API
33
+ #endif
34
+
35
+ // =============================================================================
36
+ // CONFIGURATION
37
+ // =============================================================================
38
+
39
+ typedef struct rac_tts_onnx_config {
40
+ int32_t num_threads;
41
+ rac_bool_t use_coreml;
42
+ int32_t sample_rate;
43
+ } rac_tts_onnx_config_t;
44
+
45
+ static const rac_tts_onnx_config_t RAC_TTS_ONNX_CONFIG_DEFAULT = {
46
+ .num_threads = 0, .use_coreml = RAC_TRUE, .sample_rate = 22050};
47
+
48
+ // =============================================================================
49
+ // ONNX TTS API
50
+ // =============================================================================
51
+
52
+ RAC_ONNX_API rac_result_t rac_tts_onnx_create(const char* model_path,
53
+ const rac_tts_onnx_config_t* config,
54
+ rac_handle_t* out_handle);
55
+
56
+ RAC_ONNX_API rac_result_t rac_tts_onnx_synthesize(rac_handle_t handle, const char* text,
57
+ const rac_tts_options_t* options,
58
+ rac_tts_result_t* out_result);
59
+
60
+ RAC_ONNX_API rac_result_t rac_tts_onnx_get_voices(rac_handle_t handle, char*** out_voices,
61
+ size_t* out_count);
62
+
63
+ RAC_ONNX_API void rac_tts_onnx_stop(rac_handle_t handle);
64
+
65
+ RAC_ONNX_API void rac_tts_onnx_destroy(rac_handle_t handle);
66
+
67
+ #ifdef __cplusplus
68
+ }
69
+ #endif
70
+
71
+ #endif /* RAC_TTS_ONNX_H */
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @file rac_vad_onnx.h
3
+ * @brief RunAnywhere Core - ONNX Backend RAC API for VAD
4
+ *
5
+ * Direct RAC API export from runanywhere-core's ONNX VAD backend.
6
+ */
7
+
8
+ #ifndef RAC_VAD_ONNX_H
9
+ #define RAC_VAD_ONNX_H
10
+
11
+ #include "rac/core/rac_error.h"
12
+ #include "rac/core/rac_types.h"
13
+ #include "rac/features/vad/rac_vad.h"
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ // =============================================================================
20
+ // EXPORT MACRO
21
+ // =============================================================================
22
+
23
+ #if defined(RAC_ONNX_BUILDING)
24
+ #if defined(_WIN32)
25
+ #define RAC_ONNX_API __declspec(dllexport)
26
+ #elif defined(__GNUC__) || defined(__clang__)
27
+ #define RAC_ONNX_API __attribute__((visibility("default")))
28
+ #else
29
+ #define RAC_ONNX_API
30
+ #endif
31
+ #else
32
+ #define RAC_ONNX_API
33
+ #endif
34
+
35
+ // =============================================================================
36
+ // CONFIGURATION
37
+ // =============================================================================
38
+
39
+ typedef struct rac_vad_onnx_config {
40
+ int32_t sample_rate;
41
+ float energy_threshold;
42
+ float frame_length;
43
+ int32_t num_threads;
44
+ } rac_vad_onnx_config_t;
45
+
46
+ static const rac_vad_onnx_config_t RAC_VAD_ONNX_CONFIG_DEFAULT = {
47
+ .sample_rate = 16000, .energy_threshold = 0.5f, .frame_length = 0.032f, .num_threads = 0};
48
+
49
+ // =============================================================================
50
+ // ONNX VAD API
51
+ // =============================================================================
52
+
53
+ RAC_ONNX_API rac_result_t rac_vad_onnx_create(const char* model_path,
54
+ const rac_vad_onnx_config_t* config,
55
+ rac_handle_t* out_handle);
56
+
57
+ RAC_ONNX_API rac_result_t rac_vad_onnx_process(rac_handle_t handle, const float* samples,
58
+ size_t num_samples, rac_bool_t* out_is_speech);
59
+
60
+ RAC_ONNX_API rac_result_t rac_vad_onnx_start(rac_handle_t handle);
61
+
62
+ RAC_ONNX_API rac_result_t rac_vad_onnx_stop(rac_handle_t handle);
63
+
64
+ RAC_ONNX_API rac_result_t rac_vad_onnx_reset(rac_handle_t handle);
65
+
66
+ RAC_ONNX_API rac_result_t rac_vad_onnx_set_threshold(rac_handle_t handle, float threshold);
67
+
68
+ RAC_ONNX_API rac_bool_t rac_vad_onnx_is_speech_active(rac_handle_t handle);
69
+
70
+ RAC_ONNX_API void rac_vad_onnx_destroy(rac_handle_t handle);
71
+
72
+ // =============================================================================
73
+ // BACKEND REGISTRATION
74
+ // =============================================================================
75
+
76
+ RAC_ONNX_API rac_result_t rac_backend_onnx_register(void);
77
+
78
+ RAC_ONNX_API rac_result_t rac_backend_onnx_unregister(void);
79
+
80
+ #ifdef __cplusplus
81
+ }
82
+ #endif
83
+
84
+ #endif /* RAC_VAD_ONNX_H */