gpt

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumTokensFromMessages

func NumTokensFromMessages(messages []openai.ChatCompletionMessage, model string) (numTokens int, err error)

NumTokensFromMessages OpenAI Cookbook: https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb

Types

type BaiDuAuthorization

type BaiDuAuthorization struct {
	// 访问凭证
	RefreshToken string `json:"refresh_token"`
	// 有效期,Access Token的有效期。
	// 说明:单位是秒,有效期30天
	ExpiresIn int `json:"expires_in"`
	// 错误码
	// 说明:响应失败时返回该字段,成功时不返回
	Error *string `json:"error,omitempty"`
	// 错误描述信息,帮助理解和解决发生的错误
	// 说明:响应失败时返回该字段,成功时不返回
	ErrorDescription *string `json:"error_description,omitempty"`
	// 暂时未使用,可忽略
	SessionKey string `json:"session_key"`
	// 暂时未使用,可忽略
	AccessToken string `json:"access_token"`
	// 暂时未使用,可忽略
	Scope string `json:"scope"`
	// 暂时未使用,可忽略
	SessionSecret string `json:"session_secret"`
}

func GetBaidubceAccessToken

func GetBaidubceAccessToken(clientId, secret string) (*BaiDuAuthorization, error)

Jump to

Keyboard shortcuts

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