pub struct Session {
pub state: Value,
pub questions: Vec<Entry>,
pub model: Option<String>,
}Expand description
Everything the next :ask will send.
Fields§
§state: ValueThe text or JSON the model reasons about.
questions: Vec<Entry>Named questions, in insertion order.
model: Option<String>Per-session model override; None means the client default.
Implementations§
Source§impl Session
impl Session
pub fn new() -> Self
pub fn state_is_empty(&self) -> bool
Sourcepub fn state_preview(&self) -> String
pub fn state_preview(&self) -> String
One-line preview of the state for the side panel.
Sourcepub fn insert(&mut self, name: String, question: Question) -> bool
pub fn insert(&mut self, name: String, question: Question) -> bool
Add a question, or replace one of the same name in place.
pub fn remove(&mut self, name: &str) -> bool
pub fn to_questions(&self) -> Questions
Sourcepub fn request_json(&self, model: &str) -> String
pub fn request_json(&self, model: &str) -> String
The exact JSON body the SDK will POST to /v1/systemone.
Serialized through a struct (not a Value) so field and question order survive, which is
the whole point of showing it.
Sourcepub fn request_json_compact(&self, model: &str) -> String
pub fn request_json_compact(&self, model: &str) -> String
The same body Session::request_json shows, with the whitespace taken out: what a cache
key hashes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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