From b163d97e65da2a989dedbc19167ca0c9204d6a94 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 15 May 2025 01:52:31 +0200 Subject: [PATCH] Fix setting context size. --- profiler/src/profiler/TracyLlm.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 44f72c02..34f8cc74 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -531,9 +531,6 @@ void TracyLlm::ResetChat() void TracyLlm::SendMessage( const ollama::messages& messages ) { - ollama::options options; - options["num_ctx"] = std::min( m_models[m_modelIdx].ctxSize, s_config.llmContext ); - // The chat() call will fire a callback right away, so the assistant message needs to be there already m_chat->emplace_back( ollama::message( "assistant", "" ) ); @@ -545,7 +542,7 @@ void TracyLlm::SendMessage( const ollama::messages& messages ) req["model"] = m_models[m_modelIdx].name; req["messages"] = messages.to_json(); req["stream"] = true; - req["options"] = options["options"]; + req["options"]["ctx_size"] = std::min( m_models[m_modelIdx].ctxSize, s_config.llmContext ); req["keep_alive"] = "5m"; res = m_ollama->chat( req, [this]( const ollama::response& response ) -> bool { return OnResponse( response ); });