scriptedtest

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultModelName is what the catalog exposes when a script names no model; it says "test" so every surface that prints a model name says it too.
	DefaultModelName = "scripted-test"
)

Variables

This section is empty.

Functions

func ResolvePath

func ResolvePath(baseURL string) (string, error)

ResolvePath accepts a bare path or a "file://" URL.

Types

type Capabilities

type Capabilities struct {
	Chat   *bool `json:"chat,omitempty"`
	Stream *bool `json:"stream,omitempty"`
	Prompt *bool `json:"prompt,omitempty"`
	Embed  *bool `json:"embed,omitempty"`
	Think  *bool `json:"think,omitempty"`
	Vision *bool `json:"vision,omitempty"`
	Audio  *bool `json:"audio,omitempty"`
}

type Provider

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

func NewProvider

func NewProvider(modelName, scriptPath string, caps modelrepo.CapabilityConfig, embedDimensions int, tracker libtracker.ActivityTracker) *Provider

func (*Provider) CanAudio

func (p *Provider) CanAudio() bool

func (*Provider) CanChat

func (p *Provider) CanChat() bool

func (*Provider) CanEmbed

func (p *Provider) CanEmbed() bool

func (*Provider) CanPrompt

func (p *Provider) CanPrompt() bool

func (*Provider) CanStream

func (p *Provider) CanStream() bool

func (*Provider) CanThink

func (p *Provider) CanThink() bool

func (*Provider) CanVision

func (p *Provider) CanVision() bool

func (*Provider) GetBackendIDs

func (p *Provider) GetBackendIDs() []string

func (*Provider) GetChatConnection

func (p *Provider) GetChatConnection(ctx context.Context, backendID string) (modelrepo.LLMChatClient, error)

func (*Provider) GetContextLength

func (p *Provider) GetContextLength() int

func (*Provider) GetEmbedConnection

func (p *Provider) GetEmbedConnection(ctx context.Context, backendID string) (modelrepo.LLMEmbedClient, error)

func (*Provider) GetID

func (p *Provider) GetID() string

func (*Provider) GetMaxOutputTokens

func (p *Provider) GetMaxOutputTokens() int

func (*Provider) GetPromptConnection

func (p *Provider) GetPromptConnection(ctx context.Context, backendID string) (modelrepo.LLMPromptExecClient, error)

func (*Provider) GetStreamConnection

func (p *Provider) GetStreamConnection(ctx context.Context, backendID string) (modelrepo.LLMStreamClient, error)

func (*Provider) GetType

func (p *Provider) GetType() string

func (*Provider) ModelName

func (p *Provider) ModelName() string

type Script

type Script struct {
	Path            string
	Model           string
	ContextLength   int
	MaxOutputTokens int
	EmbedDimensions int
	Capabilities    Capabilities
	Turns           []Turn
	// contains filtered or unexported fields
}

Script replays one recorded dialog; its cursor is process-global per file, so consecutive model turns are consumed in order across the whole chain run.

func Load

func Load(path string) (*Script, error)

Load returns the shared Script for path, reloading (and rewinding) it whenever the file changed on disk.

func Parse

func Parse(path string, raw []byte) (*Script, error)

func (*Script) Next

func (s *Script) Next(operation string) (Turn, int, error)

Next consumes the turn the dialog is standing on; past the last turn it fails naming the script and the turn index instead of inventing a reply.

func (*Script) Position

func (s *Script) Position() int

type ToolCall

type ToolCall struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
	// Arguments is a JSON object, or a JSON string holding raw argument text.
	Arguments json.RawMessage `json:"arguments,omitempty"`
}

type Turn

type Turn struct {
	Text         string     `json:"text,omitempty"`
	Thinking     string     `json:"thinking,omitempty"`
	ToolCalls    []ToolCall `json:"tool_calls,omitempty"`
	FinishReason string     `json:"finish_reason,omitempty"`
	Usage        *Usage     `json:"usage,omitempty"`
}

type Usage

type Usage struct {
	PromptTokens     int `json:"prompt_tokens,omitempty"`
	CompletionTokens int `json:"completion_tokens,omitempty"`
	TotalTokens      int `json:"total_tokens,omitempty"`
}

Jump to

Keyboard shortcuts

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