Help us shape the future of Go! Take the 2026 Go Developer Survey

metadata

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package metadata stores experimental generation records. The format and reuse mechanism are provisional and subject to change.

Index

Constants

View Source
const (
	Synchronous  = "synchronous"
	Asynchronous = "asynchronous"
)

Response types describe the request's role, independently of HTTP timing.

  • Synchronous: a submission or direct download response
  • Asynchronous: a response to polling an existing operation
View Source
const (
	BinarySaved       = "[Bildomat: base64 data redacted for length; saved locally to %s]"
	BinaryUnavailable = "[Bildomat: base64 data unavailable; see persistence-errors]"
)

The internal/metadata section of the copy catalog, one constant per entry.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryField

type BinaryField struct {
	Path      []string
	MIMEField string
	MIME      string
}

BinaryField declares a base64 value at a JSON path; an asterisk matches one path segment.

  • Path: the property names or array indexes leading to the value
  • MIMEField: the optional sibling property that supplies the content type
  • MIME: the content type used when the sibling property supplies none

type Call

type Call struct {
	Method      string          `json:"method"`
	Endpoint    string          `json:"endpoint"`
	ContentType string          `json:"content-type,omitempty"`
	Payload     json.RawMessage `json:"payload"`
	Sent        time.Time       `json:"sent"`
	Error       string          `json:"error,omitempty"`
	// contains filtered or unexported fields
}

Call records an actual submitted request, excluding authentication headers.

  • Method, Endpoint: the HTTP method and request URL
  • ContentType: the submitted body type
  • Payload: the retained body, with binary content represented by references
  • Sent: the UTC request capture time
  • Error: the failure message when no response arrived

type File

type File struct {
	artifact.SavedFile

	MIME       string   `json:"content-type,omitempty"`
	References []string `json:"provider-references,omitempty"`
}

File describes generated media successfully saved to its final path.

  • SavedFile: the final path and byte count
  • MIME: the retained content type
  • References: the provider download URLs whose content matches the file

type Input

type Input struct {
	Source string   `json:"source"`
	MIME   string   `json:"content-type,omitempty"`
	Time   *float64 `json:"time,omitempty"`
	Frame  string   `json:"frame,omitempty"`
}

Input describes a prepared input; its data is retained through the submitted payload, without embedding the bytes a second time.

  • Source: the input path or URL
  • MIME: the prepared content type
  • Time: the optional frame time in seconds
  • Frame: the optional first or last frame selection

type Record

type Record struct {
	Schema            int           `json:"schema-version"`
	ID                string        `json:"generation-id"`
	Version           string        `json:"bildomat-version"`
	Provider          string        `json:"provider"`
	Model             string        `json:"model"`
	Started           time.Time     `json:"started"`
	Finished          time.Time     `json:"finished"`
	ElapsedMS         int64         `json:"elapsed-ms"`
	Status            string        `json:"status"`
	ProviderStatus    string        `json:"provider-status,omitempty"`
	Request           Request       `json:"request"`
	Artifacts         []File        `json:"artifacts"`
	Responses         []Response    `json:"provider-responses"`
	Returns           []ReturnValue `json:"return-values,omitempty"`
	Errors            []string      `json:"errors,omitempty"`
	PersistenceErrors []string      `json:"persistence-errors,omitempty"`
	// contains filtered or unexported fields
}

Record contains the retained facts of one generation. Its unexported state owns binary copies independently of provider artifact cleanup.

  • Schema: the record format version
  • ID: the generated identifier for this run
  • Version: the Bildomat version that produced the record
  • Provider, Model: the selected catalog identifiers
  • Started, Finished: the UTC execution times
  • ElapsedMS: the elapsed execution time in milliseconds
  • Status: the final status, including local persistence failures
  • ProviderStatus: the provider operation status before local persistence
  • Request: the supplied options, prepared inputs, and submitted requests
  • Artifacts: the successfully saved generated files
  • Responses: the provider responses in capture order
  • Returns: the provider data retained for later requests
  • Errors: the generation failure messages
  • PersistenceErrors: the record capture and persistence failure messages

func New

func New(provider, model, version, prompt string, started time.Time) *Record

New creates the record for one generation.

func Read

func Read(path string) (*Record, error)

Read loads a generation record and validates its schema and required fields.

func (*Record) Begin

func (record *Record) Begin(method, endpoint, contentType string, body []byte) int

Begin records the actual payload before a provider request is sent. A nil receiver leaves persistence disabled and returns an unused request index.

func (*Record) Describe

func (record *Record) Describe(supplied json.RawMessage, sources []string)

Describe assigns supplied options and input sources to the record without copying them.

func (*Record) Prepared

func (record *Record) Prepared(inputs []media.Input)

Prepared records the inputs actually passed to the request builder and makes unchanged local files available for exact-content matching during persistence.

func (*Record) ProviderFinished

func (record *Record) ProviderFinished(generationErr error)

ProviderFinished distinguishes provider execution from later local write errors.

func (*Record) Receive

func (record *Record) Receive(requestIndex int, responseType string, status int, contentType string, body []byte, captureErr error)

Receive records a response before execution narrows its JSON shape.

func (*Record) ReceiveFile

func (record *Record) ReceiveFile(requestIndex, status int, contentType, path string, captureErr error)

ReceiveFile retains a downloaded body independently of the artifact's temporary file. The saved response later references its actual final file.

func (*Record) RequestFailed

func (record *Record) RequestFailed(requestIndex int, requestErr error)

RequestFailed records a request that received no response.

func (*Record) Retain

func (record *Record) Retain(provider, model string, values json.RawMessage)

Retain adds provider-specific values for subsequent requests.

func (*Record) Save

func (record *Record) Save(dir, stem string, files []artifact.SavedFile, generationErr error) (string, error)

Save finishes the record and writes it beside the supplied final artifact paths. It also saves unmatched binary content and returns the record path with any persistence errors.

func (*Record) SetFields

func (record *Record) SetFields(requestFields, responseFields []BinaryField)

SetFields assigns provider-declared binary fields to the record without copying the slices. Explicit data URIs are recognized even without a declaration.

type Request

type Request struct {
	Prompt      string          `json:"prompt"`
	Supplied    json.RawMessage `json:"supplied-parameters,omitempty"`
	Adjusted    json.RawMessage `json:"adjusted-parameters,omitempty"`
	Adjustments json.RawMessage `json:"adjustments,omitempty"`
	Sources     []string        `json:"input-sources,omitempty"`
	Inputs      []Input         `json:"prepared-inputs,omitempty"`
	Calls       []Call          `json:"provider-requests"`
}

Request distinguishes the supplied options, adjusted options, prepared inputs, and exact submitted HTTP payloads of one generation.

  • Prompt: the submitted prompt
  • Supplied, Adjusted: the options before and after conformance
  • Adjustments: the recorded parameter changes
  • Sources: the supplied input paths or URLs
  • Inputs: the media prepared for submission
  • Calls: the provider requests in submission order

type Response

type Response struct {
	Type         string          `json:"type"`
	RequestIndex int             `json:"request-index"`
	Endpoint     string          `json:"endpoint"`
	Status       int             `json:"status"`
	ContentType  string          `json:"content-type,omitempty"`
	Received     time.Time       `json:"received"`
	Body         json.RawMessage `json:"full-response"`
	Incomplete   bool            `json:"incomplete,omitempty"`
	CaptureError string          `json:"capture-error,omitempty"`
	DecodeError  string          `json:"decode-error,omitempty"`
	// contains filtered or unexported fields
}

Response retains one full provider body before its execution-specific decode.

  • Type: the synchronous or asynchronous request role
  • RequestIndex: the index of the request in Request.Calls
  • Endpoint: the associated request URL
  • Status: the HTTP response status
  • ContentType: the returned body type
  • Received: the UTC response capture time
  • Body: the full retained body, with binary content represented by references
  • Incomplete: whether capturing the response failed
  • CaptureError: the response read failure message
  • DecodeError: the JSON decode failure for a non-JSON response

type ReturnValue

type ReturnValue struct {
	Provider string          `json:"provider"`
	Model    string          `json:"model"`
	Data     json.RawMessage `json:"retained-data"`
}

ReturnValue keeps a provider's own retained shape separate from generic facts.

  • Provider, Model: the catalog identifiers associated with the retained data
  • Data: the provider-specific values available for reuse

type Reuse

type Reuse struct {
	URI    string
	Record *Record
}

Reuse contains one provisional reuse selection loaded by the command. Its syntax and retained format are experimental and subject to change.

  • URI: the selected original provider resource URL
  • Record: the source generation record, when one was supplied

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL