ai

package
v1.3.5-alpha0828 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exports = map[string]any{
	"OpenAI":   OpenAI,
	"ChatGLM":  ChatGLM,
	"Moonshot": Moonshot,

	"Chat":         Chat,
	"FunctionCall": FunctionCall,

	"timeout":            aispec.WithTimeout,
	"proxy":              aispec.WithProxy,
	"model":              aispec.WithModel,
	"apiKey":             aispec.WithAPIKey,
	"noHttps":            aispec.WithNoHttps,
	"funcCallRetryTimes": aispec.WithFunctionCallRetryTimes,
	"domain":             aispec.WithDomain,
	"baseURL":            aispec.WithBaseURL,
	"onStream":           aispec.WithStreamHandler,
	"debugStream":        aispec.WithDebugStream,
	"type":               aispec.WithType,
}

Functions

func Chat

func Chat(msg string, opts ...aispec.AIConfigOption) (string, error)

func ChatGLM

func ChatGLM(opts ...aispec.AIConfigOption) aispec.AIClient

func FunctionCall

func FunctionCall(input string, funcs any, opts ...aispec.AIConfigOption) (map[string]any, error)

func GetAI

func GetAI(t string, opts ...aispec.AIConfigOption) aispec.AIClient

func GetPrimaryAgent

func GetPrimaryAgent() aispec.AIClient

func HaveAI

func HaveAI(t string) bool

func Moonshot

func Moonshot(opts ...aispec.AIConfigOption) aispec.AIClient

func OpenAI

func OpenAI(opts ...aispec.AIConfigOption) aispec.AIClient

Types

type Gateway

type Gateway struct {
	Config    *aispec.AIConfig
	TargetUrl string
	aispec.AIClient
}

func NewGateway

func NewGateway() *Gateway

func (*Gateway) Chat

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

func (*Gateway) ChatEx

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

func (*Gateway) ChatStream

func (g *Gateway) ChatStream(s string) (io.Reader, error)

func (*Gateway) ExtractData

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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