chat

package
v0.0.0-...-1a4fc59 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversation

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

func NewConversation

func NewConversation(name string, config *ai.AIConfig) *Conversation

NewConversation creates a new conversation with the given name and config. The underlying agent will be started automatically on the first message. If you want to start the agent preemptively, use the PreemptiveStart() function.

func (*Conversation) AddMessage

func (c *Conversation) AddMessage(msg agent.ChatAgentMessage)

Adds a message to the conversation without sending it to the agent.

func (*Conversation) Close

func (c *Conversation) Close()

Close the conversation. This will close the underlying agent.

func (*Conversation) GetAgent

func (c *Conversation) GetAgent() *agent.ChatAgent

func (*Conversation) GetConfig

func (c *Conversation) GetConfig() *ai.AIConfig

func (*Conversation) GetLastMessage

func (c *Conversation) GetLastMessage() agent.ChatAgentMessage

func (*Conversation) GetMessageCount

func (c *Conversation) GetMessageCount() int

func (*Conversation) GetMessages

func (c *Conversation) GetMessages() []agent.ChatAgentMessage

func (*Conversation) Kill

func (c *Conversation) Kill()

Kills and deletes the conversation. This will kill and delete the underlying agent.

func (*Conversation) LoadFromFile

func (c *Conversation) LoadFromFile(filename string) error

func (*Conversation) PreemptiveStart

func (c *Conversation) PreemptiveStart()

Starts the agent underlying the conversation. As the conversation is started automatically on the first message, this function is only useful if you want to start the conversation preemptively due to computational constraints.

func (*Conversation) ResetMessages

func (c *Conversation) ResetMessages()

func (*Conversation) SaveToFile

func (c *Conversation) SaveToFile(filename string) error

func (*Conversation) SendSystemMessage

func (c *Conversation) SendSystemMessage(msgContent string) (agent.ChatAgentMessage, error)

Send a system message to the conversation. The message will be sent to the agent and the agent will respond with a completion.

func (*Conversation) SendUserMessage

func (c *Conversation) SendUserMessage(msgContent string) (agent.ChatAgentMessage, error)

Send a message to the conversation. The message will be sent to the agent and the agent will respond with a completion.

func (*Conversation) SetMessages

func (c *Conversation) SetMessages(messages []agent.ChatAgentMessage)

Jump to

Keyboard shortcuts

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