schema

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBufferString

func GetBufferString(messages []ChatMessage, humanPrefix, aiPrefix string) (string, error)

GetBufferString gets the buffer string of messages.

Types

type AIChatMessage

type AIChatMessage struct {
	Text string
}

AIChatMessage is a message sent by an AI

func (AIChatMessage) GetText

func (m AIChatMessage) GetText() string

func (AIChatMessage) GetType

func (m AIChatMessage) GetType() ChatMessageType

type ChatMessage

type ChatMessage interface {
	GetText() string
	GetType() ChatMessageType
}

ChatMessage is a message sent by a user or the system.

type ChatMessageType

type ChatMessageType string

ChatMessageType is the type of chat message

const (
	// ChatMessageTypeAI is a message sent by an AI
	ChatMessageTypeAI ChatMessageType = "Assistant"
	// ChatMessageTypeHuman is a message sent by a user
	ChatMessageTypeHuman ChatMessageType = "Human"
	// ChatMessageTypeSystem is a message sent by the system
	ChatMessageTypeSystem ChatMessageType = "System"
)

type HumanChatMessage

type HumanChatMessage struct {
	Text string
}

HumanChatMessage is a message sent by a human

func (HumanChatMessage) GetText

func (m HumanChatMessage) GetText() string

func (HumanChatMessage) GetType

func (m HumanChatMessage) GetType() ChatMessageType

type Memory

type Memory interface {
	// MemoryVariables Input keys this memory class will load dynamically
	MemoryVariables() []string
	// LoadMemoryVariables return all memories
	LoadMemoryVariables(inputs map[string]any) (map[string]any, error)
	// SaveContext Save the context of this models run to memory
	SaveContext(inputs map[string]any, outputs map[string]any) error
	// Clear memory contents
	Clear() error
}

Memory is the interface for memory

type SystemChatMessage

type SystemChatMessage struct {
	Text string
}

SystemChatMessage is a chat message representing information that should be instructions to the AI system

func (SystemChatMessage) GetText

func (m SystemChatMessage) GetText() string

func (SystemChatMessage) GetType

func (m SystemChatMessage) GetType() ChatMessageType

Jump to

Keyboard shortcuts

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