Module: Braintrust::Internal::Origin

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

Overview

Origin builds source object pointers, which link spans back to the record they came from (e.g., a dataset row). Pointers stay Hashes internally and are serialized once at the boundary that needs them, so that inbound pointers from the wire and ones we build here have the same shape.

Class Method Summary collapse

Class Method Details

.build(object_type:, object_id:, id:, xact_id:, created:) ⇒ Hash

Build an origin pointer

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:

  • (Hash) —

    Origin pointer with string keys, matching the wire format



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

def self.build(object_type:, object_id:, id:, xact_id:, created:)
  {
    "object_type" => object_type,
    "object_id" => object_id,
    "id" => id,
    "_xact_id" => xact_id,
    "created" => created
  }
end