common

package
v1.4.77 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 3 Imported by: 28

Documentation

Index

Constants

View Source
const ChatMessageRoleMeta = "meta"

Variables

This section is empty.

Functions

func ReturnItem added in v1.4.67

func ReturnItem(item string) string

Types

type ChatOptions

type ChatOptions struct {
	Model            string
	Temperature      float64
	TopP             float64
	PresencePenalty  float64
	FrequencyPenalty float64
	Raw              bool
	Seed             int
}

type ChatRequest

type ChatRequest struct {
	ContextName      string
	SessionName      string
	PatternName      string
	PatternVariables map[string]string
	Message          string
	Language         string
	Meta             string
}

type GroupItems added in v1.4.67

type GroupItems[I any] struct {
	Group string
	Items []I
}

func (*GroupItems[I]) ContainsItemBy added in v1.4.67

func (o *GroupItems[I]) ContainsItemBy(predicate func(item I) bool) (ret bool)

func (*GroupItems[I]) Count added in v1.4.67

func (o *GroupItems[I]) Count() int

type GroupsItemsSelector added in v1.4.67

type GroupsItemsSelector[I any] struct {
	SelectionLabel string
	GetItemKey     func(I) string

	GroupsItems []*GroupItems[I]
}

func NewGroupsItemsSelector added in v1.4.67

func NewGroupsItemsSelector[I any](selectionLabel string,
	getItemLabel func(I) string) *GroupsItemsSelector[I]

func (*GroupsItemsSelector[I]) AddGroupItems added in v1.4.67

func (o *GroupsItemsSelector[I]) AddGroupItems(group string, items ...I)

func (*GroupsItemsSelector[I]) FindGroupsByItem added in v1.4.67

func (o *GroupsItemsSelector[I]) FindGroupsByItem(item I) (groups []string)

func (*GroupsItemsSelector[I]) FindGroupsByItemFirst added in v1.4.67

func (o *GroupsItemsSelector[I]) FindGroupsByItemFirst(item I) (ret string)

func (*GroupsItemsSelector[I]) GetGroupAndItemByItemNumber added in v1.4.67

func (o *GroupsItemsSelector[I]) GetGroupAndItemByItemNumber(number int) (group string, item I, err error)

func (*GroupsItemsSelector[I]) HasGroup added in v1.4.67

func (o *GroupsItemsSelector[I]) HasGroup(group string) (ret bool)

func (*GroupsItemsSelector[I]) Print added in v1.4.67

func (o *GroupsItemsSelector[I]) Print()

type GroupsItemsSelectorString added in v1.4.67

type GroupsItemsSelectorString struct {
	*GroupsItemsSelector[string]
}

func NewGroupsItemsSelectorString added in v1.4.67

func NewGroupsItemsSelectorString(selectionLabel string) *GroupsItemsSelectorString

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

func NormalizeMessages

func NormalizeMessages(msgs []*Message, defaultUserMessage string) (ret []*Message)

NormalizeMessages remove empty messages and ensure messages order user-assist-user

Jump to

Keyboard shortcuts

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