chat

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatContext

type ChatContext struct {
	*gpt.GPTContext
	// contains filtered or unexported fields
}

ChatContext is context data for chat

func New

func New(apiKey, cacheDir string, logger *zerolog.Logger, profilePath, savePath string) (*ChatContext, error)

New function create new ChatContext instance.

func (*ChatContext) Interactive

func (cctx *ChatContext) Interactive(ctx context.Context, w io.Writer) error

Interactive method is chatting in interactive mode (stream access).

func (*ChatContext) Request

func (cctx *ChatContext) Request(ctx context.Context, msg string) (string, error)

Request requesta OpenAI Chat completion, and returns response message. (REST access)

func (*ChatContext) Save added in v0.3.0

func (cctx *ChatContext) Save() error

Save method saves openai.ChatCompletionRequest data.

func (*ChatContext) SavePath added in v0.3.0

func (cctx *ChatContext) SavePath() string

Jump to

Keyboard shortcuts

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