pub struct WasmGraph { /* private fields */ }Expand description
An in-memory AgentMemory store for browser environments.
All data lives in memory and is lost when the instance is dropped. This is designed for demos, playgrounds, and ephemeral workloads.
Implementations§
Source§impl WasmGraph
impl WasmGraph
Sourcepub fn assert_fact(
&self,
subject: &str,
predicate: &str,
object: &str,
) -> Result<String, JsValue>
pub fn assert_fact( &self, subject: &str, predicate: &str, object: &str, ) -> Result<String, JsValue>
Assert a new fact and return its ID.
The object is stored as a text value. For typed values (number, boolean, entity reference), use typed methods.
Sourcepub fn assert_fact_at(
&self,
subject: &str,
predicate: &str,
object: &str,
valid_from_iso: &str,
) -> Result<String, JsValue>
pub fn assert_fact_at( &self, subject: &str, predicate: &str, object: &str, valid_from_iso: &str, ) -> Result<String, JsValue>
Assert a fact with a specific valid_from timestamp (ISO 8601).
Sourcepub fn assert_number_fact(
&self,
subject: &str,
predicate: &str,
value: f64,
) -> Result<String, JsValue>
pub fn assert_number_fact( &self, subject: &str, predicate: &str, value: f64, ) -> Result<String, JsValue>
Assert a numeric fact.
Sourcepub fn assert_boolean_fact(
&self,
subject: &str,
predicate: &str,
value: bool,
) -> Result<String, JsValue>
pub fn assert_boolean_fact( &self, subject: &str, predicate: &str, value: bool, ) -> Result<String, JsValue>
Assert a boolean fact.
Sourcepub fn assert_entity_fact(
&self,
subject: &str,
predicate: &str,
entity: &str,
) -> Result<String, JsValue>
pub fn assert_entity_fact( &self, subject: &str, predicate: &str, entity: &str, ) -> Result<String, JsValue>
Assert an entity reference fact (graph edge).
Sourcepub fn assert_number_fact_at(
&self,
subject: &str,
predicate: &str,
value: f64,
valid_from_iso: &str,
) -> Result<String, JsValue>
pub fn assert_number_fact_at( &self, subject: &str, predicate: &str, value: f64, valid_from_iso: &str, ) -> Result<String, JsValue>
Assert a numeric fact with a specific valid_from timestamp (ISO 8601).
Sourcepub fn assert_boolean_fact_at(
&self,
subject: &str,
predicate: &str,
value: bool,
valid_from_iso: &str,
) -> Result<String, JsValue>
pub fn assert_boolean_fact_at( &self, subject: &str, predicate: &str, value: bool, valid_from_iso: &str, ) -> Result<String, JsValue>
Assert a boolean fact with a specific valid_from timestamp (ISO 8601).
Sourcepub fn assert_entity_fact_at(
&self,
subject: &str,
predicate: &str,
entity: &str,
valid_from_iso: &str,
) -> Result<String, JsValue>
pub fn assert_entity_fact_at( &self, subject: &str, predicate: &str, entity: &str, valid_from_iso: &str, ) -> Result<String, JsValue>
Assert an entity reference fact with a specific valid_from timestamp (ISO 8601).
Sourcepub fn assert_with_confidence(
&self,
subject: &str,
predicate: &str,
object: &str,
confidence: f64,
source: Option<String>,
) -> Result<String, JsValue>
pub fn assert_with_confidence( &self, subject: &str, predicate: &str, object: &str, confidence: f64, source: Option<String>, ) -> Result<String, JsValue>
Assert a fact with confidence, optionally attaching a source marker.
Sourcepub fn correct_fact(
&self,
fact_id: &str,
new_object: &str,
) -> Result<String, JsValue>
pub fn correct_fact( &self, fact_id: &str, new_object: &str, ) -> Result<String, JsValue>
Correct a fact by ID.
Sourcepub fn current_facts(
&self,
subject: &str,
predicate: &str,
) -> Result<String, JsValue>
pub fn current_facts( &self, subject: &str, predicate: &str, ) -> Result<String, JsValue>
Get all currently valid facts for (subject, predicate) as JSON.
Sourcepub fn facts_at(
&self,
subject: &str,
predicate: &str,
at_iso: &str,
) -> Result<String, JsValue>
pub fn facts_at( &self, subject: &str, predicate: &str, at_iso: &str, ) -> Result<String, JsValue>
Get facts valid at a specific point in time (ISO 8601) as JSON.
Sourcepub fn all_facts_about(&self, subject: &str) -> Result<String, JsValue>
pub fn all_facts_about(&self, subject: &str) -> Result<String, JsValue>
Get every fact ever recorded about an entity as JSON.
Sourcepub fn recall(
&self,
query: &str,
query_embedding: Option<Vec<f64>>,
limit: usize,
) -> Result<String, JsValue>
pub fn recall( &self, query: &str, query_embedding: Option<Vec<f64>>, limit: usize, ) -> Result<String, JsValue>
Recall current facts for a query as JSON.
Sourcepub fn recall_scored(
&self,
query: &str,
limit: usize,
query_embedding: Option<Vec<f64>>,
min_confidence: Option<f64>,
confidence_filter_mode: Option<String>,
max_scored_rows: Option<usize>,
use_hybrid: bool,
temporal_intent: Option<String>,
temporal_operator: Option<String>,
) -> Result<String, JsValue>
pub fn recall_scored( &self, query: &str, limit: usize, query_embedding: Option<Vec<f64>>, min_confidence: Option<f64>, confidence_filter_mode: Option<String>, max_scored_rows: Option<usize>, use_hybrid: bool, temporal_intent: Option<String>, temporal_operator: Option<String>, ) -> Result<String, JsValue>
Recall facts with score metadata as JSON.
Sourcepub fn assemble_context(
&self,
query: &str,
max_tokens: usize,
query_embedding: Option<Vec<f64>>,
) -> Result<String, JsValue>
pub fn assemble_context( &self, query: &str, max_tokens: usize, query_embedding: Option<Vec<f64>>, ) -> Result<String, JsValue>
Build a memory-anchored prompt context from recalled facts.
Trait Implementations§
Source§impl FromWasmAbi for WasmGraph
impl FromWasmAbi for WasmGraph
Source§impl IntoWasmAbi for WasmGraph
impl IntoWasmAbi for WasmGraph
Source§impl LongRefFromWasmAbi for WasmGraph
impl LongRefFromWasmAbi for WasmGraph
Source§impl OptionFromWasmAbi for WasmGraph
impl OptionFromWasmAbi for WasmGraph
Source§impl OptionIntoWasmAbi for WasmGraph
impl OptionIntoWasmAbi for WasmGraph
Source§impl RefFromWasmAbi for WasmGraph
impl RefFromWasmAbi for WasmGraph
Source§impl RefMutFromWasmAbi for WasmGraph
impl RefMutFromWasmAbi for WasmGraph
Source§impl TryFromJsValue for WasmGraph
impl TryFromJsValue for WasmGraph
Source§impl VectorFromWasmAbi for WasmGraph
impl VectorFromWasmAbi for WasmGraph
Source§impl VectorIntoWasmAbi for WasmGraph
impl VectorIntoWasmAbi for WasmGraph
impl SupportsConstructor for WasmGraph
impl SupportsInstanceProperty for WasmGraph
impl SupportsStaticProperty for WasmGraph
Auto Trait Implementations§
impl Freeze for WasmGraph
impl !RefUnwindSafe for WasmGraph
impl Send for WasmGraph
impl Sync for WasmGraph
impl Unpin for WasmGraph
impl UnsafeUnpin for WasmGraph
impl !UnwindSafe for WasmGraph
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
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.