pub struct RequestBuilder<T> { /* private fields */ }
Expand description
A builder for creating requests to the OpenAI API.
Implementations§
Source§impl<C: CompletionLike> RequestBuilder<C>
impl<C: CompletionLike> RequestBuilder<C>
Sourcepub fn new<T: ToString, S: Display>(model: T, api_key: S) -> Self
pub fn new<T: ToString, S: Display>(model: T, api_key: S) -> Self
Create a new request builder.
Sourcepub fn max_tokens(self, max_tokens: u32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
Set the max_tokens parameter.
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Set the temperature parameter.
Sourcepub fn frequency_penalty(self, frequency_penalty: f32) -> Self
pub fn frequency_penalty(self, frequency_penalty: f32) -> Self
Set the frequency_penalty parameter.
Sourcepub fn presence_penalty(self, presence_penalty: f32) -> Self
pub fn presence_penalty(self, presence_penalty: f32) -> Self
Set the presence_penalty parameter.
pub fn user(self, user: String) -> Self
Source§impl RequestBuilder<CompletionState>
impl RequestBuilder<CompletionState>
Source§impl RequestBuilder<ChatState>
impl RequestBuilder<ChatState>
Sourcepub fn messages(self, messages: Vec<ChatMessage>) -> Self
pub fn messages(self, messages: Vec<ChatMessage>) -> Self
Set the messages parameter.
Sourcepub fn build_chat(self) -> Request<ChatState>
pub fn build_chat(self) -> Request<ChatState>
Builds a chat request.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RequestBuilder<T>
impl<T> RefUnwindSafe for RequestBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for RequestBuilder<T>where
T: Send,
impl<T> Sync for RequestBuilder<T>where
T: Sync,
impl<T> Unpin for RequestBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for RequestBuilder<T>where
T: UnwindSafe,
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