Struct chatgpt_functions::chat_context::ChatContext
source · pub struct ChatContext {
pub model: String,
pub messages: Vec<Message>,
pub functions: Vec<FunctionSpecification>,
pub function_call: Option<String>,
}
Fields§
§model: String
§messages: Vec<Message>
§functions: Vec<FunctionSpecification>
§function_call: Option<String>
Implementations§
source§impl ChatContext
impl ChatContext
sourcepub fn new(model: String) -> ChatContext
pub fn new(model: String) -> ChatContext
Creates a new ChatContext with a model name as a string. This is an internal function used by other functions.
sourcepub fn push_message(&mut self, message: Message)
pub fn push_message(&mut self, message: Message)
Pushes a message in the chat context as a Message. This is an internal function used by other functions. It is recommended to use ChatGPT.push_message()
sourcepub fn set_messages(&mut self, messages: Vec<Message>)
pub fn set_messages(&mut self, messages: Vec<Message>)
Sets the messages in the chat context as a vector of Message. This is an internal function used by other functions.
sourcepub fn push_function(&mut self, functions: FunctionSpecification)
pub fn push_function(&mut self, functions: FunctionSpecification)
Pushes a function in the chat context as a FunctionSpecification. This is an internal function used by other functions. It is recommended to use ChatGPT.push_function()
sourcepub fn set_functions(&mut self, functions: Vec<FunctionSpecification>)
pub fn set_functions(&mut self, functions: Vec<FunctionSpecification>)
Sets the functions in the chat context as a vector of FunctionSpecification. This is an internal function used by other functions.
sourcepub fn set_function_call(&mut self, function_call: String)
pub fn set_function_call(&mut self, function_call: String)
Sets the last message sent by the user or the bot as a string. This is an internal function used by other functions.
sourcepub fn last_content(&self) -> Option<String>
pub fn last_content(&self) -> Option<String>
Returns the last message sent by the user or the bot as a string. This is an internal function used by other functions. It is recommended to use ChatGPT.last_content()
sourcepub fn last_function_call(&self) -> Option<(String, String)>
pub fn last_function_call(&self) -> Option<(String, String)>
Returns the last function call in the chat context as a tuple of the function name and the arguments. This is an internal function used by other functions. It is recommended to use ChatGPT.last_function_call()
Trait Implementations§
source§impl Clone for ChatContext
impl Clone for ChatContext
source§fn clone(&self) -> ChatContext
fn clone(&self) -> ChatContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more