pub struct ModelCallbackContext {
pub execution_id: ExecutionId,
pub step_id: Option<StepId>,
pub provider: String,
pub model: String,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub message_count: usize,
pub streaming: bool,
pub tools_enabled: bool,
pub trace_id: Option<String>,
}Expand description
Context passed to model callbacks
Contains information about an LLM model call.
Fields§
§execution_id: ExecutionIdExecution ID
step_id: Option<StepId>Step ID
provider: StringProvider name (e.g., “openai”, “anthropic”)
model: StringModel name (e.g., “gpt-4”, “claude-3-opus”)
temperature: Option<f32>Temperature setting
max_tokens: Option<u32>Max tokens setting
message_count: usizeNumber of messages in the request
streaming: boolWhether this is a streaming request
tools_enabled: boolWhether tools are enabled
trace_id: Option<String>Trace context
Implementations§
Source§impl ModelCallbackContext
impl ModelCallbackContext
Sourcepub fn new(
execution_id: ExecutionId,
provider: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn new( execution_id: ExecutionId, provider: impl Into<String>, model: impl Into<String>, ) -> Self
Create a new model callback context
Sourcepub fn with_params(
self,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Self
pub fn with_params( self, temperature: Option<f32>, max_tokens: Option<u32>, ) -> Self
Add model parameters
Sourcepub fn with_request_info(
self,
message_count: usize,
streaming: bool,
tools_enabled: bool,
) -> Self
pub fn with_request_info( self, message_count: usize, streaming: bool, tools_enabled: bool, ) -> Self
Add request info
Sourcepub fn with_trace(self, trace_id: impl Into<String>) -> Self
pub fn with_trace(self, trace_id: impl Into<String>) -> Self
Add trace context
Trait Implementations§
Source§impl Clone for ModelCallbackContext
impl Clone for ModelCallbackContext
Source§fn clone(&self) -> ModelCallbackContext
fn clone(&self) -> ModelCallbackContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelCallbackContext
impl Debug for ModelCallbackContext
Source§impl<'de> Deserialize<'de> for ModelCallbackContext
impl<'de> Deserialize<'de> for ModelCallbackContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ModelCallbackContext
impl RefUnwindSafe for ModelCallbackContext
impl Send for ModelCallbackContext
impl Sync for ModelCallbackContext
impl Unpin for ModelCallbackContext
impl UnsafeUnpin for ModelCallbackContext
impl UnwindSafe for ModelCallbackContext
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