bigmodel

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeData = iota
	TypeDone
	TypeError
)
View Source
const (
	RoleUser      = "user"
	RoleAssistant = "assistant"
	RoleSystem    = "system"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BigModel

type BigModel interface {
	// Chat Receive a query for large model calls and write the output results to the Result channel in real time
	Chat(messages []*Message) chan Result
}

BigModel interface

func NewChatGPT

func NewChatGPT(apiKey string, opts ...Option) BigModel

type ChatGPT

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

ChatGPT big model

func (*ChatGPT) Chat

func (gpt *ChatGPT) Chat(messages []*Message) chan Result

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

func AssistantMessage

func AssistantMessage(msg string) *Message

func Messages

func Messages(messages ...*Message) []*Message

func SystemMessage

func SystemMessage(msg string) *Message

func UserMessage

func UserMessage(msg string) *Message

type Option

type Option func(*ChatGPT)

func WithSpecifyBaseURL

func WithSpecifyBaseURL(url string) Option

WithSpecifyBaseURL specify OPENAI API base url

func WithSpecifyModel

func WithSpecifyModel(model string) Option

WithSpecifyModel specify ChatGPT model

type Result

type Result struct {
	Type    int
	Content string
}

Jump to

Keyboard shortcuts

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