Documentation
¶
Overview ¶
Package llamacpp provides support for working with models using llamacpp.
Index ¶
- func InstallLlama(libPath string, processor download.Processor, allowUpgrade bool) error
- func InstallModel(modelURL string, modelPath string) (string, error)
- func WithProjection(projFile string) func(m *model) error
- type ChatMessage
- type ChatResponse
- type Config
- type Llama
- func (llm *Llama) ChatCompletions(ctx context.Context, messages []ChatMessage, params Params) (<-chan ChatResponse, error)
- func (llm *Llama) ChatVision(ctx context.Context, message ChatMessage, imageFile string, params Params) (<-chan ChatResponse, error)
- func (llm *Llama) Embed(ctx context.Context, text string) ([]float32, error)
- func (llm *Llama) ModelInfo(ctx context.Context) (ModelInfo, error)
- func (llm *Llama) ModelName() string
- func (llm *Llama) Rerank(rankingDocs []RankingDocument) ([]Ranking, error)
- func (llm *Llama) Unload()
- type LogType
- type ModelInfo
- type Params
- type Ranking
- type RankingDocument
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallLlama ¶
func WithProjection ¶
Types ¶
type ChatMessage ¶
ChatMessage represent input for chat and vision models.
type ChatResponse ¶
ChatResponse represents output for chat and vision models.
type Llama ¶
type Llama struct {
// contains filtered or unexported fields
}
Llama represents a concurrency group of a specified model.
func New ¶
func New(concurrency int, libPath string, modelFile string, cfg Config, options ...func(llg *model) error) (*Llama, error)
New provides the ability to use models in a concurrently safe way.
func (*Llama) ChatCompletions ¶
func (llm *Llama) ChatCompletions(ctx context.Context, messages []ChatMessage, params Params) (<-chan ChatResponse, error)
ChatCompletions provides support to interact with an inference model. It will block until a model becomes available or the context times out.
func (*Llama) ChatVision ¶
func (llm *Llama) ChatVision(ctx context.Context, message ChatMessage, imageFile string, params Params) (<-chan ChatResponse, error)
ChatVision provides support to interact with a vision language model. It will block until a model becomes available or the context times out.
func (*Llama) Embed ¶
Embed provides support to interact with an embedding model. It will block until a model becomes available or the context times out.
type ModelInfo ¶
type ModelInfo struct {
Desc string
Size uint64
HasEncoder bool
HasDecoder bool
IsRecurrent bool
IsHybrid bool
Metadata map[string]string
}
ModelInfo represents the model's card information.
type RankingDocument ¶
RankingDocument represents input for reranking.