pub struct AiAgent {Show 14 fields
pub model: String,
pub system_message: Option<Message>,
pub messages: Vec<Message>,
pub functions: Option<Vec<Function>>,
pub function_call: Option<String>,
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub n: Option<u64>,
pub stop: Option<Vec<String>>,
pub max_tokens: Option<u64>,
pub presence_penalty: Option<f64>,
pub frequency_penalty: Option<f64>,
pub logit_bias: Option<HashMap<u64, f64>>,
pub user: Option<String>,
}
Fields§
§model: String
§system_message: Option<Message>
§messages: Vec<Message>
§functions: Option<Vec<Function>>
§function_call: Option<String>
§temperature: Option<f64>
§top_p: Option<f64>
§n: Option<u64>
§stop: Option<Vec<String>>
§max_tokens: Option<u64>
§presence_penalty: Option<f64>
§frequency_penalty: Option<f64>
§logit_bias: Option<HashMap<u64, f64>>
§user: Option<String>
Implementations§
Source§impl AiAgent
impl AiAgent
pub fn build_request(&self, stream: bool) -> ChatCompletionRequest
pub async fn create(&self) -> Result<Chat, Error>
pub async fn create_stream(&self) -> Result<DeltaReceiver<'_>, Error>
pub fn new(model: impl Into<String>) -> Self
pub fn with_system_message<'a>(self, system_message: impl Into<&'a str>) -> Self
pub fn with_messages(self, messages: Vec<Message>) -> Self
pub fn with_function_call(self, function_call: impl Into<String>) -> Self
pub fn with_temperature(self, temperature: f64) -> Self
pub fn with_top_p(self, top_p: f64) -> Self
pub fn with_n(self, n: u64) -> Self
pub fn with_stop(self, stop: Vec<String>) -> Self
pub fn with_max_tokens(self, max_tokens: u64) -> Self
pub fn with_presence_penalty(self, presence_penalty: f64) -> Self
pub fn with_frequency_penalty(self, frequency_penalty: f64) -> Self
pub fn with_logit_bias(self, logit_bias: HashMap<u64, f64>) -> Self
pub fn with_user(self, user: impl Into<String>) -> Self
pub fn push_message(&mut self, message: Message)
pub fn push_function<FunctionArgs, Func, T>(
&mut self,
function: &Func,
function_name: &str,
)where
FunctionArgs: JsonSchema,
Func: FnMut(FunctionArgs) -> T,
pub fn push_stop(&mut self, stop: impl Into<String>)
pub fn push_logit_bias(&mut self, logit_bias: (u64, f64))
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AiAgent
impl<'de> Deserialize<'de> for AiAgent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AiAgent
impl RefUnwindSafe for AiAgent
impl Send for AiAgent
impl Sync for AiAgent
impl Unpin for AiAgent
impl UnwindSafe for AiAgent
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