Class OpenAIConverterUtils

java.lang.Object
io.agentscope.extensions.model.openai.formatter.OpenAIConverterUtils

public final class OpenAIConverterUtils extends Object
Utility class for OpenAI message and conversation conversion.
  • Method Details

    • convertImageSourceToUrl

      public static String convertImageSourceToUrl(io.agentscope.core.message.Source source)
      Convert an image source to a URL string.
      Parameters:
      source - The image source (URLSource or Base64Source)
      Returns:
      The URL string or data URI
      Throws:
      IllegalArgumentException - if source is null or of unknown type
    • detectAudioFormat

      public static String detectAudioFormat(String mediaType)
      Detect audio format from media type.
      Parameters:
      mediaType - The media type (e.g., "audio/wav")
      Returns:
      The format string (e.g., "wav")
    • convertVideoSourceToUrl

      public static String convertVideoSourceToUrl(io.agentscope.core.message.Source source)
      Convert a video source to a URL string.
      Parameters:
      source - The video source (URLSource or Base64Source)
      Returns:
      The URL string or data URI
      Throws:
      IllegalArgumentException - if source is null or of unknown type