pub struct FunctionMessage { /* private fields */ }Expand description
A function message in the conversation.
FunctionMessage objects are an older version of the ToolMessage schema, and
do not contain the tool_call_id field.
The tool_call_id field is used to associate the tool call request with the
tool call response. Useful in situations where a chat model is able
to request multiple tool calls in parallel.
This corresponds to FunctionMessage in LangChain Python.
Implementations§
Source§impl FunctionMessage
impl FunctionMessage
Sourcepub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
Create a new function message.
§Arguments
name- The name of the function that was executed.content- The result of the function execution.
Sourcepub fn with_id(
id: impl Into<String>,
name: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn with_id( id: impl Into<String>, name: impl Into<String>, content: impl Into<String>, ) -> Self
Create a new function message with an explicit ID.
Use this when deserializing or reconstructing messages where the ID must be preserved.
Sourcepub fn additional_kwargs(&self) -> &HashMap<String, Value>
pub fn additional_kwargs(&self) -> &HashMap<String, Value>
Get additional kwargs.
Sourcepub fn response_metadata(&self) -> &HashMap<String, Value>
pub fn response_metadata(&self) -> &HashMap<String, Value>
Get response metadata.
Sourcepub fn with_response_metadata(
self,
response_metadata: HashMap<String, Value>,
) -> Self
pub fn with_response_metadata( self, response_metadata: HashMap<String, Value>, ) -> Self
Set response metadata.
Trait Implementations§
Source§impl Clone for FunctionMessage
impl Clone for FunctionMessage
Source§fn clone(&self) -> FunctionMessage
fn clone(&self) -> FunctionMessage
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 FunctionMessage
impl Debug for FunctionMessage
Source§impl<'de> Deserialize<'de> for FunctionMessage
impl<'de> Deserialize<'de> for FunctionMessage
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
Source§impl From<FunctionMessage> for BaseMessage
impl From<FunctionMessage> for BaseMessage
Source§fn from(msg: FunctionMessage) -> Self
fn from(msg: FunctionMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for FunctionMessage
impl PartialEq for FunctionMessage
Source§impl Serialize for FunctionMessage
impl Serialize for FunctionMessage
impl StructuralPartialEq for FunctionMessage
Auto Trait Implementations§
impl Freeze for FunctionMessage
impl RefUnwindSafe for FunctionMessage
impl Send for FunctionMessage
impl Sync for FunctionMessage
impl Unpin for FunctionMessage
impl UnwindSafe for FunctionMessage
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