Class: PromptBuilder::Serializers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/prompt_builder/serializers/base.rb

Overview

Base class for format serializers. Provides a common interface for exporting sessions and parsing responses in alternate API formats.

Class Method Summary collapse

Class Method Details

.parse_response(hash) ⇒ Response

Parse a response from the target format into an PromptBuilder::Response.

Parameters:

  • hash (Hash)

    the response hash in the target format

Returns:



21
22
23
# File 'lib/prompt_builder/serializers/base.rb', line 21

def parse_response(hash)
  deserialize_response(hash)
end

.request_payload(session) ⇒ Hash

Export a session to the target format’s request payload.

Parameters:

  • session (Session)

    the session to export

Returns:

  • (Hash)

    the serialized request payload



13
14
15
# File 'lib/prompt_builder/serializers/base.rb', line 13

def request_payload(session)
  serialize_request(session)
end