Skip to content

Commit

Permalink
allow content parts in assistant and tool messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Oct 26, 2024
1 parent 37df0cd commit 35e6e09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion llgtrt/src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,22 @@ impl ChatCompletionMessageParams {
name: name.clone(),
}
}
x => x.clone(),
ChatCompletionMessageParams::Assistant {
content,
name,
tool_calls,
} => ChatCompletionMessageParams::Assistant {
content: content.as_ref().map(|x| x.flatten()),
name: name.clone(),
tool_calls: tool_calls.clone(),
},
ChatCompletionMessageParams::Tool {
content,
tool_call_id,
} => ChatCompletionMessageParams::Tool {
content: content.as_ref().map(|x| x.flatten()),
tool_call_id: tool_call_id.clone(),
},
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions llgtrt/src/routes/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ pub enum ChatCompletionMessageParams {
name: Option<String>,
},
Assistant {
content: Option<String>,
content: Option<ChatCompletionMessageContentPart>,
name: Option<String>,
tool_calls: Option<Vec<serde_json::Value>>,
},
Tool {
content: Option<String>,
content: Option<ChatCompletionMessageContentPart>,
tool_call_id: String,
},
}
Expand Down

0 comments on commit 35e6e09

Please sign in to comment.