Skip to content

toMultipleFormats

toMultipleFormats(response, formats): Promise<{ anthropic?: AnthropicResponse; gemini?: unknown; mistral?: unknown; ollama?: unknown; openai?: OpenAIResponse; }>

Defined in: converters/response-converters.ts:200

Convert Universal IR response to multiple formats at once. Useful for debugging and comparing how different providers handle the same response.

IRChatResponse

Universal IR response

("openai" | "anthropic" | "gemini" | "ollama" | "mistral")[] = ...

Array of format names to convert to

Promise<{ anthropic?: AnthropicResponse; gemini?: unknown; mistral?: unknown; ollama?: unknown; openai?: OpenAIResponse; }>

Object with converted responses for each format

import { toMultipleFormats } from 'ai.matey.utils';
const irResponse = await backend.execute(request);
const allFormats = await toMultipleFormats(irResponse, ['openai', 'anthropic', 'gemini']);
console.log('OpenAI:', JSON.stringify(allFormats.openai, null, 2));
console.log('Anthropic:', JSON.stringify(allFormats.anthropic, null, 2));
console.log('Gemini:', JSON.stringify(allFormats.gemini, null, 2));