Skip to content

Commit

Permalink
fix: do not consider empty message.tool_calls as valid
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Dec 10, 2024
1 parent c8ed591 commit 6fbe6b5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/agent/generator/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ impl Client for OpenAIClient {
if !comp.choices.is_empty() {
let first = comp.choices.first().unwrap();
if let Some(m) = first.message.as_ref() {
if m.tool_calls.is_some() {
return Ok(SupportedFeatures {
system_prompt: true,
tools: true,
});
if let Some(calls) = m.tool_calls.as_ref() {
if !calls.is_empty() {
return Ok(SupportedFeatures {
system_prompt: true,
tools: true,
});
}
}
}
}
Expand Down

0 comments on commit 6fbe6b5

Please sign in to comment.