common

package
v1.4.104 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 12 Imported by: 28

Documentation

Index

Constants

View Source
const ChatMessageRoleMeta = "meta"

Variables

This section is empty.

Functions

func NormalizeMessages

func NormalizeMessages(msgs []*goopenai.ChatCompletionMessage, defaultUserMessage string) (ret []*goopenai.ChatCompletionMessage)

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

func ReturnItem added in v1.4.67

func ReturnItem(item string) string

Types

type Attachment added in v1.4.79

type Attachment struct {
	Type    *string `json:"type,omitempty"`
	Path    *string `json:"path,omitempty"`
	URL     *string `json:"url,omitempty"`
	Content []byte  `json:"content,omitempty"`
	ID      *string `json:"id,omitempty"`
}

func NewAttachment added in v1.4.79

func NewAttachment(value string) (ret *Attachment, err error)

func (*Attachment) Base64Content added in v1.4.79

func (a *Attachment) Base64Content() (ret string, err error)

func (*Attachment) ContentBytes added in v1.4.79

func (a *Attachment) ContentBytes() (ret []byte, err error)

func (*Attachment) GetId added in v1.4.79

func (a *Attachment) GetId() (ret string, err error)

func (*Attachment) ResolveType added in v1.4.79

func (a *Attachment) ResolveType() (ret string, err error)

type ChatOptions

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

type ChatRequest

type ChatRequest struct {
	ContextName      string
	SessionName      string
	PatternName      string
	PatternVariables map[string]string
	Message          *goopenai.ChatCompletionMessage
	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

Jump to

Keyboard shortcuts

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