pub struct ChatIntegration { /* private fields */ }Expand description
Integration with oxirs-chat for conversational AI
Implementations§
Source§impl ChatIntegration
impl ChatIntegration
Sourcepub fn new(model: Box<dyn EmbeddingModel>) -> Self
pub fn new(model: Box<dyn EmbeddingModel>) -> Self
Create new chat integration
Sourcepub fn with_context_window(self, window_size: usize) -> Self
pub fn with_context_window(self, window_size: usize) -> Self
Configure context window size
Sourcepub fn with_similarity_threshold(self, threshold: f32) -> Self
pub fn with_similarity_threshold(self, threshold: f32) -> Self
Configure similarity threshold for relevant entities
Sourcepub fn extract_relevant_entities(&self, query: &str) -> Result<Vec<String>>
pub fn extract_relevant_entities(&self, query: &str) -> Result<Vec<String>>
Extract entities from the model’s vocabulary that appear as a
substring of query (case-insensitive).
Rather than scanning the whole query once per known entity (O(entities × query length)), this builds a lowercase-name index once and scans
the query a single time for bounded-length substring windows against
that index (O(entities + query length × longest entity name)).
Sourcepub async fn generate_context_embedding(
&self,
messages: &[String],
) -> Result<Vector>
pub async fn generate_context_embedding( &self, messages: &[String], ) -> Result<Vector>
Generate a context embedding for a conversation by encoding the most
recent messages (bounded by context_window) with the held model and
averaging the resulting vectors component-wise.
Sourcepub async fn generate_personalized_embedding(
&mut self,
user_id: &str,
query: &str,
conversation_history: &[String],
) -> Result<Vector>
pub async fn generate_personalized_embedding( &mut self, user_id: &str, query: &str, conversation_history: &[String], ) -> Result<Vector>
Generate personalized embeddings for a user
Sourcepub fn update_user_profile(
&mut self,
user_id: &str,
query: &str,
response_feedback: Option<f32>,
interaction_type: InteractionType,
) -> Result<()>
pub fn update_user_profile( &mut self, user_id: &str, query: &str, response_feedback: Option<f32>, interaction_type: InteractionType, ) -> Result<()>
Update user profile based on interaction
Sourcepub async fn translate_query(
&self,
query: &str,
source_lang: &str,
target_lang: &str,
) -> Result<String>
pub async fn translate_query( &self, query: &str, source_lang: &str, target_lang: &str, ) -> Result<String>
Translate query to target language
Sourcepub async fn detect_language(&self, text: &str) -> Result<LanguageDetection>
pub async fn detect_language(&self, text: &str) -> Result<LanguageDetection>
Detect language of input text
Auto Trait Implementations§
impl !RefUnwindSafe for ChatIntegration
impl !UnwindSafe for ChatIntegration
impl Freeze for ChatIntegration
impl Send for ChatIntegration
impl Sync for ChatIntegration
impl Unpin for ChatIntegration
impl UnsafeUnpin for ChatIntegration
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.