chat

package
v0.1.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: 11 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 {
	*api.APIContext
	// contains filtered or unexported fields
}

ChatContext is context data for chat

func New

func New(apiKey string, profilePath string) (*ChatContext, error)

New function create new ChatContext instance.

func (*ChatContext) Interactive

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

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) RequestRaw

func (cctx *ChatContext) RequestRaw(ctx context.Context, msg string) (openai.ChatCompletionResponse, error)

RequestRaw requesta OpenAI Chat completion, and returns raw response. (REST access)

Jump to

Keyboard shortcuts

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