xfchat

package module
v0.0.0-...-4c909e1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 12 Imported by: 0

README

xfchat

讯飞星火大模型 Web SDK

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HmacSHA256

func HmacSHA256(key string, data string) []byte

Types

type Chat

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

func New

func New(appID string, apiKey string, apiSecret string, options ...Option) (*Chat, error)

func (*Chat) Ask

func (c *Chat) Ask(question string) (err error)

Ask reconnect every time

func (*Chat) Close

func (c *Chat) Close() error

type Option

type Option interface {
	// contains filtered or unexported methods
}

func SetMaxTokens

func SetMaxTokens(max int) Option

SetMaxTokens set the maximum length of the model answer tokens v1 [1, 4096] v2 [1, 8192]

func SetOutput

func SetOutput(w io.Writer) Option

SetOutput set answer output

func SetTemperature

func SetTemperature(t float64) Option

SetTemperature sampling threshold [0, 1], default 0.5

func SetTopK

func SetTopK(v int) Option

SetTopK randomly select one of the k candidates (equal probability) [1, 6], default 4

func UseVersion1

func UseVersion1() Option

UseVersion1 use v1.1

func UseVersion2

func UseVersion2() Option

UseVersion2 use v2.1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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