qwen

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenEnvVarName 是通义千问API密钥的环境变量名
	TokenEnvVarName = "QWEN_API_KEY"
	// ModelEnvVarName 是通义千问模型的环境变量名
	ModelEnvVarName = "QWEN_MODEL"

	// OpenAICompatibleBaseURL 是通义千问的OpenAI兼容模式基础URL
	OpenAICompatibleBaseURL = "https://dashscope.aliyuncs.com/compatible-mode/v1"
	// DefaultModel 是默认使用的模型
	DefaultModel = "qwen-max"
)
View Source
const (
	// ModelQWenTurbo 是通义千问Turbo模型
	ModelQWenTurbo = "qwen-turbo"

	// ModelQWenPlus 是通义千问Plus模型
	ModelQWenPlus = "qwen-plus"

	// ModelQWenMax 是通义千问Max模型
	ModelQWenMax = "qwen-max"

	// ModelQWenVLPlus 是通义千问视觉Plus模型
	ModelQWenVLPlus = "qwen-vl-plus"

	// ModelQWenVLMax 是通义千问视觉Max模型
	ModelQWenVLMax = "qwen-vl-max"
)

Qwen模型常量

Variables

This section is empty.

Functions

func GetSupportedModels

func GetSupportedModels() []string

GetSupportedModels 返回通义千问支持的模型列表

func NewModel

func NewModel(ctx context.Context, modelName string, cfg Config) (model.LLM, error)

NewModel 创建一个新的通义千问模型实例

Types

type Config

type Config struct {
	// APIKey 是通义千问API密钥
	APIKey string
	// BaseURL 是API基础URL,默认使用OpenAI兼容模式URL
	BaseURL string
}

Config 是通义千问模型的配置结构

type Model added in v1.0.5

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

Model 实现了model.LLM接口

func (*Model) GenerateContent added in v1.0.5

func (m *Model) GenerateContent(ctx context.Context, req *model.LLMRequest, stream bool) iter.Seq2[*model.LLMResponse, error]

GenerateContent 生成内容,实现model.LLM接口

func (*Model) Name added in v1.0.5

func (m *Model) Name() string

Name 返回模型名称

Jump to

Keyboard shortcuts

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