pub struct TapestryFragment<T: Config> {
pub context_tokens: <T::PromptModel as Llm<T>>::Tokens,
pub context_messages: Vec<ContextMessage<T>>,
}
Expand description
Represents a single part of a conversation containing a list of messages along with other metadata.
LLM can only hold a limited amount of tokens in a the entire message history/context.
The total number of context_tokens
is tracked when [Loom::weave
] is executed and if it
exceeds the maximum number of tokens allowed for the current GPT Config::PromptModel
, then a
summary is generated and a new TapestryFragment
instance is created.
Fields§
§context_tokens: <T::PromptModel as Llm<T>>::Tokens
Total number of GPT tokens in the context_messages
.
context_messages: Vec<ContextMessage<T>>
List of ContextMessage
s that represents the message history.
Trait Implementations§
Source§impl<T: Clone + Config> Clone for TapestryFragment<T>where
T::PromptModel: Clone,
impl<T: Clone + Config> Clone for TapestryFragment<T>where
T::PromptModel: Clone,
Source§fn clone(&self) -> TapestryFragment<T>
fn clone(&self) -> TapestryFragment<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug + Config> Debug for TapestryFragment<T>where
T::PromptModel: Debug,
impl<T: Debug + Config> Debug for TapestryFragment<T>where
T::PromptModel: Debug,
Source§impl<T: Default + Config> Default for TapestryFragment<T>where
T::PromptModel: Default,
impl<T: Default + Config> Default for TapestryFragment<T>where
T::PromptModel: Default,
Source§fn default() -> TapestryFragment<T>
fn default() -> TapestryFragment<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for TapestryFragment<T>where
T: Deserialize<'de> + Config,
impl<'de, T> Deserialize<'de> for TapestryFragment<T>where
T: Deserialize<'de> + Config,
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
Source§impl<T: PartialEq + Config> PartialEq for TapestryFragment<T>where
T::PromptModel: PartialEq,
impl<T: PartialEq + Config> PartialEq for TapestryFragment<T>where
T::PromptModel: PartialEq,
Source§impl<T> Serialize for TapestryFragment<T>
impl<T> Serialize for TapestryFragment<T>
impl<T: Config> StructuralPartialEq for TapestryFragment<T>
Auto Trait Implementations§
impl<T> Freeze for TapestryFragment<T>
impl<T> RefUnwindSafe for TapestryFragment<T>
impl<T> Send for TapestryFragment<T>
impl<T> Sync for TapestryFragment<T>
impl<T> Unpin for TapestryFragment<T>
impl<T> UnwindSafe for TapestryFragment<T>
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