lastAssistantMessageIsCompleteWithToolCalls

Check whether the last assistant turn has all its tool results.

Returns true when the final assistant message's tool calls all have matching results, meaning the turn is ready to continue. Used to decide whether to resume a loop after a client round trip.

if lastAssistantMessageIsCompleteWithToolCalls(messages) {
  try await resume(messages)
}

Signature

func lastAssistantMessageIsCompleteWithToolCalls(
    _ messages: [UIMessage]
) -> Bool

Defined in Sources/AI/Transport/TextStreamChatTransport.swift.

Parameters

ParameterTypeDefault
_[UIMessage]required

Returns

A Bool.

See also