assistant: Propagate LLM stop reason upwards (#17358)
This PR makes it so we propagate the `stop_reason` from Anthropic up to the Assistant so that we can take action based on it. The `extract_content_from_events` function was moved from `anthropic` to the `anthropic` module in `language_model` since it is more useful if it is able to name the `LanguageModelCompletionEvent` type, as otherwise we'd need an additional layer of plumbing. Release Notes: - N/A
This commit is contained in:
parent
7c8f62e943
commit
f38956943b
7 changed files with 143 additions and 144 deletions
|
@ -1999,6 +1999,11 @@ impl Context {
|
|||
});
|
||||
|
||||
match event {
|
||||
LanguageModelCompletionEvent::Stop(reason) => match reason {
|
||||
language_model::StopReason::ToolUse => {}
|
||||
language_model::StopReason::EndTurn => {}
|
||||
language_model::StopReason::MaxTokens => {}
|
||||
},
|
||||
LanguageModelCompletionEvent::Text(chunk) => {
|
||||
buffer.edit(
|
||||
[(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue