Skip to main content

inference_gateway_sdk/ext/
tool_call.rs

1use crate::generated::schemas::ChatCompletionMessageToolCallFunction;
2
3impl ChatCompletionMessageToolCallFunction {
4    /// Deserialize the `arguments` JSON string into a typed value.
5    ///
6    /// The OpenAI-style schema represents tool-call arguments as a JSON-encoded
7    /// string rather than a structured object, so callers must parse them.
8    pub fn parse_arguments<T: serde::de::DeserializeOwned>(&self) -> Result<T, serde_json::Error> {
9        serde_json::from_str(&self.arguments)
10    }
11}