org.llm4s.media

package org.llm4s.media

Members list

Type members

Classlikes

sealed trait AudioMediaType extends MediaType

A MediaType statically known to be audio, so audio APIs can require one.

A MediaType statically known to be audio, so audio APIs can require one.

Attributes

Supertypes
trait MediaType
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
object Flac
object Mp3
object Ogg
object Wav
sealed trait ImageMediaType extends MediaType

A MediaType statically known to be an image, so image APIs can require one.

A MediaType statically known to be an image, so image APIs can require one.

Attributes

Supertypes
trait MediaType
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
object Bmp
object Gif
object Jpeg
object Png
object Tiff
object WebP
Show all
sealed trait MediaCategory extends Product, Serializable

The broad kind of a media type - the part of a MIME type before the slash.

The broad kind of a media type - the part of a MIME type before the slash.

This is the discriminator multimodal code branches on: extraction decides whether to decode a file as pixels, samples or text; a provider decides whether it can accept the payload at all. Modelling it as a type rather than as mimeType.startsWith("image/") keeps that decision exhaustive and testable.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
object Application
object Audio
object Image
object Text
object Video
object MediaCategory

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait MediaType extends Product, Serializable

A media type: its MIME string, its canonical file extension, and its MediaCategory.

A media type: its MIME string, its canonical file extension, and its MediaCategory.

This is the shared vocabulary the multimodal modules speak. Before it existed, llm4s-core carried three overlapping enumerations of the same handful of image formats - imagegeneration.ImageFormat, imageprocessing.ImageFormat and imageprocessing.MediaType - which could not be passed to one another despite being structurally identical, and RAG's media extraction matched on raw MIME prefixes instead.

llm4s-media holds the vocabulary only: no I/O, no sniffing, no third-party dependencies. Deciding what a file actually is from its bytes needs Tika, which lives in llm4s-rag; that code produces a MIME string and resolves it here via MediaType.fromMimeType.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
object Flac
object Mp3
object Ogg
object Wav
object Bmp
object Gif
object Jpeg
object Png
object Tiff
object WebP
Show all
object MediaType

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
MediaType.type