Exception: Pikuri::Agent::EmptyTurnError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pikuri/agent.rb

Overview

A blank turn was requested against a conversation holding nothing but the assembled system prompt, on a provider that would render that as messages: [] (see SEPARATE_SYSTEM_FIELD_PROVIDERS):

agent.run_loop(user_message: nil)   # fresh chat, backend Anthropic
# => EmptyTurnError; the host catches it and prompts for a real message

Narrow by construction: every injected block lands as role: :user (#append_reference_block), so a skill-only or memory-only bare load has a message to complete against and never reaches here. What remains is a genuinely empty conversation.

Content-neutral: #provider is all it carries — the host owns any user-facing wording.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider) ⇒ EmptyTurnError

Returns a new instance of EmptyTurnError.

Parameters:

  • provider (String)

    the resolved provider slug (e.g. "anthropic")



121
122
123
124
125
126
# File 'lib/pikuri/agent.rb', line 121

def initialize(provider)
  @provider = provider
  super("#{provider} cannot complete a turn whose conversation holds only " \
        ':system content (no user or assistant message): it would send an ' \
        'empty messages array. Add a user message.')
end

Instance Attribute Details

#providerString (readonly)

Returns the resolved provider slug that can't complete the turn.

Returns:

  • (String)

    the resolved provider slug that can't complete the turn



118
119
120
# File 'lib/pikuri/agent.rb', line 118

def provider
  @provider
end