pub struct CompiledGraph { /* private fields */ }Available on crate feature
graph only.Expand description
A compiled graph ready for execution
Implementations§
Source§impl CompiledGraph
Convenience methods for CompiledGraph
impl CompiledGraph
Convenience methods for CompiledGraph
Sourcepub async fn invoke(
&self,
input: HashMap<String, Value>,
config: ExecutionConfig,
) -> Result<HashMap<String, Value>, GraphError>
pub async fn invoke( &self, input: HashMap<String, Value>, config: ExecutionConfig, ) -> Result<HashMap<String, Value>, GraphError>
Execute the graph synchronously
Sourcepub fn stream(
&self,
input: HashMap<String, Value>,
config: ExecutionConfig,
mode: StreamMode,
) -> impl Stream<Item = Result<StreamEvent, GraphError>>
pub fn stream( &self, input: HashMap<String, Value>, config: ExecutionConfig, mode: StreamMode, ) -> impl Stream<Item = Result<StreamEvent, GraphError>>
Execute with streaming
Sourcepub async fn get_state(
&self,
thread_id: &str,
) -> Result<Option<HashMap<String, Value>>, GraphError>
pub async fn get_state( &self, thread_id: &str, ) -> Result<Option<HashMap<String, Value>>, GraphError>
Get current state for a thread
Sourcepub async fn update_state(
&self,
thread_id: &str,
updates: impl IntoIterator<Item = (String, Value)>,
) -> Result<(), GraphError>
pub async fn update_state( &self, thread_id: &str, updates: impl IntoIterator<Item = (String, Value)>, ) -> Result<(), GraphError>
Update state for a thread (for human-in-the-loop)
Source§impl CompiledGraph
impl CompiledGraph
Sourcepub fn with_checkpointer<C>(self, checkpointer: C) -> CompiledGraphwhere
C: Checkpointer + 'static,
pub fn with_checkpointer<C>(self, checkpointer: C) -> CompiledGraphwhere
C: Checkpointer + 'static,
Configure checkpointing
Sourcepub fn with_checkpointer_arc(
self,
checkpointer: Arc<dyn Checkpointer>,
) -> CompiledGraph
pub fn with_checkpointer_arc( self, checkpointer: Arc<dyn Checkpointer>, ) -> CompiledGraph
Configure checkpointing with Arc
Sourcepub fn with_interrupt_before(self, nodes: &[&str]) -> CompiledGraph
pub fn with_interrupt_before(self, nodes: &[&str]) -> CompiledGraph
Configure interrupt before specific nodes
Sourcepub fn with_interrupt_after(self, nodes: &[&str]) -> CompiledGraph
pub fn with_interrupt_after(self, nodes: &[&str]) -> CompiledGraph
Configure interrupt after specific nodes
Sourcepub fn with_recursion_limit(self, limit: usize) -> CompiledGraph
pub fn with_recursion_limit(self, limit: usize) -> CompiledGraph
Set recursion limit for cycles
Sourcepub fn get_entry_nodes(&self) -> Vec<String>
pub fn get_entry_nodes(&self) -> Vec<String>
Get entry nodes
Sourcepub fn get_next_nodes(
&self,
executed: &[String],
state: &HashMap<String, Value>,
) -> Vec<String>
pub fn get_next_nodes( &self, executed: &[String], state: &HashMap<String, Value>, ) -> Vec<String>
Get next nodes after executing the given nodes
Sourcepub fn leads_to_end(
&self,
executed: &[String],
state: &HashMap<String, Value>,
) -> bool
pub fn leads_to_end( &self, executed: &[String], state: &HashMap<String, Value>, ) -> bool
Check if any of the executed nodes lead to END
Sourcepub fn schema(&self) -> &StateSchema
pub fn schema(&self) -> &StateSchema
Get the state schema
Sourcepub fn checkpointer(&self) -> Option<&Arc<dyn Checkpointer>>
pub fn checkpointer(&self) -> Option<&Arc<dyn Checkpointer>>
Get the checkpointer if configured
Auto Trait Implementations§
impl Freeze for CompiledGraph
impl !RefUnwindSafe for CompiledGraph
impl Send for CompiledGraph
impl Sync for CompiledGraph
impl Unpin for CompiledGraph
impl !UnwindSafe for CompiledGraph
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request