agent2: Implement prompt caching (#36236)

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-08-15 15:17:56 +02:00 committed by GitHub
parent 846ed6adf9
commit f63036548c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 140 additions and 3 deletions

View file

@ -1041,6 +1041,14 @@ impl Thread {
messages.extend(message.to_request());
}
if let Some(last_user_message) = messages
.iter_mut()
.rev()
.find(|message| message.role == Role::User)
{
last_user_message.cache = true;
}
messages
}