trait MapsMessages

Methods

array
mapMessagesToInput(array $messages, string|null $instructions, Provider $provider)

Map the given Hypervel messages to OpenAI Responses API input format.

void
mapUserMessage(UserMessage|Message $message, array $input, Provider $provider)

Map a user message to OpenAI format.

void
mapAssistantMessage(AssistantMessage|Message $message, array $input, Provider $provider)

Map an assistant message to OpenAI format.

array
withoutStoredOnlyItems(array $blocks)

Remove file_search_call items, which the API resolves by id and so rejects when store is false.

array
functionCallItem(ToolCall $toolCall)

Map a tool call to a function_call input item, keeping the item id only when OpenAI issued it and its reasoning survived.

void
mapToolResultMessage(ToolResultMessage|Message $message, array $input)

Map a tool result message to OpenAI format.

Details

at line 21
protected array mapMessagesToInput(array $messages, string|null $instructions, Provider $provider)

Map the given Hypervel messages to OpenAI Responses API input format.

Parameters

array $messages
string|null $instructions
Provider $provider

Return Value

array

at line 48
protected void mapUserMessage(UserMessage|Message $message, array $input, Provider $provider)

Map a user message to OpenAI format.

Parameters

UserMessage|Message $message
array $input
Provider $provider

Return Value

void

at line 67
protected void mapAssistantMessage(AssistantMessage|Message $message, array $input, Provider $provider)

Map an assistant message to OpenAI format.

Parameters

AssistantMessage|Message $message
array $input
Provider $provider

Return Value

void

at line 126
protected array withoutStoredOnlyItems(array $blocks)

Remove file_search_call items, which the API resolves by id and so rejects when store is false.

Parameters

array $blocks

Return Value

array

at line 139
protected array functionCallItem(ToolCall $toolCall)

Map a tool call to a function_call input item, keeping the item id only when OpenAI issued it and its reasoning survived.

Parameters

ToolCall $toolCall

Return Value

array

at line 154
protected void mapToolResultMessage(ToolResultMessage|Message $message, array $input)

Map a tool result message to OpenAI format.

Parameters

ToolResultMessage|Message $message
array $input

Return Value

void