pub struct StructuredToolCallNormalizer;Expand description
Normalizer for structured tool-call JSON returned by common provider APIs.
This type keeps the kernel independent from provider-specific Rust types by
operating on serde_json::Value shapes. It supports:
- OpenAI Responses API output items:
{"type":"function_call", ...} - OpenAI Responses API full responses:
{ "output": [function_call, ...] } - OpenAI Chat Completions tool calls:
{ "tool_calls": [...] } - OpenAI Chat Completions full responses:
{ "choices": [{ "message": ... }] }
Implementations§
Source§impl StructuredToolCallNormalizer
impl StructuredToolCallNormalizer
Sourcepub fn normalize_openai_responses(
value: &Value,
) -> Result<Vec<ToolInvocation>, KernelError>
pub fn normalize_openai_responses( value: &Value, ) -> Result<Vec<ToolInvocation>, KernelError>
Parse OpenAI Responses API function_call output items from either a
full response object, an output array, or a single output item.
Sourcepub fn normalize_openai_chat_completions(
value: &Value,
) -> Result<Vec<ToolInvocation>, KernelError>
pub fn normalize_openai_chat_completions( value: &Value, ) -> Result<Vec<ToolInvocation>, KernelError>
Parse OpenAI Chat Completions tool_calls from either a full response,
a message object, a tool_calls array, or a single tool call object.
Sourcepub fn normalize(value: &Value) -> Result<Vec<ToolInvocation>, KernelError>
pub fn normalize(value: &Value) -> Result<Vec<ToolInvocation>, KernelError>
Parse all supported structured standards from value.
This is useful when the caller has a provider JSON blob but does not want to branch on the provider path first. It preserves the order of calls within each standard and tries Responses before Chat Completions.
Trait Implementations§
Source§impl Clone for StructuredToolCallNormalizer
impl Clone for StructuredToolCallNormalizer
Source§fn clone(&self) -> StructuredToolCallNormalizer
fn clone(&self) -> StructuredToolCallNormalizer
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 StructuredToolCallNormalizer
impl Debug for StructuredToolCallNormalizer
Source§impl Default for StructuredToolCallNormalizer
impl Default for StructuredToolCallNormalizer
Source§fn default() -> StructuredToolCallNormalizer
fn default() -> StructuredToolCallNormalizer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StructuredToolCallNormalizer
impl RefUnwindSafe for StructuredToolCallNormalizer
impl Send for StructuredToolCallNormalizer
impl Sync for StructuredToolCallNormalizer
impl Unpin for StructuredToolCallNormalizer
impl UnsafeUnpin for StructuredToolCallNormalizer
impl UnwindSafe for StructuredToolCallNormalizer
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