Skip to main content

transform_messages

Function transform_messages 

Source
pub fn transform_messages(
    messages: &[Message],
    from_api: Api,
    to_api: Api,
    opts: TransformOptions,
) -> Vec<Message>
Expand description

Message transformation between provider formats. Transform a slice of Messages from one provider API to another.

This is the primary entry-point. It dispatches to the appropriate directional converter and then applies the requested post-processing options.

§Cross-provider transformation flow

use oxicode_ai::{transform_messages, Api};

// Convert messages from Anthropic format to OpenAI format
let anthropic_msgs = vec![/* ... */];
let openai_msgs = transform_messages(
    &anthropic_msgs,
    Api::AnthropicMessages,
    Api::OpenAiCompletions,
    Default::default(),
);