Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::media Namespace Reference

Media envelope namespace. More...

Functions

bool isMediaPart (const JsonObject &j)
 Quick probe to see if JSONObject looks like a media envelope (canonical or compatible)
 
JsonObject normalizeMediaPart (JsonObject j)
 Normalize various accepted shapes into the canonical envelope, validating constraints.
 
String getMime (const JsonObject &j)
 Extract MIME type (returns empty string if not present)
 
bool hasUri (const JsonObject &j)
 Returns true if the envelope carries a URI reference.
 
bool hasData (const JsonObject &j)
 Returns true if the envelope carries inline base64 data.
 
String mimeFromDataUrl (const String &data_url)
 Best-effort parse of a Data URL to extract MIME type (empty if not parsable)
 
std::optional< JsonObjecttryParseEnvelopeFromString (const String &content)
 Parse a string into a media envelope if possible; returns nullopt if not media.
 
JsonObject text (const String &s)
 Create a text media envelope.
 
JsonObject imageUri (const String &uri, const String &mime, JsonObject meta={})
 Create an image media envelope.
 
JsonObject imageData (const String &base64, const String &mime, JsonObject meta={})
 Create an image media envelope with base64 data.
 
JsonObject audioUri (const String &uri, const String &mime, JsonObject meta={})
 Create an audio media envelope.
 
JsonObject audioData (const String &base64, const String &mime, JsonObject meta={})
 Create an audio media envelope with base64 data.
 
JsonObject videoUri (const String &uri, const String &mime, JsonObject meta={})
 Create a video media envelope.
 
JsonObject videoData (const String &base64, const String &mime, JsonObject meta={})
 Create a video media envelope with base64 data.
 

Detailed Description

Media envelope namespace.

Function Documentation

◆ audioData()

JsonObject agents::media::audioData ( const String & base64,
const String & mime,
JsonObject meta = {} )
inline

Create an audio media envelope with base64 data.

Parameters
base64The base64 data
mimeThe audio MIME type
metaThe audio metadata
Returns
The media envelope

◆ audioUri()

JsonObject agents::media::audioUri ( const String & uri,
const String & mime,
JsonObject meta = {} )
inline

Create an audio media envelope.

Parameters
uriThe audio URI
mimeThe audio MIME type
metaThe audio metadata
Returns
The media envelope

◆ imageData()

JsonObject agents::media::imageData ( const String & base64,
const String & mime,
JsonObject meta = {} )
inline

Create an image media envelope with base64 data.

Parameters
base64The base64 data
mimeThe image MIME type
metaThe image metadata
Returns
The media envelope

◆ imageUri()

JsonObject agents::media::imageUri ( const String & uri,
const String & mime,
JsonObject meta = {} )
inline

Create an image media envelope.

Parameters
uriThe image URI
mimeThe image MIME type
metaThe image metadata
Returns
The media envelope

◆ normalizeMediaPart()

JsonObject agents::media::normalizeMediaPart ( JsonObject j)

Normalize various accepted shapes into the canonical envelope, validating constraints.

Exceptions
std::invalid_argumentif the input cannot be normalized to a valid envelope

◆ text()

JsonObject agents::media::text ( const String & s)
inline

Create a text media envelope.

Media envelope builders

Parameters
sThe text content
Returns
The media envelope

◆ videoData()

JsonObject agents::media::videoData ( const String & base64,
const String & mime,
JsonObject meta = {} )
inline

Create a video media envelope with base64 data.

Parameters
base64The base64 data
mimeThe video MIME type
metaThe video metadata
Returns
The media envelope

◆ videoUri()

JsonObject agents::media::videoUri ( const String & uri,
const String & mime,
JsonObject meta = {} )
inline

Create a video media envelope.

Parameters
uriThe video URI
mimeThe video MIME type
metaThe video metadata
Returns
The media envelope