pub struct TranscriptLog { /* private fields */ }Expand description
The owner’s conversation turns, in two tables of their own
(memory_transcript, memory_transcript_cursors) created on open.
Implementations§
Source§impl TranscriptLog
impl TranscriptLog
pub async fn open(pool: SqlitePool) -> Result<Self>
Sourcepub async fn record(&self, session_id: &str, turn: &LoggedTurn) -> Result<i64>
pub async fn record(&self, session_id: &str, turn: &LoggedTurn) -> Result<i64>
Append one turn.
Sourcepub fn recorder(&self) -> TranscriptRecorder
pub fn recorder(&self) -> TranscriptRecorder
A run-end hook that records the run’s turns: its last user message and everything after it.
Trait Implementations§
Source§impl ActivityLog for TranscriptLog
impl ActivityLog for TranscriptLog
Source§fn uncaptured_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
episode_ends: &'life1 [(String, String)],
which: UncapturedSessions,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn uncaptured_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
episode_ends: &'life1 [(String, String)],
which: UncapturedSessions,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sessions whose conversation turns since their latest episode end
pass
which. episode_ends holds each session’s latest episode end
(RFC 3339); a session missing from it has no episode. Memory-isolated
sessions may be returned: the jobs check.Source§fn owner_only_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
since: Option<&'life2 EpisodeBound>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn owner_only_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
since: Option<&'life2 EpisodeBound>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Whether every user message after
since (the session’s latest
episode; None: the whole session) came from the owner, and there
was at least one. A memory-isolated session never is.Source§fn turns_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
since: Option<&'life2 EpisodeBound>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn turns_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
since: Option<&'life2 EpisodeBound>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The session’s conversation turns after
since (the latest episode;
None: from the start), oldest first, at most limit read.Source§fn recent_turns<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recent_turns<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Conversation turns of sessions that are not memory-isolated, from
since on, newest first, at most limit read.Source§fn recent_owner_messages<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recent_owner_messages<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoggedTurn>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The owner’s own messages from
since on, in sessions that are not
memory-isolated, newest first, at most limit read.Source§impl Clone for TranscriptLog
impl Clone for TranscriptLog
Source§impl ConsolidationCursors for TranscriptLog
impl ConsolidationCursors for TranscriptLog
Source§fn cursor<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = i64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cursor<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = i64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The last turn id consolidated for the session (0 when none).
fn set_cursor<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
turn_id: i64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl ConversationSource for TranscriptLog
impl ConversationSource for TranscriptLog
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,
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,
Every recorded turn is the owner’s.
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,
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 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 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,
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,
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,
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>
fn channel_id(&self, _session_id: &str) -> Option<String>
The channel facts learned in this session are scoped to.
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,
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.Source§impl MessageLog for TranscriptLog
Episodes record the turns they cover by id.
impl MessageLog for TranscriptLog
Episodes record the turns they cover by id.
Source§fn message_bounds<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(Option<i64>, Option<i64>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn message_bounds<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(Option<i64>, Option<i64>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The first and last user or assistant message of
session_id from
start to end, both inclusive.Auto Trait Implementations§
impl !RefUnwindSafe for TranscriptLog
impl !UnwindSafe for TranscriptLog
impl Forget for TranscriptLog
impl Freeze for TranscriptLog
impl Move for TranscriptLog
impl Send for TranscriptLog
impl Sync for TranscriptLog
impl Unpin for TranscriptLog
impl UnsafeUnpin for TranscriptLog
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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