package tech.easyflow.ai.invoke.protocol.openai;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.List;

final class OpenAiJsonSupport {

    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

    private OpenAiJsonSupport() {
    }

    static List<OpenAiChatCompletionRequest.ContentPart> convertContentParts(JsonNode node) {
        return OBJECT_MAPPER.convertValue(node, new TypeReference<>() {
        });
    }
}
