HaniFakhouri
10/01/2025, 9:56 AMval localAgent = AIAgent(
executor = simpleOllamaAIExecutor("<http://127.0.0.1:8686>"),
llmModel = LLModel(
provider = LLMProvider.Ollama,
id = "local-model",
capabilities = listOf(
LLMCapability.Temperature,
LLMCapability.Schema.JSON.Basic,
LLMCapability.Tools
),
contextLength = 40_960,
),
systemPrompt = "You are a helpful assistant.",
)
runBlocking {
localAgent.run("What can you help me with?")
}
But when running it I am getting this error:
Exception in thread "main" io.ktor.serialization.JsonConvertException: Illegal input: Field 'done' is required for type with serial name 'ai.koog.prompt.executor.ollama.client.dto.OllamaChatResponseDTO', but it was missing at path: $
at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:79)
at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1$2.emit(Emitters.kt:51)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$3.collect(SafeCollector.common.kt:111)
at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1.collect(SafeCollector.common.kt:109)
at kotlinx.coroutines.flow.FlowKt__ReduceKt.firstOrNull(Reduce.kt:247)
at kotlinx.coroutines.flow.FlowKt.firstOrNull(Unknown Source)
at io.ktor.serialization.ContentConverterKt.deserialize(ContentConverter.kt:113)
Any ideas why I am getting it and how to fix it?Sergei Dubov
10/01/2025, 10:38 AMdone in the response as well. Koog tries to deserialize the response that miss this flag and fail with error.HaniFakhouri
10/01/2025, 11:50 AMSergei Dubov
10/01/2025, 1:17 PMkoog version do you use? What model you use? Could you please clarify if this is a “chat” model?HaniFakhouri
10/01/2025, 1:22 PMSergei Dubov
10/01/2025, 1:37 PMllama-server version do you use?HaniFakhouri
10/01/2025, 1:38 PMSergei Dubov
10/01/2025, 3:28 PMllama.cpp sever, right? It might be the reason. We do support Ollama in Koog (see the doc). Would it be possible to check with Ollama?HaniFakhouri
10/01/2025, 7:18 PMSergei Dubov
10/01/2025, 7:26 PMbartowski/Llama-3.2-3B-Instruct-GGUF
>> ollama --version
ollama version is 0.12.3
Agent:
fun main() {
val localAgent = AIAgent(
promptExecutor = simpleOllamaAIExecutor("<http://127.0.0.1:11434>"),
llmModel = LLModel(
provider = LLMProvider.Ollama,
id = "<http://hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF|hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF>",
capabilities = listOf(
LLMCapability.Temperature,
LLMCapability.Schema.JSON.Basic,
LLMCapability.Tools
),
contextLength = 40_960,
),
systemPrompt = "You are a helpful assistant.",
)
runBlocking {
val result = localAgent.run("What can you help me with?")
println(result)
}
}
Raw LLM response (please see done field):
{
"model": "<http://hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF|hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF>",
"created_at": "2025-10-01T13:28:29.283088Z",
"message": {
"role": "assistant",
"content": "I can assist you with a wide range of tasks and topics. Here are some examples:\n\n1. **Answering questions**: I can provide information on various subjects, including history, science, technology, literature, and more.\n2. **Language translation**: I can translate text from one language to another.\n3. **Writing assistance**: I can help with writing tasks such as proofreading, editing, and suggesting alternative phrases or words.\n4. **Research**: I can help you find reliable sources of information on a particular topic.\n5. **Calculations and conversions**: I can perform calculations, convert units, and provide currency exchange rates.\n6. **Generating text**: I can create text based on a prompt or topic, such as a story, article, or email.\n7. **Conversation**: I can engage in natural-sounding conversations, using context and understanding to respond to questions and statements.\n8. **Brainstorming**: I can help generate ideas and suggestions for creative projects or problems.\n9. **Language learning**: I can assist with language learning by providing grammar explanations, vocabulary practice, and conversational exercises.\n10. **Miscellaneous tasks**: I can also help with other tasks such as generating passwords, creating to-do lists, or providing suggestions for movies, books, or games.\n\nWhat's on your mind? Is there something specific you'd like assistance with?"
},
"done": true,
"done_reason": "stop",
"total_duration": 3106166125,
"load_duration": 54834041,
"prompt_eval_count": 28,
"prompt_eval_duration": 120922292,
"eval_count": 277,
"eval_duration": 2929947750
}HaniFakhouri
10/01/2025, 7:47 PMSergei Dubov
10/01/2025, 8:16 PM