Skip to content

Commit a53a843

Browse files
committed
feat: Replace Gemini SDK with OpenAI-compatible LLM API
- Replaced Google Gemini SDK with generic OpenAI-compatible /v1/chat/completions API (Ktor HTTP) - Default provider: Groq (free tier) with LLaMA 3 70B model - Added configurable API endpoint URL in settings - Supported models: LLaMA 3 70B/8B, Mixtral 8x7B, Gemma 2 9B - Compatible with Groq, OpenAI, Ollama, LM Studio, any OpenAI-compatible API - Removed com.google.ai.client.generativeai:generativeai dependency - Updated UI strings and API key guide
1 parent cb684f8 commit a53a843

9 files changed

Lines changed: 453 additions & 292 deletions

File tree

app/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ dependencies {
9898
ksp(libs.hilt.android.compiler)
9999
ksp(libs.hilt.compile)
100100

101-
implementation("com.google.ai.client.generativeai:generativeai:0.9.0")
102101
implementation("androidx.security:security-crypto:1.1.0")
103102
implementation("com.udojava:EvalEx:2.7")
104103
implementation("androidx.activity:activity-compose:1.11.0")

app/src/main/java/com/babelsoftware/airnote/data/repository/AiModels.kt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,30 @@ package com.babelsoftware.airnote.data.repository
33
import androidx.annotation.StringRes
44
import com.babelsoftware.airnote.R
55

6-
data class GeminiModelInfo(
6+
data class LlmModelInfo(
77
val name: String,
88
@StringRes val displayNameResId: Int
99
)
1010

11-
object GeminiModels {
11+
object LlmModels {
1212
val supportedModels = listOf(
13-
GeminiModelInfo(
14-
name = "gemini-2.5-flash",
15-
displayNameResId = R.string.gemini_models_25
13+
LlmModelInfo(
14+
name = "llama3-70b-8192",
15+
displayNameResId = R.string.llm_models_llama3_70b
1616
),
17-
GeminiModelInfo(
18-
name = "gemini-2.0-flash-001",
19-
displayNameResId = R.string.gemini_models_20
17+
LlmModelInfo(
18+
name = "llama3-8b-8192",
19+
displayNameResId = R.string.llm_models_llama3_8b
2020
),
21-
GeminiModelInfo(
22-
name = "gemini-1.5-flash-latest",
23-
displayNameResId = R.string.gemini_models_15
21+
LlmModelInfo(
22+
name = "mixtral-8x7b-32768",
23+
displayNameResId = R.string.llm_models_mixtral_8x7b
24+
),
25+
LlmModelInfo(
26+
name = "gemma2-9b-it",
27+
displayNameResId = R.string.llm_models_gemma2_9b
2428
)
2529
)
26-
}
30+
31+
val defaultEndpoint = "https://api.groq.com/openai/v1"
32+
}

0 commit comments

Comments
 (0)