class Audio implements Content

Traits

Properties

protected null|array<string, mixed> $meta from  HasMeta

Methods

void
setMeta(array|string $meta, mixed $value = null)

Set response metadata using an array or key-value pair.

from  HasMeta
array
mergeMeta(array $baseArray)

Merge metadata into the given response array.

from  HasMeta
__construct(string $data, string $mimeType = 'audio/wav')

Create audio content from raw bytes.

array
toTool(Tool $tool)

Format the audio for a tool response.

array
toPrompt(Prompt $prompt)

Format the audio for a prompt response.

array
toResource(Resource $resource)

Format the audio for a resource response.

string
__toString()

Get the raw audio bytes.

array
toArray()

Convert the audio content to an array.

Details

in HasMeta at line 21
void setMeta(array|string $meta, mixed $value = null)

Set response metadata using an array or key-value pair.

Parameters

array|string $meta
mixed $value

Return Value

void

in HasMeta at line 46
array mergeMeta(array $baseArray)

Merge metadata into the given response array.

Parameters

array $baseArray

Return Value

array

at line 20
__construct(string $data, string $mimeType = 'audio/wav')

Create audio content from raw bytes.

Parameters

string $data
string $mimeType

at line 29
array toTool(Tool $tool)

Format the audio for a tool response.

Parameters

Tool $tool

Return Value

array

at line 39
array toPrompt(Prompt $prompt)

Format the audio for a prompt response.

Parameters

Prompt $prompt

Return Value

array

at line 49
array toResource(Resource $resource)

Format the audio for a resource response.

Parameters

Resource $resource

Return Value

array

at line 61
string __toString()

Get the raw audio bytes.

Return Value

string

at line 71
array toArray()

Convert the audio content to an array.

Return Value

array