pub struct GptCompletion {
pub model: String,
pub tools: Option<Vec<FunctionCall>>,
pub messages: Vec<GptMessage>,
pub response_format: ResponseFormat,
pub temperature: f32,
}Fields§
§model: String§tools: Option<Vec<FunctionCall>>§messages: Vec<GptMessage>§response_format: ResponseFormat§temperature: f32Implementations§
Source§impl GptCompletion
impl GptCompletion
Sourcepub fn new(messages: Vec<GptMessage>, temperature: f32, is_json: bool) -> Self
pub fn new(messages: Vec<GptMessage>, temperature: f32, is_json: bool) -> Self
Create chat completion
pub fn set_model(&mut self, model: &str)
pub fn set_tools(&mut self, tools: Option<Vec<FunctionCall>>)
pub fn set_response_format(&mut self, response_format: &ResponseFormat)
Sourcepub fn add_message(&mut self, message: &GptMessage)
pub fn add_message(&mut self, message: &GptMessage)
Add a single new message
Sourcepub fn add_messages(&mut self, messages: &[GptMessage])
pub fn add_messages(&mut self, messages: &[GptMessage])
Add many new messages
Trait Implementations§
Source§impl Clone for GptCompletion
impl Clone for GptCompletion
Source§fn clone(&self) -> GptCompletion
fn clone(&self) -> GptCompletion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GptCompletion
impl Debug for GptCompletion
Source§impl LlmCompletion for GptCompletion
impl LlmCompletion for GptCompletion
Source§fn set_temperature(&mut self, temperature: f32)
fn set_temperature(&mut self, temperature: f32)
Set temperature
Source§fn add_many_text(&mut self, role: &str, texts: &[String])
fn add_many_text(&mut self, role: &str, texts: &[String])
Add single role with multiple strings for parts as single large content
Source§fn add_system(&mut self, system_prompt: &str)
fn add_system(&mut self, system_prompt: &str)
Supply simple, ‘system’ content
Source§fn add_multi_part_system(&mut self, system_prompts: &[String])
fn add_multi_part_system(&mut self, system_prompts: &[String])
Supply multi-parts and single ‘system’ content
Source§fn add_systems(&mut self, system_prompts: &[String])
fn add_systems(&mut self, system_prompts: &[String])
Supply multi-context ‘system’ content
Source§fn dialogue(&mut self, prompts: &[String], has_system: bool)
fn dialogue(&mut self, prompts: &[String], has_system: bool)
Supply multi-String content with user and llm alternating
Source§fn truncate_messages(&mut self, len: usize)
fn truncate_messages(&mut self, len: usize)
Truncate messages
Source§async fn call(
system: &str,
user: &[String],
temperature: f32,
is_json: bool,
is_chat: bool,
) -> Result<LlmReturn, Box<dyn Error + Send>>
async fn call( system: &str, user: &[String], temperature: f32, is_json: bool, is_chat: bool, ) -> Result<LlmReturn, Box<dyn Error + Send>>
Create and call llm by supplying data and common parameters
Auto Trait Implementations§
impl Freeze for GptCompletion
impl RefUnwindSafe for GptCompletion
impl Send for GptCompletion
impl Sync for GptCompletion
impl Unpin for GptCompletion
impl UnwindSafe for GptCompletion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more