conv

package
v0.0.0-...-d1307fe Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChatRoleUser      = "user"
	ChatRoleAssistant = "assistant"
)

Variables

This section is empty.

Functions

func CalculateSHA1

func CalculateSHA1(stringsArray []string) string

Types

type Conversation

type Conversation interface {
	GetMessages() []Message
	GetMessageFromSha1(sha1partial string) (Message, error)
	Last() Message
	MessagesFromHead() []Message
	Append(role string, message string) Message
	SetSystem(message string)
	GetSystem() string
	SetProfile(profile config.Profile) error
	Modify(m Message) error
	ToOpenAIMessage() []openai.ChatCompletionMessage
	ToAnthropicMessage() []anthropic.Message
	ChangeHead(sha string) (Message, error)
	GetProfile() config.Profile
	ToYAML() ([]byte, error)
}

func FromYAML

func FromYAML(yamlBytes []byte) (Conversation, error)

func NewConversation

func NewConversation(profile config.Profile) Conversation

type Message

type Message struct {
	Sha1       string
	ParentSha1 string
	Role       string
	Content    string `yaml:"content,literal"`
	UserName   string
	Head       bool
}

Jump to

Keyboard shortcuts

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