Skip to main content

ConversationSource

Trait ConversationSource 

Source
pub trait ConversationSource: Send + Sync {
    // Required methods
    fn sessions_with_turns_before<'life0, 'async_trait>(
        &'life0 self,
        cutoff: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_memory_isolated<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn owner_only_since<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        after_id: i64,
        cutoff: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn last_turn_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        after_id: i64,
        cutoff: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<i64>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn turns<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        after_id: i64,
        cutoff: DateTime<Utc>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<HistoryTurn>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn visibility<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<ChannelVisibility>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn channel_id(&self, session_id: &str) -> Option<String>;

    // Provided method
    fn project<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<ProjectRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

A host’s conversation history, as memory consolidation needs it.

“Memory-isolated” sessions (worker and mandate runs) never teach owner memory; turns from tasks whose memory policy suppressed access are never returned.

Required Methods§

Source

fn sessions_with_turns_before<'life0, 'async_trait>( &'life0 self, cutoff: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sessions with conversation turns before cutoff, memory-isolated sessions left out.

Source

fn is_memory_isolated<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether the session is a worker or mandate run that must not teach owner memory.

Source

fn owner_only_since<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, after_id: i64, cutoff: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether every user message after turn after_id and before cutoff came from the owner, and there was at least one. A session that is memory-isolated is never owner-only.

Source

fn last_turn_id<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, after_id: i64, cutoff: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The largest turn id after after_id and before cutoff.

Source

fn turns<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, after_id: i64, cutoff: DateTime<Utc>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<HistoryTurn>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Turns after after_id and before cutoff, oldest first, at most limit.

Source

fn visibility<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<ChannelVisibility>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The session’s audience, from its latest user message.

Source

fn channel_id(&self, session_id: &str) -> Option<String>

The channel facts learned in this session are scoped to.

Provided Methods§

Source

fn project<'life0, 'life1, 'async_trait>( &'life0 self, _session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<ProjectRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The project the session works in, when what is learned from it may be kept as that project’s memory (see crate::project). None by default: everything is learned as personal memory, as before.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§