Class: ActiveAgent::Providers::Common::Responses::Prompt

Inherits:
Base
  • Object
show all
Defined in:
lib/active_agent/providers/common/responses/prompt.rb

Overview

Response model for prompt/completion responses

This class represents responses from conversational/completion endpoints. It includes the generated messages, the original context, raw API data, and usage statistics.

Example

response = PromptResponse.new(
  context: context_hash,
  messages: [message_object],
  raw_response: { "usage" => { "prompt_tokens" => 10 } }
)

response.message        #=> <Message>
response.prompt_tokens  #=> 10
response.usage          #=> { "prompt_tokens" => 10, ... }

Instance Attribute Summary

Attributes inherited from Base

#context, #raw_request, #raw_response, #usages

Instance Method Summary collapse

Methods inherited from Base

#finish_reason, #id, #initialize, #instructions, #model, #success?, #usage

Methods inherited from BaseModel

#<=>, #==, attribute, #deep_compact, #deep_dup, delegate_attributes, drop_attributes, inherited, #initialize, #inspect, keys, #merge!, required_attributes, #serialize, #to_h, #to_hash

Constructor Details

This class inherits a constructor from ActiveAgent::Providers::Common::Responses::Base

Instance Method Details

#messageObject

The most recent message in the conversational stack



35
36
37
# File 'lib/active_agent/providers/common/responses/prompt.rb', line 35

def message
  messages.last
end