Documentation
¶
Index ¶
- Constants
- Variables
- type ChatMessageTemplateData
- type ModelLoader
- func (ml *ModelLoader) BackendLoader(opts ...Option) (model *grpc.Client, err error)
- func (ml *ModelLoader) EvaluateTemplateForChatMessage(templateName string, messageData ChatMessageTemplateData) (string, error)
- func (ml *ModelLoader) EvaluateTemplateForPrompt(templateType TemplateType, templateName string, in PromptTemplateData) (string, error)
- func (ml *ModelLoader) ExistsInModelPath(s string) bool
- func (ml *ModelLoader) GreedyLoader(opts ...Option) (*grpc.Client, error)
- func (ml *ModelLoader) ListModels() ([]string, error)
- func (ml *ModelLoader) LoadModel(modelName string, loader func(string) (*grpc.Client, error)) (*grpc.Client, error)
- func (ml *ModelLoader) StopGRPC()
- type Option
- func WithAssetDir(assetDir string) Option
- func WithBackendString(backend string) Option
- func WithContext(ctx context.Context) Option
- func WithExternalBackend(name string, uri string) Option
- func WithLoadGRPCLLMModelOpts(opts *pb.ModelOptions) Option
- func WithModelFile(modelFile string) Option
- func WithThreads(threads uint32) Option
- type Options
- type PromptTemplateData
- type TemplateType
Constants ¶
const ( LlamaBackend = "llama" BloomzBackend = "bloomz" StarcoderBackend = "starcoder" GPTJBackend = "gptj" DollyBackend = "dolly" MPTBackend = "mpt" GPTNeoXBackend = "gptneox" ReplitBackend = "replit" Gpt2Backend = "gpt2" Gpt4AllLlamaBackend = "gpt4all-llama" Gpt4AllMptBackend = "gpt4all-mpt" Gpt4AllJBackend = "gpt4all-j" Gpt4All = "gpt4all" FalconBackend = "falcon" FalconGGMLBackend = "falcon-ggml" LlamaGrammarBackend = "llama-grammar" BertEmbeddingsBackend = "bert-embeddings" RwkvBackend = "rwkv" WhisperBackend = "whisper" StableDiffusionBackend = "stablediffusion" PiperBackend = "piper" LCHuggingFaceBackend = "langchain-huggingface" )
Variables ¶
var AutoLoadBackends []string = []string{ LlamaBackend, Gpt4All, FalconBackend, GPTNeoXBackend, BertEmbeddingsBackend, LlamaGrammarBackend, FalconGGMLBackend, GPTJBackend, Gpt2Backend, DollyBackend, MPTBackend, ReplitBackend, StarcoderBackend, BloomzBackend, RwkvBackend, WhisperBackend, StableDiffusionBackend, PiperBackend, }
Functions ¶
This section is empty.
Types ¶
type ChatMessageTemplateData ¶ added in v1.22.0
type ChatMessageTemplateData struct {
SystemPrompt string
Role string
RoleName string
Content string
MessageIndex int
}
TODO: Ask mudler about FunctionCall stuff being useful at the message level?
type ModelLoader ¶
type ModelLoader struct {
ModelPath string
// contains filtered or unexported fields
}
TODO: Split ModelLoader and TemplateLoader? Just to keep things more organized. Left together to share a mutex until I look into that. Would split if we seperate directories for .bin/.yaml and .tmpl
func NewModelLoader ¶
func NewModelLoader(modelPath string) *ModelLoader
func (*ModelLoader) BackendLoader ¶ added in v1.7.0
func (ml *ModelLoader) BackendLoader(opts ...Option) (model *grpc.Client, err error)
func (*ModelLoader) EvaluateTemplateForChatMessage ¶ added in v1.22.0
func (ml *ModelLoader) EvaluateTemplateForChatMessage(templateName string, messageData ChatMessageTemplateData) (string, error)
func (*ModelLoader) EvaluateTemplateForPrompt ¶ added in v1.22.0
func (ml *ModelLoader) EvaluateTemplateForPrompt(templateType TemplateType, templateName string, in PromptTemplateData) (string, error)
func (*ModelLoader) ExistsInModelPath ¶
func (ml *ModelLoader) ExistsInModelPath(s string) bool
func (*ModelLoader) GreedyLoader ¶ added in v1.7.0
func (ml *ModelLoader) GreedyLoader(opts ...Option) (*grpc.Client, error)
func (*ModelLoader) ListModels ¶
func (ml *ModelLoader) ListModels() ([]string, error)
func (*ModelLoader) StopGRPC ¶ added in v1.21.0
func (ml *ModelLoader) StopGRPC()
type Option ¶ added in v1.21.0
type Option func(*Options)
func WithAssetDir ¶ added in v1.21.0
func WithBackendString ¶ added in v1.21.0
func WithContext ¶ added in v1.21.0
func WithExternalBackend ¶ added in v1.22.0
func WithLoadGRPCLLMModelOpts ¶ added in v1.21.0
func WithLoadGRPCLLMModelOpts(opts *pb.ModelOptions) Option
func WithModelFile ¶ added in v1.21.0
func WithThreads ¶ added in v1.21.0
type Options ¶ added in v1.21.0
type Options struct {
// contains filtered or unexported fields
}
func NewOptions ¶ added in v1.21.0
type PromptTemplateData ¶ added in v1.22.0
type PromptTemplateData struct {
Input string
Instruction string
Functions []grammar.Function
MessageIndex int
}
Rather than pass an interface{} to the prompt template: These are the definitions of all possible variables LocalAI will currently populate for use in a prompt template file Please note: Not all of these are populated on every endpoint - your template should either be tested for each endpoint you map it to, or tolerant of zero values.
type TemplateType ¶ added in v1.22.0
type TemplateType int
Keep this in sync with config.TemplateConfig. Is there a more idiomatic way to accomplish this in go? Technically, order doesn't _really_ matter, but the count must stay in sync, see tests/integration/reflect_test.go
const ( ChatPromptTemplate TemplateType = iota ChatMessageTemplate CompletionPromptTemplate EditPromptTemplate FunctionsPromptTemplate // The following TemplateType is **NOT** a valid value and MUST be last. It exists to make the sanity integration tests simpler! IntegrationTestTemplate )