diff --git a/llm/android/LlamaDemo/app/build.gradle.kts b/llm/android/LlamaDemo/app/build.gradle.kts index 4c322175..eaa66dbe 100644 --- a/llm/android/LlamaDemo/app/build.gradle.kts +++ b/llm/android/LlamaDemo/app/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { if (useLocalAar == true) { implementation(files("libs/executorch.aar")) } else { - implementation("org.pytorch:executorch-android:1.0.0") + implementation("org.pytorch:executorch-android-qnn:1.0.0") } implementation("com.google.android.material:material:1.12.0") implementation("androidx.activity:activity:1.9.0") diff --git a/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelRunner.java b/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelRunner.java index a1bc205c..83d6c9ec 100644 --- a/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelRunner.java +++ b/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelRunner.java @@ -12,6 +12,8 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; +import android.util.Log; + import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; diff --git a/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java b/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java index d6b3c0fe..8a4a4e84 100644 --- a/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java +++ b/llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java @@ -27,7 +27,21 @@ public static String getSystemPromptTemplate(ModelType modelType) { case LLAVA_1_5: return "USER: "; case QWEN_3: - return "<|im_start|>system\n" + "You are a helpful assistant.\n" + "<|im_end|>\n"; + return "<|im_start|>system\n" + + " You are a helpful assistant with access to tools. When you need to use a tool, format your response with JSON between and tokens.\n" + + " \n" + + " Use this exact format: {\"name\": \"function_name\", \"arguments\": {\"param\": \"value\"}}\n" + + " If a tool requires a argument you don't know the value of check if another tool can give you that information and call that tool first.\n" + + " Always respond directly and call the appropriate tool when needed.\n" + + " \n" + + " # Tools\n" + + " \n" + + " You may call one or more functions to assist with the user query.\n" + + " \n" + + " You are provided with function signatures within XML tags:\n" + + " \n" + + " {\"description\":\"Get weather information for the location given in argument\",\"name\":\"get_weather\",\"parameters\":{\"properties\":{\"location\":{\"description\":\"The location to get weather for\",\"type\":\"string\"},\"unit\":{\"default\":\"celsius\",\"description\":\"Temperature unit (celsius or fahrenheit)\",\"type\":\"string\"}},\"required\":[\"location\"],\"type\":\"object\"}}" + + "\n<|im_end|>\n"; default: return SYSTEM_PLACEHOLDER; }