chatglm

package
v1.3.1-sp3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL    = "https://open.bigmodel.cn/api/paas/v4/chat/completions"
	APITimeout = 300 * time.Second
)
View Source
const (
	APITokenTTLSeconds = 3 * 60
	APIKeyPartCount    = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GLMClient

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

func (*GLMClient) BuildHTTPOptions

func (g *GLMClient) BuildHTTPOptions() ([]poc.PocConfigOption, error)

func (*GLMClient) Chat

func (g *GLMClient) Chat(s string, f ...aispec.Function) (string, error)

func (*GLMClient) ChatEx

func (g *GLMClient) ChatEx(details []aispec.ChatDetail, function ...aispec.Function) ([]aispec.ChatChoice, error)

func (*GLMClient) ExtractData

func (g *GLMClient) ExtractData(msg string, desc string, fields map[string]string) (map[string]any, error)

func (*GLMClient) LoadOption

func (g *GLMClient) LoadOption(opt ...aispec.AIConfigOption)

type ModelAPI

type ModelAPI struct {
	Model       string
	Prompt      []map[string]interface{}
	TopP        float64
	Temperature float64
}

func NewGLMMessage

func NewGLMMessage(msg string) *ModelAPI

func (ModelAPI) Invoke

func (m ModelAPI) Invoke(apiKey string) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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