pub struct Groq { /* private fields */ }
Expand description
§Private Fields
- api_key, the API key used to authenticate with groq,
- client, the reqwest::Client with built in connection pool,
- tmp_messages, messages that stay there for only a single request. After the request they are cleared.
- messages, a Vec for containing messages send to the groq completion endpoint (historic messages will not clear after request)
Implementations§
Source§impl Groq
impl Groq
Sourcepub fn new(api_key: &str) -> Self
pub fn new(api_key: &str) -> Self
Returns an instance of Groq struct.
ⓘ
Self {
api_key: api_key.into(), // the API key used to authenticate with groq
client: reqwest::Client::new(), // the reqwest::Client with built in connection pool
messages: Vec::new() // a Vec for containing messages send to the groq completion endpoint (historic messages will not clear after request)
}
Sourcepub fn add_message(&mut self, msg: Message)
pub fn add_message(&mut self, msg: Message)
Non Consuming Adds a message to the internal message vector
Sourcepub fn add_messages(&mut self, msgs: Vec<Message>)
pub fn add_messages(&mut self, msgs: Vec<Message>)
Non Consuming Add messages to the internal message vector
Sourcepub fn clear_messages(&mut self)
pub fn clear_messages(&mut self)
Non Consuming Clears the internal message vector. And shrink the capacity to 3.
Sourcepub fn clear_disposable_msgs_override(&mut self)
pub fn clear_disposable_msgs_override(&mut self)
Clears the internal tmp_messages vector.
§Note
Fucntion is created for internal use and is not recomended for external use. Non Consuming
Sourcepub fn add_disposable_msgs(&mut self, msgs: Vec<Message>)
pub fn add_disposable_msgs(&mut self, msgs: Vec<Message>)
Non Consuming
Sourcepub fn add_disposable_msg(&mut self, msg: Message)
pub fn add_disposable_msg(&mut self, msg: Message)
Non Consuming
pub async fn create(&mut self, req: RequestBuilder) -> Result<CompletionOption>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Groq
impl !RefUnwindSafe for Groq
impl Send for Groq
impl Sync for Groq
impl Unpin for Groq
impl !UnwindSafe for Groq
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