core

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Temperature float32
	Model       string
)

Functions

func DoPrompt added in v0.1.2

func DoPrompt(promptName string, in string, variables map[string]string) (string, []openai.ChatCompletionMessage)

func RunWithHistory added in v0.1.8

func RunWithHistory(history []openai.ChatCompletionMessage) (string, []openai.ChatCompletionMessage)

Types

type Chat added in v0.1.4

type Chat struct {
	History []openai.ChatCompletionMessage
	Usage   Usage
	Single  bool
}

func (*Chat) AddMessage added in v0.1.4

func (c *Chat) AddMessage(msg openai.ChatCompletionMessage)

func (*Chat) CreateResponse added in v0.1.4

func (c *Chat) CreateResponse()

func (*Chat) Init added in v0.1.4

func (c *Chat) Init()

type OpenAI

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

func (*OpenAI) CreateChatCompletion

func (o *OpenAI) CreateChatCompletion(ctx context.Context, messages []openai.ChatCompletionMessage) (string, Usage, error)

func (*OpenAI) SetTemperature added in v0.1.2

func (o *OpenAI) SetTemperature(t float32)

func (*OpenAI) StreamChatCompletion added in v0.1.6

func (o *OpenAI) StreamChatCompletion(ctx context.Context, messages []openai.ChatCompletionMessage) (*openai.ChatCompletionStream, error)

type Usage added in v0.1.4

type Usage openai.Usage

func (*Usage) Add added in v0.1.4

func (u *Usage) Add(other Usage)

Jump to

Keyboard shortcuts

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