MCPcopy Create free account
hub / github.com/cactus-compute/cactus / Java_com_cactus_CactusJNI_nativeRagQuery

Function Java_com_cactus_CactusJNI_nativeRagQuery

android/cactus_jni.cpp:292–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292JNIEXPORT jstring JNICALL
293Java_com_cactus_CactusJNI_nativeRagQuery(JNIEnv* env, jobject, jlong handle,
294 jstring query, jint topK) {
295 if (handle == 0) { throwCactusException(env, "Model not initialized"); return nullptr; }
296
297 const char* queryStr = jstring_to_cstr(env, query);
298
299 std::vector<char> buffer(DEFAULT_BUFFER_SIZE);
300
301 int result = cactus_rag_query(
302 reinterpret_cast<cactus_model_t>(handle),
303 queryStr,
304 buffer.data(),
305 buffer.size(),
306 static_cast<size_t>(topK)
307 );
308
309 release_jstring(env, query, queryStr);
310
311 if (result < 0) { throwOnError(env); return nullptr; }
312 return env->NewStringUTF(buffer.data());
313}
314
315JNIEXPORT jstring JNICALL
316Java_com_cactus_CactusJNI_nativeGetLastError(JNIEnv* env, jobject) {

Callers

nothing calls this directly

Calls 7

throwCactusExceptionFunction · 0.85
jstring_to_cstrFunction · 0.85
release_jstringFunction · 0.85
throwOnErrorFunction · 0.85
dataMethod · 0.80
sizeMethod · 0.80
cactus_rag_queryFunction · 0.50

Tested by

no test coverage detected