api_config

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PredictionOptions `yaml:"parameters"`
	Name              string            `yaml:"name"`
	StopWords         []string          `yaml:"stopwords"`
	Cutstrings        []string          `yaml:"cutstrings"`
	TrimSpace         []string          `yaml:"trimspace"`
	ContextSize       int               `yaml:"context_size"`
	F16               bool              `yaml:"f16"`
	NUMA              bool              `yaml:"numa"`
	Threads           int               `yaml:"threads"`
	Debug             bool              `yaml:"debug"`
	Roles             map[string]string `yaml:"roles"`
	Embeddings        bool              `yaml:"embeddings"`
	Backend           string            `yaml:"backend"`
	TemplateConfig    TemplateConfig    `yaml:"template"`
	MirostatETA       float64           `yaml:"mirostat_eta"`
	MirostatTAU       float64           `yaml:"mirostat_tau"`
	Mirostat          int               `yaml:"mirostat"`
	NGPULayers        int               `yaml:"gpu_layers"`
	MMap              bool              `yaml:"mmap"`
	MMlock            bool              `yaml:"mmlock"`
	LowVRAM           bool              `yaml:"low_vram"`

	TensorSplit           string `yaml:"tensor_split"`
	MainGPU               string `yaml:"main_gpu"`
	ImageGenerationAssets string `yaml:"asset_dir"`

	PromptCachePath string `yaml:"prompt_cache_path"`
	PromptCacheAll  bool   `yaml:"prompt_cache_all"`
	PromptCacheRO   bool   `yaml:"prompt_cache_ro"`

	Grammar string `yaml:"grammar"`

	PromptStrings, InputStrings []string
	InputToken                  [][]int

	FunctionsConfig Functions `yaml:"function"`

	SystemPrompt string `yaml:"system_prompt"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig(modelFile string) *Config

func ReadConfig

func ReadConfig(file string) (*Config, error)

func ReadConfigFile

func ReadConfigFile(file string) ([]*Config, error)

func (*Config) FunctionToCall

func (c *Config) FunctionToCall() string

func (*Config) SetFunctionCallNameString

func (c *Config) SetFunctionCallNameString(s string)

func (*Config) SetFunctionCallString

func (c *Config) SetFunctionCallString(s string)

func (*Config) ShouldCallSpecificFunction

func (c *Config) ShouldCallSpecificFunction() bool

func (*Config) ShouldUseFunctions

func (c *Config) ShouldUseFunctions() bool

type ConfigLoader

type ConfigLoader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConfigLoader

func NewConfigLoader() *ConfigLoader

func (*ConfigLoader) GetAllConfigs added in v1.23.1

func (cm *ConfigLoader) GetAllConfigs() []Config

func (*ConfigLoader) GetConfig

func (cm *ConfigLoader) GetConfig(m string) (Config, bool)

func (*ConfigLoader) ListConfigs

func (cm *ConfigLoader) ListConfigs() []string

func (*ConfigLoader) LoadConfig

func (cm *ConfigLoader) LoadConfig(file string) error

func (*ConfigLoader) LoadConfigFile

func (cm *ConfigLoader) LoadConfigFile(file string) error

func (*ConfigLoader) LoadConfigs

func (cm *ConfigLoader) LoadConfigs(path string) error

type Functions

type Functions struct {
	DisableNoAction         bool   `yaml:"disable_no_action"`
	NoActionFunctionName    string `yaml:"no_action_function_name"`
	NoActionDescriptionName string `yaml:"no_action_description_name"`
}

type PredictionOptions

type PredictionOptions struct {

	// Also part of the OpenAI official spec
	Model string `json:"model" yaml:"model"`

	// Also part of the OpenAI official spec
	Language string `json:"language"`

	// Also part of the OpenAI official spec. use it for returning multiple results
	N int `json:"n"`

	// Common options between all the API calls, part of the OpenAI spec
	TopP        float64 `json:"top_p" yaml:"top_p"`
	TopK        int     `json:"top_k" yaml:"top_k"`
	Temperature float64 `json:"temperature" yaml:"temperature"`
	Maxtokens   int     `json:"max_tokens" yaml:"max_tokens"`
	Echo        bool    `json:"echo"`

	// Custom parameters - not present in the OpenAI API
	Batch         int     `json:"batch" yaml:"batch"`
	F16           bool    `json:"f16" yaml:"f16"`
	IgnoreEOS     bool    `json:"ignore_eos" yaml:"ignore_eos"`
	RepeatPenalty float64 `json:"repeat_penalty" yaml:"repeat_penalty"`
	Keep          int     `json:"n_keep" yaml:"n_keep"`

	MirostatETA float64 `json:"mirostat_eta" yaml:"mirostat_eta"`
	MirostatTAU float64 `json:"mirostat_tau" yaml:"mirostat_tau"`
	Mirostat    int     `json:"mirostat" yaml:"mirostat"`

	FrequencyPenalty float64 `json:"frequency_penalty" yaml:"frequency_penalty"`
	TFZ              float64 `json:"tfz" yaml:"tfz"`

	TypicalP float64 `json:"typical_p" yaml:"typical_p"`
	Seed     int     `json:"seed" yaml:"seed"`

	NegativePrompt      string  `json:"negative_prompt" yaml:"negative_prompt"`
	RopeFreqBase        float32 `json:"rope_freq_base" yaml:"rope_freq_base"`
	RopeFreqScale       float32 `json:"rope_freq_scale" yaml:"rope_freq_scale"`
	NegativePromptScale float32 `json:"negative_prompt_scale" yaml:"negative_prompt_scale"`
}

type TemplateConfig

type TemplateConfig struct {
	Chat        string `yaml:"chat"`
	ChatMessage string `yaml:"chat_message"`
	Completion  string `yaml:"completion"`
	Edit        string `yaml:"edit"`
	Functions   string `yaml:"function"`
}

Jump to

Keyboard shortcuts

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