pub struct BasicCompletion {
pub base_req: CompletionRequest,
}Fields§
§base_req: CompletionRequestImplementations§
Source§impl BasicCompletion
impl BasicCompletion
pub fn new(backend: Arc<LLMBackend>) -> BasicCompletion
pub fn prompt(&mut self) -> &mut LLMPrompt
pub async fn run(&mut self) -> Result<CompletionResponse, Error>
pub fn parse_response(&self, content: &str) -> Result<String, Error>
Trait Implementations§
Source§impl Clone for BasicCompletion
impl Clone for BasicCompletion
Source§fn clone(&self) -> BasicCompletion
fn clone(&self) -> BasicCompletion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl LogitBiasTrait for BasicCompletion
impl LogitBiasTrait for BasicCompletion
fn lb_mut(&mut self) -> &mut Option<LogitBias>
fn logit_bias(&mut self) -> &mut LogitBias
Source§fn add_logit_bias_token_id(&mut self, token_id: u32, bias: f32) -> &mut Self
fn add_logit_bias_token_id(&mut self, token_id: u32, bias: f32) -> &mut Self
Adds a logit bias for a specific token ID. In the case you have your own tokenizer or other situations where you have token IDs. Read more
Source§fn add_logit_bias_token_ids(
&mut self,
logit_bias: HashMap<u32, f32>,
) -> &mut Self
fn add_logit_bias_token_ids( &mut self, logit_bias: HashMap<u32, f32>, ) -> &mut Self
Adds multiple logit biases for token IDs. In the case you have your own tokenizer or other situations where you have token IDs. Read more
Source§fn add_logit_bias_from_char(&mut self, char: char, bias: f32) -> &mut Self
fn add_logit_bias_from_char(&mut self, char: char, bias: f32) -> &mut Self
Adds a logit bias for a specific character.
Not very useful as it does not necessarily remove all instances of that character as the character may be part of other tokens. Read more
Source§fn add_logit_bias_from_word(&mut self, word: &str, bias: f32) -> &mut Self
fn add_logit_bias_from_word(&mut self, word: &str, bias: f32) -> &mut Self
Adds a logit bias for a specific word. If a word is more than one token, it will be split into multiple tokens.
Errors if the word is empty or contains whitespace. Read more
Source§fn add_logit_bias_from_text(&mut self, text: &str, bias: f32) -> &mut Self
fn add_logit_bias_from_text(&mut self, text: &str, bias: f32) -> &mut Self
Adds a logit bias for a specific text. Splits the text into tokens and applies the bias to each token. It does not add the logit bias value to the whitespace token. Read more
Source§fn clear_logit_bias(&mut self) -> &mut Self
fn clear_logit_bias(&mut self) -> &mut Self
Clearss the logit bias configuration. To reuse the request object for another request. Mostly for testing.
Source§impl RequestConfigTrait for BasicCompletion
impl RequestConfigTrait for BasicCompletion
fn config(&mut self) -> &mut RequestConfig
fn reset_request(&mut self)
Source§fn max_tokens(&mut self, max_tokens: u64) -> &mut Self
fn max_tokens(&mut self, max_tokens: u64) -> &mut Self
Sets the value of RequestConfig::requested_response_tokens.
Source§fn frequency_penalty(&mut self, frequency_penalty: f32) -> &mut Self
fn frequency_penalty(&mut self, frequency_penalty: f32) -> &mut Self
Sets the value of RequestConfig::frequency_penalty.
Source§fn presence_penalty(&mut self, presence_penalty: f32) -> &mut Self
fn presence_penalty(&mut self, presence_penalty: f32) -> &mut Self
Sets the value of RequestConfig::presence_penalty.
Source§fn temperature(&mut self, temperature: f32) -> &mut Self
fn temperature(&mut self, temperature: f32) -> &mut Self
Sets the value of RequestConfig::temperature.
Source§fn top_p(&mut self, top_p: f32) -> &mut Self
fn top_p(&mut self, top_p: f32) -> &mut Self
Sets the value of RequestConfig::top_p.
Source§fn retry_after_fail_n_times(
&mut self,
retry_after_fail_n_times: u8,
) -> &mut Self
fn retry_after_fail_n_times( &mut self, retry_after_fail_n_times: u8, ) -> &mut Self
Sets the value of RequestConfig::retry_after_fail_n_times.
Source§fn increase_limit_on_fail(&mut self, increase_limit_on_fail: bool) -> &mut Self
fn increase_limit_on_fail(&mut self, increase_limit_on_fail: bool) -> &mut Self
Sets the value of RequestConfig::increase_limit_on_fail.
Source§fn cache_prompt(&mut self, cache_prompt: bool) -> &mut Self
fn cache_prompt(&mut self, cache_prompt: bool) -> &mut Self
Sets the value of RequestConfig::cache_prompt.
Auto Trait Implementations§
impl !Freeze for BasicCompletion
impl !RefUnwindSafe for BasicCompletion
impl !UnwindSafe for BasicCompletion
impl Send for BasicCompletion
impl Sync for BasicCompletion
impl Unpin for BasicCompletion
impl UnsafeUnpin for BasicCompletion
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more