Skip to content

Commit

Permalink
fix: xai agent prompt provider error (#305) (#306)
Browse files Browse the repository at this point in the history
* fix: xai agent prompt provider error

* chore: apply cargo fmt
  • Loading branch information
obikata authored Feb 17, 2025
1 parent 5f64c35 commit ea9b686
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rig-core/src/providers/xai/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ impl completion::CompletionModel for CompletionModel {
) -> Result<completion::CompletionResponse<CompletionResponse>, CompletionError> {
// Add preamble to chat history (if available)
let mut full_history: Vec<Message> = match &completion_request.preamble {
Some(preamble) => vec![Message::system(preamble)],
Some(preamble) => {
if preamble.is_empty() {
vec![]
} else {
vec![Message::system(preamble)]
}
}
None => vec![],
};

Expand Down

0 comments on commit ea9b686

Please sign in to comment.