chatBot

package
v0.0.0-...-0e0034f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatBot

type ChatBot struct {
	*robots.Robot
	Client contract.ChatBotClientInterface
}

func NewChatBot

func NewChatBot(client contract.ChatBotClientInterface) (*ChatBot, error)

func (*ChatBot) CreateChatCompletion

func (bot *ChatBot) CreateChatCompletion(ctx context.Context, message *model.Message, role model.Role) (*model.Message, error)

SendMessage 向指定对话发送消息

func (*ChatBot) CreateChatCompletionStream

func (bot *ChatBot) CreateChatCompletionStream(ctx context.Context, message *model.Message, role model.Role, processStreamData func(data string, status model2.ChatStatus) error) (*model.Message, error)

func (*ChatBot) CreateCompletion

func (bot *ChatBot) CreateCompletion(ctx context.Context, prompt *model.Message) (*model.Message, error)

GenerateAnswer 生成无上下文回答

func (*ChatBot) CreateCompletionStream

func (bot *ChatBot) CreateCompletionStream(ctx context.Context, message *model.Message, role model.Role, processStreamData func(data string, status model2.ChatStatus) error) (*model.Message, error)

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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