Merge 62af5e6542
into 0e575b2809
This commit is contained in:
commit
48c6699a56
1 changed files with 9 additions and 1 deletions
|
@ -609,7 +609,15 @@ impl OpenAiEventMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match choice.finish_reason.as_deref() {
|
let mut effective_finish_reason = choice.finish_reason.as_deref();
|
||||||
|
|
||||||
|
if effective_finish_reason == Some("stop") && !self.tool_calls_by_index.is_empty()
|
||||||
|
{
|
||||||
|
log::warn!("finish_reason is 'stop' but tool calls are present; inferring 'tool_calls'");
|
||||||
|
effective_finish_reason = Some("tool_calls");
|
||||||
|
}
|
||||||
|
|
||||||
|
match effective_finish_reason {
|
||||||
Some("stop") => {
|
Some("stop") => {
|
||||||
events.push(Ok(LanguageModelCompletionEvent::Stop(StopReason::EndTurn)));
|
events.push(Ok(LanguageModelCompletionEvent::Stop(StopReason::EndTurn)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue