pub struct ToolIdWrapper {
pub prefix: String,
pub tool_call_maps: BTreeMap<String, String>,
}Expand description
Tool call ID normalizer for cross-provider tool call matching.
Fields§
§prefix: StringPrefix for normalized tool call IDs.
tool_call_maps: BTreeMap<String, String>Original provider id to normalized id mapping.
Implementations§
Source§impl ToolIdWrapper
impl ToolIdWrapper
Sourcepub fn upsert_tool_call_id(&mut self, tool_call_id: &str) -> String
pub fn upsert_tool_call_id(&mut self, tool_call_id: &str) -> String
Normalize a tool call id.
Sourcepub fn wrap_messages(&mut self, message_history: &mut [ModelMessage])
pub fn wrap_messages(&mut self, message_history: &mut [ModelMessage])
Wrap all tool call IDs in a message history in place.
Sourcepub fn wrap_message(&mut self, message: &mut ModelMessage)
pub fn wrap_message(&mut self, message: &mut ModelMessage)
Wrap all tool call IDs in one message in place.
Sourcepub fn wrap_response_part(&mut self, part: &mut ModelResponsePart)
pub fn wrap_response_part(&mut self, part: &mut ModelResponsePart)
Wrap all tool call IDs in one response part in place.
Sourcepub fn wrap_provider_payload(&mut self, payload: &mut Value)
pub fn wrap_provider_payload(&mut self, payload: &mut Value)
Wrap tool call IDs in provider-native payload objects when they use common id keys.
Trait Implementations§
Source§impl Clone for ToolIdWrapper
impl Clone for ToolIdWrapper
Source§fn clone(&self) -> ToolIdWrapper
fn clone(&self) -> ToolIdWrapper
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ToolIdWrapper
impl Debug for ToolIdWrapper
Source§impl Default for ToolIdWrapper
impl Default for ToolIdWrapper
Source§impl<'de> Deserialize<'de> for ToolIdWrapper
impl<'de> Deserialize<'de> for ToolIdWrapper
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
impl Eq for ToolIdWrapper
Source§impl PartialEq for ToolIdWrapper
impl PartialEq for ToolIdWrapper
Source§impl Serialize for ToolIdWrapper
impl Serialize for ToolIdWrapper
impl StructuralPartialEq for ToolIdWrapper
Auto Trait Implementations§
impl Freeze for ToolIdWrapper
impl RefUnwindSafe for ToolIdWrapper
impl Send for ToolIdWrapper
impl Sync for ToolIdWrapper
impl Unpin for ToolIdWrapper
impl UnsafeUnpin for ToolIdWrapper
impl UnwindSafe for ToolIdWrapper
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