usermodel

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: BSD-3-Clause Imports: 6 Imported by: 16

README

usermodel

Given a task string (like code-completion), return the user-configured Ollama model for this task.

The user-configured Ollama model is found by executing llm-manager.

If no user-configured model is available, return a default model.

Example use
package main

import (
    "fmt"

    "github.com/xyproto/usermodel"
)

func main() {
    fmt.Println(usermodel.GetVisionModel())
}
Exported types
type Task string
Exported constants
ChatTask           = "chat"
CodeTask           = "code"
CodeCompletionTask = "code-completion"
TestTask           = "test"
TextGenerationTask = "text-generation"
ToolUseTask        = "tool-use"
TranslationTask    = "translation"
VisionTask         = "vision"
Exported functions
func AvailableTasks() []Task
func GetChatModel() string
func GetCodeModel() string
func GetCodeCompletionModel() string
func GetTestModel() string
func GetTextGenerationModel() string
func GetToolUseModel() string
func GetTranslationModel() string
func GetVisionModel() string
func Get(task Task) string
General info

Documentation

Index

Constants

View Source
const (

	// Tasks
	ChatTask           = "chat"
	CodeTask           = "code"
	CodeCompletionTask = "code-completion"
	TestTask           = "test"
	TextGenerationTask = "text-generation"
	ToolUseTask        = "tool-use"
	TranslationTask    = "translation"
	VisionTask         = "vision"
)

Variables

View Source
var (
	DefaultModels = map[Task]string{
		"chat":            "llama3.2:3b",
		"code":            "deepseek-coder:1.3b",
		"code-completion": "deepseek-coder:1.3b",
		"test":            "tinyllama:1b",
		"text-generation": "gemma2:2b",
		"tool-use":        "llama3.2:3b",
		"translation":     "mixtral:8x7b",
		"vision":          "llava:7b",
	}
)

Functions

func Get

func Get(task Task) string

Get attempts to retrieve the model name using llm-manager. If llm-manager is not available or the command fails, it falls back to the Default*Model variables.

func GetChatModel

func GetChatModel() string

func GetCodeCompletionModel

func GetCodeCompletionModel() string

func GetCodeModel added in v1.2.0

func GetCodeModel() string

func GetTestModel

func GetTestModel() string

func GetTextGenerationModel

func GetTextGenerationModel() string

func GetToolUseModel

func GetToolUseModel() string

func GetTranslationModel

func GetTranslationModel() string

func GetVisionModel added in v1.0.1

func GetVisionModel() string

Types

type Task

type Task string

func AvailableTasks

func AvailableTasks() []Task

Directories

Path Synopsis
cmd
example command

Jump to

Keyboard shortcuts

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