Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ third_party/sherpa-onnx/

# Legacy local Sherpa voice assets (kept ignored if they still exist from old setup flows).
core/voice/src/main/assets/sherpa-tts/

# Agent plans (local-only)
.omp/plans/
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,10 @@ class LiteRtInferenceEngine @Inject constructor(
systemPrompt: String?,
thinkingEnabled: Boolean?,
): String = withContext(LlmDispatcher) {
val config = currentConfig ?: return@withContext ""
val config = currentConfig ?: run {
Log.w(TAG, "generateStructuredOnce: currentConfig is null — engine not initialized?")
return@withContext ""
}
Log.d(
TAG,
"generateStructuredOnce: spec='${spec.toolName}', schemaLen=${spec.jsonSchema.length}, thinking=$thinkingEnabled",
Expand Down Expand Up @@ -1024,7 +1027,10 @@ class LiteRtInferenceEngine @Inject constructor(
safeClose(conversation, "conversation")
}

val eng = engine ?: return@withContext ""
val eng = engine ?: run {
Log.w(TAG, "generateStructuredOnce: engine is null — was it evicted?")
return@withContext ""
}
val convConfig = buildConversationConfig(_activeBackend.value ?: BackendType.CPU, requestedConfig)

// Isolate to synthetic tool only — no other tools interfere with constrained decoding.
Expand Down Expand Up @@ -1184,13 +1190,15 @@ class LiteRtInferenceEngine @Inject constructor(
}
} finally {
resetExperimentalFlags()
if (shouldSwapConfig) {
resetConversationForConfig(config)
}
}
} finally {
generationMutex.unlock()
if (shouldSwapConfig) {
resetConversationForConfig(config)
}
}
} catch (ce: CancellationException) {
throw ce
} catch (e: Exception) {
Log.w(TAG, "generateStructuredOnce: error", e)
""
Expand Down
Loading
Loading