NeuralPlus 0.2.0
A small C++17 SDK for AI clients, sessions, tools, and tracing
Loading...
Searching...
No Matches
neuralplus::Content Class Referencefinal

One text, image, audio, file, or provider-extension part. More...

#include <types.hpp>

Public Member Functions

ContentType type () const noexcept
 Returns the normalized kind of this content part.
 
ContentSource source () const noexcept
 Returns whether this part stores a value, URL, bytes, or provider data.
 
const std::string & value () const noexcept
 Returns the text value, or an empty string for non-text parts.
 
const std::string & url () const noexcept
 Returns the referenced URL, or an empty string for non-URL parts.
 
const std::vector< std::uint8_t > & bytes () const noexcept
 Returns inline bytes, or an empty vector for non-inline parts.
 
const std::string & media_type () const noexcept
 Returns the media type supplied for this part.
 
const std::string & filename () const noexcept
 Returns the optional filename supplied for a file part.
 
const std::string & provider () const noexcept
 Returns the target provider name for an extension part.
 
const JsonValueoptions () const noexcept
 Returns provider-neutral options associated with this part.
 
const JsonValueprovider_data () const noexcept
 Returns the opaque payload of a provider extension part.
 

Static Public Member Functions

static Content text (std::string value)
 Creates a UTF-8 text part.
 
static Content image_url (std::string url, std::string media_type={}, JsonValue options=JsonValue::object())
 Creates an image referenced by URL.
 
static Content image_bytes (std::vector< std::uint8_t > bytes, std::string media_type, JsonValue options=JsonValue::object())
 Creates an inline image. The provider adapter performs base64 encoding.
 
static Content audio_url (std::string url, std::string media_type={}, JsonValue options=JsonValue::object())
 Creates audio referenced by URL.
 
static Content audio_bytes (std::vector< std::uint8_t > bytes, std::string media_type, JsonValue options=JsonValue::object())
 Creates inline audio.
 
static Content file_url (std::string url, std::string media_type={}, std::string filename={}, JsonValue options=JsonValue::object())
 Creates a file referenced by URL.
 
static Content file_bytes (std::vector< std::uint8_t > bytes, std::string media_type, std::string filename={}, JsonValue options=JsonValue::object())
 Creates an inline file.
 
static Content extension (std::string provider, JsonValue provider_data)
 

Detailed Description

One text, image, audio, file, or provider-extension part.

Member Function Documentation

◆ extension()

static Content neuralplus::Content::extension ( std::string  provider,
JsonValue  provider_data 
)
static

Creates a provider-specific escape hatch.

The provider name is matched by its adapter, for example openai. Other adapters reject the part instead of silently changing semantics.


The documentation for this class was generated from the following file: