Adapt context management to tool role usage.

This commit is contained in:
Bartosz Taudul
2025-12-29 17:30:47 +01:00
parent 7a43036e6e
commit 237e90fe64
2 changed files with 4 additions and 8 deletions

View File

@@ -764,14 +764,10 @@ void TracyLlm::ManageContext( std::unique_lock<std::mutex>& lock )
std::vector<std::pair<size_t, size_t>> toolOutputs;
for( auto& msg : m_chat )
{
if( msg["role"].get_ref<const std::string&>() == "user" )
if( msg["role"].get_ref<const std::string&>() == "tool" )
{
auto& content = msg["content"];
const auto& str = content.get_ref<const std::string&>();
if( str.starts_with( "<tool_output>\n" ) )
{
toolOutputs.emplace_back( str.size(), idx );
}
auto& str = msg["content"].get_ref<const std::string&>();
toolOutputs.emplace_back( str.size(), idx );
}
idx++;
}

View File

@@ -11,7 +11,7 @@ namespace tracy
class TracyLlmChat
{
public:
static constexpr const char* ForgetMsg = "<tool_output>\n...";
static constexpr const char* ForgetMsg = "...";
enum class TurnRole
{