Add ConversationEntry::Thinking — 0 tokens, not sent to API
Thinking/reasoning content is now a first-class entry type:
- Serialized as {"thinking": "..."} in conversation log
- 0 tokens for budgeting (doesn't count against context window)
- Filtered from assemble_api_messages (not sent back to model)
- Displayed in UI with "thinking: ..." label and expandable content
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
7c5fddcb19
commit
e0ee441aec
3 changed files with 32 additions and 13 deletions
|
|
@ -305,7 +305,7 @@ impl Agent {
|
|||
}
|
||||
// Conversation entries
|
||||
msgs.extend(self.context.conversation.entries().iter()
|
||||
.filter(|e| !e.entry.is_log())
|
||||
.filter(|e| !e.entry.is_log() && !e.entry.is_thinking())
|
||||
.map(|e| e.entry.api_message().clone()));
|
||||
msgs
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ impl Agent {
|
|||
eprintln!("warning: failed to log entry: {:#}", e);
|
||||
}
|
||||
}
|
||||
let tokens = if entry.is_log() { 0 } else {
|
||||
let tokens = if entry.is_log() || entry.is_thinking() { 0 } else {
|
||||
context::msg_token_count(&self.tokenizer, entry.api_message())
|
||||
};
|
||||
self.context.conversation.push(ContextEntry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue