Is it possible to use Koog with local models?
# koog-agentic-framework
p
Is it possible to use Koog with local models?
e
I use Koog with Ollama local models
p
Hi @El Anthony, can you share the code snippet of initialization?
e
There are several predefined Ollama model names in Koog, which you can check out in the documentation. For a general case, here's an example using "qwen:16b" (you must have Ollama running locally and have downloaded this model, or any other you'd like to try):
Copy code
class KoogOllamaTest {
    private val OLLAMA_MODEL_NAME = "qwen3:14b" 
        
    val ollamaModel = LLModel(
            provider = LLMProvider.Ollama,
            id = OLLAMA_MODEL_NAME,
            capabilities = listOf(
                LLMCapability.Temperature,
                LLMCapability.Schema.JSON.Basic,
                LLMCapability.Tools
            ),
            contextLength = 40_960,
        )
    val agent = AIAgent(
        executor = simpleOllamaAIExecutor(
            baseUrl = "http://localhost:11434"
        ),
        llmModel = ollamaModel,
        systemPrompt = text {
            + "You're a helpful agent"
            + "/no_think"
        }
    )

    fun run( question: String) = runBlocking {
        agent.run( question)
    }
    companion object {
        @JvmStatic
        fun main(args: ArrayString) {
//            KoogOllamaTest().testGetCurrentDate()
            val res = KoogOllamaTest().run("What's the name of the 3rd planet around the sun?")
            println(res)
        }
    }
}
p
Thanks, @El Anthony! I'm new to AI stuff, i thought i can have some file of model that i can embbed and use directly from code without installing any other services. And Koog can help me with it.
324 Views