-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi @arusatech , First of all thank you for making the Capacitor Plugin.
When creating embedding using one of the model (All-mini-LM-v2.gguf) , the plugin create the random embeddings. When I drilldown the code I found simple for loop for embedding and not calling the Native Layer (CPP). The code is written as below - android / LlamaCpp.java
public void embedding(int contextId, String text, JSObject params, LlamaCallback<Map<String, Object>> callback) {
if (contexts.get(contextId) == null) {
callback.onResult(LlamaResult.failure(new LlamaError("Context not found")));
return;
}
// Fixed: Use List instead of array for proper JSON serialization
Map<String, Object> embeddingResult = new HashMap<>();
List<Double> embeddingList = new ArrayList<>();
// Generate mock embedding vector
for (int i = 0; i < 384; i++) {
embeddingList.add(Math.random() - 0.5);
}
embeddingResult.put("embedding", embeddingList);
callback.onResult(LlamaResult.success(embeddingResult));
}
If this is not implemented I am happy to contribute this task. Please let me know how to implement this task because I am new to laama cpp.
Happy Coding!!!
Metadata
Metadata
Assignees
Labels
No labels