skills

package
v0.3.71 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

README

SKILLS

Skills are containers for:

  • PROMPT packages
  • JSON file with configuration (index.json)
  • SYSTEM txt file to specialize the model

A skill is loaded from al LLM controller and instruct the model about a behavior

DIR STRUCTURE

  • skill 1
    • prompt 1
      • IT prompt language
      • EN prompt language
    • prompt 2
      • IT
    • prompt 3
      • IT
      • EN
      • ES
  • skill 2
    • ...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Skill

type Skill struct {
	// contains filtered or unexported fields
}

func LoadSkill

func LoadSkill(dir string) (instance *Skill, err error)

func NewSkill

func NewSkill(args ...interface{}) (instance *Skill, err error)

func (*Skill) AddKnowledge

func (instance *Skill) AddKnowledge(filename, content string) *Skill

func (*Skill) Clone

func (instance *Skill) Clone() (response *Skill)

Clone creates a copy of the current Skill instance with a unique UID and cloned properties.

func (*Skill) Deploy

func (instance *Skill) Deploy() (err error)

func (*Skill) Description

func (instance *Skill) Description() (response string)

func (*Skill) GetSystemRendered

func (instance *Skill) GetSystemRendered() (response string)

func (*Skill) IsOpened

func (instance *Skill) IsOpened() (response bool)

func (*Skill) Knowledge

func (instance *Skill) Knowledge() (response map[string]string)

func (*Skill) KnowledgeKeys

func (instance *Skill) KnowledgeKeys() (response []string)

func (*Skill) KnowledgeNames

func (instance *Skill) KnowledgeNames() (response []string)

KnowledgeNames extracts and returns a list of knowledge resource names derived from knowledge keys in the Skill instance. The list is an array of "collection" names

func (*Skill) Map

func (instance *Skill) Map() (response map[string]interface{})

func (*Skill) Model

func (instance *Skill) Model() (response string)

func (*Skill) ModelOptions

func (instance *Skill) ModelOptions() (response map[string]interface{})

func (*Skill) ModelOptionsValue

func (instance *Skill) ModelOptionsValue(field string) (response interface{})

func (*Skill) ModelOptionsValueAsString

func (instance *Skill) ModelOptionsValueAsString(field string) (response string)

func (*Skill) Name

func (instance *Skill) Name() (response string)

func (*Skill) Open

func (instance *Skill) Open() (err error)

func (*Skill) Options

func (instance *Skill) Options() (response *SkillOptions)

func (*Skill) PromptGet added in v0.3.71

func (instance *Skill) PromptGet(uid, lang string) (response *prompts.Prompt, err error)

func (*Skill) PromptGetText added in v0.3.71

func (instance *Skill) PromptGetText(uid, lang string) (response string)

func (*Skill) PromptReset

func (instance *Skill) PromptReset() *Skill

func (*Skill) Prompts

func (instance *Skill) Prompts() (response *prompts.PromptPackages)

func (*Skill) RagOptions

func (instance *Skill) RagOptions() (response map[string]interface{})

func (*Skill) Root

func (instance *Skill) Root() (response string)

func (*Skill) SetDescription

func (instance *Skill) SetDescription(v string) *Skill

func (*Skill) SetModel

func (instance *Skill) SetModel(v string) *Skill

func (*Skill) SetName

func (instance *Skill) SetName(v string) *Skill

func (*Skill) SetOverwrite

func (instance *Skill) SetOverwrite(v bool) *Skill

func (*Skill) SetRAGContext

func (instance *Skill) SetRAGContext(data []map[string]interface{}, userPayload map[string]interface{}, rawOptions map[string]interface{}, field string)

func (*Skill) SetRoot

func (instance *Skill) SetRoot(v string) *Skill

SetRoot sets the root directory for the Skill instance. If the provided directory name differs from the instance's name, it concatenates the name with the provided path. Returns the Skill instance.

func (*Skill) SetRootVector

func (instance *Skill) SetRootVector(v string) *Skill

func (*Skill) SetSystem

func (instance *Skill) SetSystem(v string) *Skill

func (*Skill) SetUid

func (instance *Skill) SetUid(v string) *Skill

func (*Skill) String

func (instance *Skill) String() string

func (*Skill) System

func (instance *Skill) System() (response string)

func (*Skill) Uid

func (instance *Skill) Uid() (response string)

type SkillActionOptions

type SkillActionOptions struct {
	Name        string `json:"name"`        // name of this action
	Description string `json:"description"` // description of this action
	Command     string `json:"command"`     // command to perform
}

func (*SkillActionOptions) Map

func (instance *SkillActionOptions) Map() (response map[string]interface{})

func (*SkillActionOptions) String

func (instance *SkillActionOptions) String() (response string)

type SkillOptions

type SkillOptions struct {
	Uid          string                 `json:"uid"`           // unique identifier
	Name         string                 `json:"name"`          // name of this skill
	Description  string                 `json:"description"`   // description of this skill
	Overwrite    bool                   `json:"overwrite"`     // overwrite prompts on deploy
	Model        string                 `json:"model"`         // required model
	System       string                 `json:"system"`        // filename or text for context refining
	ModelOptions map[string]interface{} `json:"model_options"` // optional parameters for model
	RagOptions   map[string]interface{} `json:"rag_options"`   // optional parameters for rag
	Parameters   map[string]interface{} `json:"parameters"`    // skill parameters
	Actions      []*SkillActionOptions  `json:"actions"`       // defines the list of actions that the skill can perform.
}

func NewSkillOptions

func NewSkillOptions(args ...interface{}) (instance *SkillOptions, err error)

func (*SkillOptions) Clone

func (instance *SkillOptions) Clone() (response *SkillOptions)

func (*SkillOptions) Map

func (instance *SkillOptions) Map() (response map[string]interface{})

func (*SkillOptions) String

func (instance *SkillOptions) String() (response string)

type Skills

type Skills struct {
	// contains filtered or unexported fields
}

func NewSkills

func NewSkills(root string) (instance *Skills, err error)

func (*Skills) Add

func (instance *Skills) Add(v interface{}) (response *Skills)

func (*Skills) Clone

func (instance *Skills) Clone(uid string) (response *Skill)

func (*Skills) Contains

func (instance *Skills) Contains(uid string) bool

func (*Skills) Count

func (instance *Skills) Count() int

func (*Skills) Deploy

func (instance *Skills) Deploy() (err error)

Deploy initializes and deploys all skills within the Skills struct. It creates the root directory if it does not exist and calls the Deploy method for each skill. Returns an error if directory creation or skill deployment fails.

func (*Skills) ForEach

func (instance *Skills) ForEach(f func(skill *Skill) error) (err error)

func (*Skills) Get

func (instance *Skills) Get(uid string) (skill *Skill)

func (*Skills) GetAll

func (instance *Skills) GetAll(skillUid, promptName, promptLang string) (skill *Skill, prompt *prompts.Prompt)

GetAll retrieves a skill and a corresponding prompt based on the provided skill UID, prompt name, and prompt language. It locks the instance for thread safety and ensures the skill and prompt exist before returning them.

func (*Skills) Has

func (instance *Skills) Has(uid string) bool

func (*Skills) Knowledge

func (instance *Skills) Knowledge(detailed bool) (response []map[string]interface{})

func (*Skills) List

func (instance *Skills) List() (response []map[string]interface{})

func (*Skills) Map

func (instance *Skills) Map() (response map[string]interface{})

func (*Skills) Names

func (instance *Skills) Names() (response []string)

func (*Skills) NewSkill

func (instance *Skills) NewSkill(uid string) (skill *Skill, err error)

func (*Skills) NewSkillFromDir

func (instance *Skills) NewSkillFromDir(dir string) (skill *Skill, err error)

func (*Skills) NewSkillFromPackage

func (instance *Skills) NewSkillFromPackage(pkg *prompts.PromptPackage) (skill *Skill, err error)

func (*Skills) NewSkillWithPrompts

func (instance *Skills) NewSkillWithPrompts(prompts *prompts.PromptPackages) (skill *Skill, err error)

func (*Skills) Overwrite

func (instance *Skills) Overwrite() bool

func (*Skills) PackageNames

func (instance *Skills) PackageNames() (response []string)

func (*Skills) PromptCount

func (instance *Skills) PromptCount() (response int)

func (*Skills) PromptGet

func (instance *Skills) PromptGet(skillName, packageName, promptName, lang string) (response *prompts.Prompt)

func (*Skills) PromptGetDefault

func (instance *Skills) PromptGetDefault(promptName string) (response *prompts.Prompt)

func (*Skills) PromptHasUpload

func (instance *Skills) PromptHasUpload(skillName string) (response bool)

PromptHasUpload checks if a given skill has an associated upload prompt available. Returns true if it exists.

func (*Skills) PromptNames

func (instance *Skills) PromptNames() (response []string)

func (*Skills) PromptNamesFromPackage

func (instance *Skills) PromptNamesFromPackage(packageName string) (response []string)

func (*Skills) PromptNamesMap

func (instance *Skills) PromptNamesMap() (response []map[string]interface{})

func (*Skills) Root

func (instance *Skills) Root() string

func (*Skills) SetOverwrite

func (instance *Skills) SetOverwrite(v bool) *Skills

func (*Skills) SetRoot

func (instance *Skills) SetRoot(v string) *Skills

func (*Skills) String

func (instance *Skills) String() string

Jump to

Keyboard shortcuts

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