Module: Braintrust::Internal::Origin

Defined in:
lib/braintrust/internal/origin.rb

Overview

Origin provides serialization for source object pointers in Braintrust. Used internally to link spans back to their source records (e.g., dataset rows).

Class Method Summary collapse

Class Method Details

.to_json(object_type:, object_id:, id:, xact_id:, created:) ⇒ String

Serialize an origin pointer to JSON

Parameters:

  • object_type (String)

    Type of source object (e.g., “dataset”, “playground_logs”)

  • object_id (String)

    ID of the source object

  • id (String)

    ID of the specific record within the source

  • xact_id (String)

    Transaction ID

  • created (String, nil)

    Creation timestamp

Returns:

  • (String)

    JSON-serialized origin



17
18
19
20
21
22
23
24
25
# File 'lib/braintrust/internal/origin.rb', line 17

def self.to_json(object_type:, object_id:, id:, xact_id:, created:)
  JSON.dump({
    object_type: object_type,
    object_id: object_id,
    id: id,
    _xact_id: xact_id,
    created: created
  })
end