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

models

package
v1.47.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package models owns model-list selection and interactive presentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(root *cli.Command, policy Options)

Configure installs model-list flags and the loading/selection lifecycle.

func Interrupt

func Interrupt(err error) error

Interrupt preserves the models command's process status after viewer cancellation.

func IsListSource

func IsListSource[T any](source jsonview.Iterator[T]) bool

IsListSource admits only the SDK single-response pager or selected records. Cursor pagers must remain lazy even if operation metadata says models.

func RenderTable

func RenderTable(ctx context.Context, items []gjson.Result, width int, diagnostics bool, style listview.Style) (string, bool, error)

RenderTable lists IDs and owners. Explicit machine formats retain complete records through their existing presentation paths.

func Select

func Select[T any](ctx context.Context, source jsonview.Iterator[T], maximum int64) (context.Context, jsonview.Iterator[clioutput.JSON], bool, error)

Select uses only the SDK's already-loaded models response. Cursor pagers must never enter a path that collects all their pages before displaying data.

func ShowPages added in v1.45.0

func ShowPages(opts listview.Options, client openai.Client, options []option.RequestOption, diagnostics bool) error

ShowPages opens the terminal before requesting page one. The pager owns and joins the request worker, including when the user quits during a body read.

func StopLoading

func StopLoading(ctx context.Context)

StopLoading joins loading feedback before results write to the terminal.

func WriteList

func WriteList[T any](iter *clioutput.Iterator[T], opts listview.Options, width, height int, diagnostics bool) error

WriteList opens the pager for loaded terminal records, including short and empty results.

Types

type ListError

type ListError struct {
	// contains filtered or unexported fields
}

ListError contains only fixed guidance, never filter values or response data.

func (*ListError) Error

func (e *ListError) Error() string

type LoadingInterrupt

type LoadingInterrupt struct {
	// contains filtered or unexported fields
}

LoadingInterrupt retains cancellation and the command interrupt exit status.

func (*LoadingInterrupt) ExitCode

func (e *LoadingInterrupt) ExitCode() int

func (*LoadingInterrupt) Unwrap

func (e *LoadingInterrupt) Unwrap() error

type Options

type Options struct {
	ShowPages      func(context.Context, *cli.Command) (bool, error)
	LoadingAllowed func(*cli.Command) bool
	// StartFeedback returns a non-nil, idempotent stop function that joins its worker.
	StartFeedback func(context.Context, *cli.Command) func()
}

Options supplies application policy without coupling model behavior to assembly.

Jump to

Keyboard shortcuts

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