This PR restores them and revises the doc comments for consistency with the other fields.
p.s. It might be a good idea to convert this to an enum to capture the different types of message types and make it harder to produce invalid states:
#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "role", rename_all = "lowercase")]
pub enum Message {
System {
/// The contents of the system message.
content: ChatMessageContent,
/// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
name: Option<String>,
},
User {
/// The contents of the user message.
content: ChatMessageContent,
/// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
name: Option<String>,
},
Assistant {
/// The contents of the assistant message. Required unless tool_calls is specified.
content: Option<ChatMessageContent>,
/// The refusal message by the assistant.
refusal: Option<String>,
/// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
name: Option<String>,
/// The tool calls generated by the model, such as function calls.
tool_calls: Option<Vec<ToolCall>>,
},
Tool {
/// The contents of the tool message.
content: String,
/// Tool call that this message is responding to.
tool_call_id: String,
},
Function {
/// The contents of the function message.
content: Option<String>,
/// The name of the function to call.
name: String,
},
}
https://github.com/tjardoo/openai-client/pull/83/commits/9461345efab8e2d637543261a39c155e6eedc259#diff-3b618cea395f2f12f2bc747dc0a4fad7b1ab702a9cea5e917c37e082044ed3ec removed the
tool_call_id
andname
ChatMessage
fields, which are used for responding for tool calls and disambiguating between multiple users respectively.This PR restores them and revises the doc comments for consistency with the other fields.
p.s. It might be a good idea to convert this to an enum to capture the different types of message types and make it harder to produce invalid states: