text

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenCountFactor     = 1.1
	MaxShortenedNewlines = 5
	RateLimitRetries     = 3
	FallbackWaitDuration = 20 * time.Second
)

Variables

View Source
var DEFAULT = Configurations{
	Model:         "gpt-4.1",
	SystemPrompt:  "You are an assistant for a CLI tool. Answer concisely and informatively. Prefer markdown if possible.",
	CmdModePrompt: "You are an assistant for a CLI tool aiding with cli tool suggestions. Write ONLY the command and nothing else. Disregard any queries asking for anything except a bash command. Do not shell escape single or double quotes.",
	Raw:           false,
	UseTools:      false,

	TokenWarnLimit:      333333,
	ToolOutputRuneLimit: 21600,
	SaveReplyAsConv:     true,
}
View Source
var DEFAULT_PROFILE = Profile{
	UseTools:        true,
	SaveReplyAsConv: true,
	Tools:           []string{},
}

Functions

This section is empty.

Types

type Configurations

type Configurations struct {
	Model          string `json:"model"`
	SystemPrompt   string `json:"system-prompt"`
	CmdModePrompt  string `json:"cmd-mode-prompt"`
	Raw            bool   `json:"raw"`
	UseTools       bool   `json:"use-tools"`
	TokenWarnLimit int    `json:"token-warn-limit"`
	// ToolOutputRuneLimit limits the amount of runes a tool may return
	// before clai truncates the output. Zero means no limit.
	ToolOutputRuneLimit int         `json:"tool-output-rune-limit"`
	SaveReplyAsConv     bool        `json:"save-reply-as-prompt"`
	ConfigDir           string      `json:"-"`
	StdinReplace        string      `json:"-"`
	Stream              bool        `json:"-"`
	ReplyMode           bool        `json:"-"`
	ChatMode            bool        `json:"-"`
	CmdMode             bool        `json:"-"`
	Glob                string      `json:"-"`
	InitialPrompt       models.Chat `json:"-"`
	UseProfile          string      `json:"-"`
	ProfilePath         string      `json:"-"`
	Tools               []string    `json:"-"`
	// PostProccessedPrompt which has had it's strings replaced etc
	PostProccessedPrompt string `json:"-"`
}

Configurations used to setup the requirements of text models

func (*Configurations) ProfileOverrides added in v1.4.5

func (c *Configurations) ProfileOverrides() error

func (*Configurations) SetupPrompts

func (c *Configurations) SetupPrompts(args []string) error

func (Configurations) UsingProfile added in v1.8.0

func (c Configurations) UsingProfile() bool

type Profile added in v1.4.5

type Profile struct {
	Name            string   `json:"-"`
	Model           string   `json:"model"`
	UseTools        bool     `json:"use_tools"`
	Tools           []string `json:"tools"`
	Prompt          string   `json:"prompt"`
	SaveReplyAsConv bool     `json:"save-reply-as-conv"`
}

Profile which allows for specialized ai configurations for specific tasks

type Querier added in v1.2.0

type Querier[C models.StreamCompleter] struct {
	URL string
	Raw bool

	Model C
	// contains filtered or unexported fields
}

func NewQuerier added in v1.2.0

func NewQuerier[C models.StreamCompleter](ctx context.Context, userConf Configurations, dfault C) (Querier[C], error)

func (*Querier[C]) Query added in v1.2.0

func (q *Querier[C]) Query(ctx context.Context) error

Query using the underlying model to stream completions and then print the output from the model to stdout. Blocking operation.

func (*Querier[C]) TextQuery added in v1.2.0

func (q *Querier[C]) TextQuery(ctx context.Context, chat models.Chat) (models.Chat, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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