pub struct Decision<D: DecisionTrait> {
pub base_req: CompletionRequest,
pub best_of_n_votes: u8,
pub dynamic_temperature: bool,
pub reason: D,
pub result_can_be_none: bool,
}Fields§
§base_req: CompletionRequest§best_of_n_votes: u8§dynamic_temperature: bool§reason: D§result_can_be_none: boolImplementations§
Source§impl<D: DecisionTrait> Decision<D>
impl<D: DecisionTrait> Decision<D>
pub async fn return_primitive( &mut self, ) -> Result<<D::ReasonPrimitive as PrimitiveTrait>::PrimitiveResult>
pub async fn return_optional_primitive( &mut self, ) -> Result<Option<<D::ReasonPrimitive as PrimitiveTrait>::PrimitiveResult>>
pub async fn return_result(&mut self) -> Result<DecisionResult>
pub async fn return_optional_result(&mut self) -> Result<DecisionResult>
pub fn parse_decision_result( &self, decision_result: &DecisionResult, ) -> Result<Option<<D::ReasonPrimitive as PrimitiveTrait>::PrimitiveResult>>
Sourcepub fn best_of_n_votes(&mut self, best_of_n_votes: u8) -> &mut Self
pub fn best_of_n_votes(&mut self, best_of_n_votes: u8) -> &mut Self
Sets the number of votes to reach consensus. It is the maxium number of votes for a decision, but often the decision is reached before this number is reached.
For example, with the default of 3 votes, the first decision is made after 2 votes for a choice.
If given an even number, it will round up to the nearest odd number.
Sourcepub fn dynamic_temperature(&mut self, dynamic_temperature: bool) -> &mut Self
pub fn dynamic_temperature(&mut self, dynamic_temperature: bool) -> &mut Self
Dynamically scales temperature during the voting process. Starts at a low temperature and increases towards max temperature as the number of votes increases.
Trait Implementations§
Source§impl<D: DecisionTrait> InstructPromptTrait for Decision<D>
impl<D: DecisionTrait> InstructPromptTrait for Decision<D>
fn instruct_prompt_mut(&mut self) -> &mut InstructPrompt
fn set_instructions<T: AsRef<str>>(&mut self, instructions: T) -> &mut Self
fn instructions(&mut self) -> &mut PromptMessage
fn set_supporting_material<T: AsRef<str>>( &mut self, supporting_material: T, ) -> &mut Self
fn supporting_material(&mut self) -> &mut PromptMessage
Source§impl<D: DecisionTrait> RequestConfigTrait for Decision<D>
impl<D: DecisionTrait> RequestConfigTrait for Decision<D>
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<D> !Freeze for Decision<D>
impl<D> !RefUnwindSafe for Decision<D>
impl<D> Send for Decision<D>where
D: Send,
impl<D> Sync for Decision<D>where
D: Sync,
impl<D> Unpin for Decision<D>where
D: Unpin,
impl<D> !UnwindSafe for Decision<D>
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
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