class StructuredContentText extends Text

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 $text)

Create text content.

from  Text
array
toTool(Tool $tool)

Format the text for a tool response.

from  Text
array
toPrompt(Prompt $prompt)

Format the text for a prompt response.

from  Text
array
toResource(Resource $resource)

Format the text for a resource response.

from  Text
string
__toString()

Get the text content.

from  Text
array
toArray()

Convert the text content to an array.

from  Text

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

in Text at line 20
__construct(string $text)

Create text content.

Parameters

string $text

in Text at line 29
array toTool(Tool $tool)

Format the text for a tool response.

Parameters

Tool $tool

Return Value

array

in Text at line 39
array toPrompt(Prompt $prompt)

Format the text for a prompt response.

Parameters

Prompt $prompt

Return Value

array

in Text at line 49
array toResource(Resource $resource)

Format the text for a resource response.

Parameters

Resource $resource

Return Value

array

in Text at line 61
string __toString()

Get the text content.

Return Value

string

in Text at line 71
array toArray()

Convert the text content to an array.

Return Value

array