结构体

  • Go

更新时间

BaseResponse

Go
type BaseResponse struct {
	RawResponse *http.Response
	RawBody []byte
	HttpStatusCode int
}

调用 HTTP API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
RawResponseResponse(可选)HTTP 原始响应,详见 Response。
RawBody[]byte原始响应体。
HttpStatusCodeintHTTP 状态码。
表格内容超出当前宽度,可横向滚动查看更多列。

Logger

Go
type Logger interface {
	Debug(ctx Context, module string, v ...interface{})
	Debugf(ctx Context, module string, format string, v ...interface{})
	Error(ctx Context, module string, v ...interface{})
	Errorf(ctx Context, module string, format string, v ...interface{})
	Info(ctx Context, module string, v ...interface{})
	Infof(ctx Context, module string, format string, v ...interface{})
	Warn(ctx Context, module string, v ...interface{})
	Warnf(ctx Context, module string, format string, v ...interface{})
	Level() Level
	SetLevel(level Level)
}

日志接口,实现该接口以输出日志到日志组件。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ctxContext(必填)上下文信息,详见 Context。
modulestring(必填)日志所属模块名称。
v...interface{}可变参数,表示可以接受零个或多个 interface 的参数。
formatstring格式化字符串,用于格式化日志内容。
levelLevel日志级别,详见 Level。
表格内容超出当前宽度,可横向滚动查看更多列。

Config

Go
type Config struct {
	AppID string
	HttpTimeout time.Duration
	Credential auth.Credential
	DomainArea domain.Area
	Logger log.Logger
	ServiceRegion ServiceRegion
}

对话式 AI 引擎 REST Client 的配置项。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
AppIDstring声网 AppID。
HttpTimeouttime.DurationHTTP 请求的超时时间。
Credentialauth.Credential用于访问声网服务的凭证。支持的凭证类型包括:BasicAuthCredential,详见 auth.NewBasicAuthCredential。
DomainAreadomain.AreaREST Client 的域名区域,详见 domain.Area。
Loggerlog.LoggerREST Client 的日志记录器。你可以在项目中实现 log.Logger 接口,将 REST Client 日志输出到你的日志组件;也可以使用默认日志组件,详见 log.NewDefaultLogger。
ServiceRegionServiceRegion服务版本,详见 ServiceRegion。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinPropertiesAdvancedFeaturesBody

Go
type JoinPropertiesAdvancedFeaturesBody struct {
	EnableAIVad *bool `json:"enable_aivad,omitempty"`
	EnableRtm *bool `json:"enable_rtm,omitempty"`
	EnableMLLM *bool `json:"enable_mllm,omitempty"`
}

智能体加入 RTC 频道时的高级功能配置。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
EnableAIVadbool

(可选)是否启用平滑打断(AIVAD)。启用后,你可以随时打断 AI 并快速响应,实现自然过渡和流畅对话。

  • true:启用。
  • false:禁用(默认)。
EnableRtmbool

(可选)是否启用 Real-time Messaging(RTM)模块。启用后,智能体可以使用 RTM 提供的能力实现一些高级功能。

  • true:启用。
  • false:禁用(默认)。
EnableMLLMbool

是否启用多模态大语言模型(Multimodal Large Language Model)。

  • true:启用。
  • false:禁用(默认)。

启用该功能将自动禁用 ASR、LLM 和 TTS。当你将该参数设置为 true 时,enable_aivad 也会被禁用。

表格内容超出当前宽度,可横向滚动查看更多列。

TTSMinimaxVendorParams

Go
type TTSMinimaxVendorParams struct {
	GroupId      string                            `json:"group_id"`
	Key          string                            `json:"key"`
	Model        string                            `json:"model"`
	VoiceSetting *TTSMinimaxVendorVoiceSettingParam `json:"voice_setting"`
	AudioSetting *TTSMinimaxVendorAudioSettingParam `json:"audio_setting"`
	PronunciationDict *PronunciationDictParam      `json:"pronunciation_dict"`
	TimberWeights []TimberWeightsParam             `json:"timber_weights"`
}

智能体加入 RTC 频道时用于文本转语音(TTS)模块的 Minimax 供应商参数。

信息

自 v0.7.0 版本新增。

详见MiniMax 同步语音合成接口。

成员参数

参数数据类型描述
GroupIdstring
Keystring
Modelstring
VoiceSetting*TTSMinimaxVendorVoiceSettingParam(可选)语音设置参数,详见 TTSMinimaxVendorVoiceSettingParam。
AudioSetting*TTSMinimaxVendorAudioSettingParam(可选)音频设置参数,详见 TTSMinimaxVendorAudioSettingParam。
PronunciationDict*PronunciationDictParam(可选)发音词典配置,详见 PronunciationDictParam。
TimberWeights[]TimberWeightsParam(可选)音色权重配置,详见 TimberWeightsParam。
表格内容超出当前宽度,可横向滚动查看更多列。

TTSTencentVendorParams

Go
type TTSTencentVendorParams struct {
	AppId            string `json:"app_id"`
	SecretId         string `json:"secret_id"`
	SecretKey        string `json:"secret_key"`
	VoiceType        int    `json:"voice_type"`
	Volume           int    `json:"volume"`
	Speed            int    `json:"speed"`
	EmotionCategory  string `json:"emotion_category"`
	EmotionIntensity int    `json:"emotion_intensity"`
}

Text-to-Speech (TTS) 模块中 Tencent 供应商的参数配置,用于智能体加入 RTC 频道时。

信息

自 v0.7.0 版本新增。

详见腾讯云实时语音合成文档。

TTSBytedanceVendorParams

Go
type TTSBytedanceVendorParams struct {
Token       string  `json:"token"`
AppId       string  `json:"app_id"`
Cluster     string  `json:"cluster"`
VoiceType   string  `json:"voice_type"`
SpeedRatio  float32 `json:"speed_ratio"`
VolumeRatio float32 `json:"volume_ratio"`
PitchRatio  float32 `json:"pitch_ratio"`
Emotion     string  `json:"emotion"`
}

智能体加入 RTC 频道时使用的字节跳动语音合成(TTS)模块厂商参数。

信息

自 v0.7.0 版本新增。

详见火山引擎语音合成文档。

成员参数

参数数据类型描述
Tokenstring用于鉴权的临时 Token。
AppIdstring字节跳动控制台中创建应用时生成的 App ID。
Clusterstring接入的集群信息。
VoiceTypestring使用的语音类型。
SpeedRatiofloat32语速调节参数。
VolumeRatiofloat32音量调节参数。
PitchRatiofloat32音调调节参数。
Emotionstring语音的情感类型。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinPropertiesTTSBody

Go
type JoinPropertiesTTSBody struct {
	Vendor TTSVendor `json:"vendor"`
	Params TTSVendorParamsInterface `json:"params"`
	SkipPatterns []int `json:"skip_patterns,omitempty"`
}

智能体加入 RTC 频道时的文本转语音(TTS)模块配置。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
VendorTTSVendorTTS 服务商,详见 TTSVendor。
ParamsTTSVendorParamsInterfaceTTS 供应商参数,详见 TTSMinimaxVendorParams、TTSTencentVendorParams、TTSBytedanceVendorParams 和 TTSMicrosoftVendorParams。
SkipPatterns[]int

控制 TTS 模块在朗读大语言模型(LLM)响应文本时是否跳过括号内容。启用此功能可防止智能体朗读结构性提示信息,如语气标记、动作描述和系统提示,从而营造更自然沉浸的听觉体验。

通过指定一个或多个值启用此功能:

  • 1:跳过中文圆括号(),Unicode 为 \uFF08 和 \uFF09。
  • 2:跳过中文方括号【】,Unicode 为 \u3010 和 \u3011。
  • 3:跳过英文圆括号 (),Unicode 为 \u0028 和 \u0029。
  • 4:跳过英文方括号 [],Unicode 为 \u005B 和 \u005D。
  • 5:跳过英文花括号 ,Unicode 为 \u007B 和 \u007D。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinPropertiesCustomLLMBody

Go
type JoinPropertiesCustomLLMBody struct {
	Url string `json:"url"`
	APIKey string `json:"api_key"`
	SystemMessages []map[string]any `json:"system_messages"`
	Params map[string]any `json:"params"`
	MaxHistory *int `json:"max_history,omitempty"`
	GreetingMessage string `json:"greeting_message,omitempty"`
	InputModalities []string `json:"input_modalities,omitempty"`
	OutputModalities []string `json:"output_modalities,omitempty"`
	FailureMessage string `json:"failure_message,omitempty"`
	SilenceMessage *string `json:"silence_message,omitempty"`
	Vendor string `json:"vendor,omitempty"`
	Style string `json:"style,omitempty"`
}

智能体加入 RTC 频道时的自定义语言模型(LLM)配置。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Urlstring(必填)LLM 回调地址,必须兼容 OpenAI 协议。
APIKeystring(必填)用于验证的 LLM API 密钥。默认值为空,请确保在生产环境中启用 API 密钥。
SystemMessages[]map[string]any(可选)附加在每次 LLM 调用开头的一组预定义信息,用于控制 LLM 输出。可以包含角色设定、提示词和回答示例,必须兼容 OpenAI 协议。
Paramsmap[string]any(可选)在 LLM 消息体中传输的附加信息,例如所用模型、最大 token 限制等。不同的 LLM 服务商支持的配置不同,详见其各自的 LLM 文档。
MaxHistory*int(可选)缓存于语言模型中的短期记忆条目数量。默认值为 32。传入 0 表示不缓存短期记忆,智能体和订阅用户将分别记录条目。
GreetingMessagestring(可选)智能体问候语。如果填写,当 remote_rtc_uids 列表中没有用户时,智能体会自动向第一个加入频道的订阅用户发送问候语。
InputModalities[]string

(可选)LLM 的输入模态:

  • ["text"]:仅文本(默认)。
  • ["text", "image"]:文本和图像,要求所选 LLM 支持视觉模态输入。
OutputModalities[]string

(可选)LLM 的输出模态:

  • ["text"]:仅文本(默认),输出文本将由 TTS 模块转换为语音并发布到 RTC 频道。
  • ["audio"]:仅音频,音频将直接发布到 RTC 频道。
  • ["text", "audio"]:文本和音频,可自定义处理 LLM 输出的逻辑。
FailureMessagestring(可选)智能体失败提示语。如果填写,当 LLM 调用失败时将通过 TTS 模块返回该提示语。
SilenceMessage*string

(可选)智能体静默提示消息。当智能体创建完成且有用户加入频道后,若其处于非监听、思考或说话状态的持续时间达到设定值,将触发该提示消息,并重新计算静默时间。当 silence_timeout 设置为 0 时,该参数将被忽略。

注意

该字段自 v0.11.0 版本废弃,请改用 Parameters.SilenceConfig。

Vendorstring

(可选)语言模型提供方,支持以下设置:

  • custom:自定义语言模型提供方。设置为该选项时,智能体在请求中除 role 和 content 外还会包含以下字段:
  • turn_id:每轮对话的唯一标识,从 0 开始递增,每次用户与智能体交互对应一个 turn_id。
  • timestamp:请求的时间戳,单位为毫秒。
  • aliyun:阿里云语言模型提供方(仅限中国大陆服务区域)。
  • bytedance:字节跳动语言模型提供方(仅限中国大陆服务区域)。
  • deepseek:DeepSeek 语言模型提供方(仅限中国大陆服务区域)。
  • tencent:腾讯语言模型提供方(仅限中国大陆服务区域)。
Stylestring

(可选)用于对话补全的请求风格,仅适用于全球服务区域。支持以下选项:

  • openai:OpenAI 风格(默认)。
  • gemini:Gemini 风格。
  • anthropic:Anthropic 风格。
  • dify:Dify 风格。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinPropertiesVadBody

Go
type JoinPropertiesVadBody struct {
	InterruptDurationMs *int `json:"interrupt_duration_ms,omitempty"`
	PrefixPaddingMs *int `json:"prefix_padding_ms,omitempty"`
	SilenceDurationMs *int `json:"silence_duration_ms,omitempty"`
	Threshold *float64 `json:"threshold,omitempty"`
}

智能体加入 RTC 频道时的语音活动检测(VAD)配置。

信息

自 v0.7.0 版本新增。

JoinPropertiesAsrBody

Go
type JoinPropertiesAsrBody struct {
	Language string `json:"language,omitempty"`
	Vendor ASRVendor `json:"vendor,omitempty"`
	Params ASRVendorParamsInterface `json:"params,omitempty"`
}

智能体加入 RTC 频道时的自动语音识别(ASR)配置。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Languagestring

(可选)用户与智能体交互时使用的语言。

  • zh-CN:中文(支持中英文混合)(默认)。
  • en-US:英文。
VendorASRVendorASR 供应商,详见 ASRVendor。
ParamsASRVendorParamsInterfaceASR 供应商参数说明,详见 ASRVendorTencentParams、ASRVendorMicrosoftParams。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinPropertiesReqBody

Go
type JoinPropertiesReqBody struct {
	Token string `json:"token"`
	Channel string `json:"channel"`
	AgentRtcUId string `json:"agent_rtc_uid"`
	RemoteRtcUIds []string `json:"remote_rtc_uids"`
	EnableStringUId *bool `json:"enable_string_uid,omitempty"`
	IdleTimeout *int `json:"idle_timeout,omitempty"`
	SilenceTimeout *int `json:"silence_timeout,omitempty"`
	AgentRtmUId *string `json:"agent_rtm_uid,omitempty"`
	AdvancedFeatures *JoinPropertiesAdvancedFeaturesBody `json:"advanced_features,omitempty"`
	LLM *JoinPropertiesCustomLLMBody `json:"llm,omitempty"`
	MLLM *JoinPropertiesMLLMBody `json:"mllm,omitempty"`
	TTS *JoinPropertiesTTSBody `json:"tts,omitempty"`
	Vad *JoinPropertiesVadBody `json:"vad,omitempty"`
	Asr *JoinPropertiesAsrBody `json:"asr,omitempty"`
	TurnDetection *TurnDetectionBody `json:"turn_detection,omitempty"`
	Parameters *Parameters `json:"parameters,omitempty"`
}

调用对话式 AI 引擎 Join API 的请求体。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Tokenstring(可选)用于加入 RTC 频道的 Token,即用于身份验证的动态密钥。如果项目启用了 App 证书,请务必在此字段中传入项目的动态密钥。
Channelstring(必填)智能体加入的 RTC 频道名称。
AgentRtcUIdstring(必填)智能体在 RTC 频道中的用户 ID。填写 "0" 表示随机分配,但需要相应修改 Token。
RemoteRtcUIds[]string(必填)智能体在 RTC 频道中订阅的用户 ID 列表,仅订阅的用户可以与智能体交互。传入 "*" 表示订阅频道中的所有用户。
EnableStringUId*bool

(可选)是否启用字符串 UID。

  • true:启用字符串 UID。
  • false:禁用字符串 UID(默认)。
IdleTimeout*int(可选)RTC 频道的最大空闲时间(单位:秒)。当检测到 remote_rtc_uids 中指定的所有用户都已离开频道后,开始计为空闲时间。如果超过设置的最大值,频道中的智能体将自动停止并退出频道。若设置为 0,智能体将不会自动停止,需手动退出。
SilenceTimeout*int

(可选)智能体的最大静默时间(单位:秒),取值范围为 [0,60]。当智能体创建完成且有用户加入频道后,若其处于非监听、非思考、非说话状态的持续时间达到设定值,将触发上报 llm.silence_message 中的静默提示消息,并重新计算静默时间。

  • 0(默认):不启用该功能。
  • (0,60]:必须同时设置 llm.silence_message 才能启用该功能。

注意

该字段自 v0.11.0 版本废弃,请改用 Parameters.SilenceConfig。

AgentRtmUId*string

(可选)RTM 频道中智能体的用户 ID,仅在 advanced_features.enable_rtm 为 true 时有效。

注意

该字段自 v0.11.0 版本废弃,请改用 AgentRtcUId。

AdvancedFeatures*JoinPropertiesAdvancedFeaturesBody(可选)高级功能配置,详见 JoinPropertiesAdvancedFeaturesBody。
LLM*JoinPropertiesCustomLLMBody(必填)自定义语言模型(LLM)配置,详见 JoinPropertiesCustomLLMBody。
MLLM*JoinPropertiesMLLMBody(可选)用于实时音频和文本处理的多模态大语言模型(MLLM)配置,详见 JoinPropertiesMLLMBody。
TTS*JoinPropertiesTTSBody(必填)文本转语音(TTS)模块配置,详见 JoinPropertiesTTSBody。
Vad*JoinPropertiesVadBody

(可选)语音活动检测(VAD)配置,详见 JoinPropertiesVadBody。

注意

该字段自 v0.12.0 版本废弃,请改用 TurnDetection。

Asr*JoinPropertiesAsrBody(可选)自动语音识别(ASR)配置,详见 JoinPropertiesAsrBody。
TurnDetection*TurnDetectionBody(可选)对话轮次检测设置,详见 TurnDetectionBody。
Parameters*Parameters(可选)智能体参数配置,详见 Parameters。
表格内容超出当前宽度,可横向滚动查看更多列。

TTSMicrosoftVendorParams

Go
type TTSMicrosoftVendorParams struct {
	Key string `json:"key"`
	Region string `json:"region"`
	VoiceName string `json:"voice_name"`
	Speed float32 `json:"speed"`
	Volume float32 `json:"volume"`
	SampleRate int `json:"sample_rate"`
}

Text-to-Speech(TTS)模块中 Microsoft 供应商的参数。

信息

自 v0.12.0 版本新增。

成员参数

参数数据类型描述
Keystring用于身份验证的 API 密钥。
Regionstring托管语音服务的 Azure 区域。
VoiceNamestring(可选)用于语音合成的语音标识符。
Speedfloat32(可选)语速,适用于单词或句子级别,取值范围为原始语速的 0.5 到 2.0 倍。
Volumefloat32(可选)音量,取值范围为 0.0 到 100.0,其中 0.0 表示最小音量,100.0 表示最大音量。例如,75 表示音量为最大值的 75%。默认值为 100。
SampleRateint(可选)音频采样率,单位为 Hz。默认值为 24000。
表格内容超出当前宽度,可横向滚动查看更多列。

TTSVendorParamsInterface

Go
type TTSVendorParamsInterface interface {
	VendorParam()
	GetVendorType() TTSVendor
}

TTS 供应商参数接口。

信息

自 v0.12.0 版本新增。

成员参数

参数数据类型描述
VendorParamfunc将该类型标记为有效的 TTS 供应商参数。
GetVendorTypefunc返回用于校验的供应商类型标识符。
表格内容超出当前宽度,可横向滚动查看更多列。

ASRFengmingVendorParam

Go
type ASRFengmingVendorParam struct{}

智能体加入 RTC 频道时使用的自动语音识别(ASR)凤鸣厂商参数。

信息

自 v0.12.0 版本新增。

ASRTencentVendorParam

Go
type ASRTencentVendorParam struct {
	SecretId        string `json:"secret_id"`
	AppId           string `json:"app_id"`
	SecretKey       string `json:"secret_key"`
	EngineModelType string `json:"engine_model_type"`
	VoiceId         string `json:"voice_id"`
}

智能体加入 RTC 频道时使用的 Tencent 自动语音识别(ASR)厂商参数。

信息

自 v0.12.0 版本新增。

ASRMicrosoftVendorParam

Go
type ASRMicrosoftVendorParam struct {
	Key        string   `json:"key"`
	Region     string   `json:"region"`
	Language   string   `json:"language"`
	PhraseList []string `json:"phrase_list"`
}

Microsoft 自动语音识别(ASR)厂商参数。

信息

自 v0.12.0 版本新增。

JoinPropertiesMLLMBody

Go
type JoinPropertiesMLLMBody struct {
	Url string `json:"url"`
	APIKey string `json:"api_key"`
	Messages []map[string]any `json:"messages"`
	Params map[string]any `json:"params"`
	MaxHistory *int `json:"max_history,omitempty"`
	InputModalities []string `json:"input_modalities,omitempty"`
	OutputModalities []string `json:"output_modalities,omitempty"`
	GreetingMessage string `json:"greeting_message,omitempty"`
	Vendor string `json:"vendor,omitempty"`
	Style string `json:"style,omitempty"`
}

多模态语言模型配置。

信息

自 v0.12.0 版本新增。

成员参数

参数数据类型描述
Urlstring(必填)用于 OpenAI Realtime API 的 WebSocket 地址。
APIKeystring(必填)用于身份验证的 API 密钥。
Messages[]map[string]any(可选)用于短期记忆管理的对话项数组。结构与 OpenAI Realtime API 中 item.content 相同,详见 conversation.item.create。
Paramsmap[string]any

(可选)额外的多模态语言模型配置参数。

  • 模态设置将被 input_modalities 和 output_modalities 覆盖。
  • 轮次检测设置将被 mllm 外部的 turn_detection 配置覆盖。
MaxHistory*int(可选)要保留的对话历史消息数量。不能超过模型的上下文窗口。默认值为 32。
InputModalities[]string

(可选)多模态语言模型的输入模态。

  • ["audio"]:仅音频(默认)。
  • ["audio", "text"]:音频和文本。
OutputModalities[]string输出参数,表示输出格式选项,例如 ["text", "audio"] 表示同时返回文本和语音响应。
GreetingMessagestring(可选)用户加入频道时,智能体最初说出的消息。
Vendorstring(可选)多模态语言模型提供商标识。设置为 "openai" 表示使用 OpenAI Realtime API。
Stylestring(可选)API 请求样式。设置为 "openai" 表示使用 OpenAI Realtime API 格式。
表格内容超出当前宽度,可横向滚动查看更多列。

TurnDetectionBody

Go
type TurnDetectionBody struct {
	Type string `json:"type"`
	InterruptMode string `json:"interrupt_mode,omitempty"`
	InterruptDurationMs *int `json:"interrupt_duration_ms,omitempty"`
	PrefixPaddingMs *int `json:"prefix_padding_ms,omitempty"`
	SilenceDurationMs *int `json:"silence_duration_ms,omitempty"`
	Threshold *float64 `json:"threshold,omitempty"`
	CreateResponse *bool `json:"create_response,omitempty"`
	InterruptResponse *bool `json:"interrupt_response,omitempty"`
	Eagerness *string `json:"eagerness,omitempty"`
}

配置会话轮次检测的参数。

信息

自 v0.11.0 版本新增。

FixedParams

Go
type FixedParams struct {
	SilenceConfig *SilenceConfig `json:"silence_config,omitempty"`
	DataChannel *string `json:"data_channel,omitempty"`
	EnableMetrics bool `json:"enable_metrics,omitempty"`
	EnableErrorMessage bool `json:"enable_error_message,omitempty"`
}

固定参数配置。

信息

自 v0.11.0 版本新增。

成员参数

参数数据类型描述
SilenceConfigSilenceConfig(可选)智能体的静默配置,详见 SilenceConfig。
DataChannelstring

(可选)智能体数据传输通道:

  • "rtm":使用 RTM 传输。该配置仅在 advanced_features.enable_rtm 为 true 时生效。
  • "datastream":使用 RTC 数据流传输(默认)。
EnableMetricsbool

(可选)是否接收智能体性能数据:

  • true:接收智能体性能数据。
  • false:(默认)不接收智能体性能数据。

该设置仅在 advanced_features.enable_rtm 为 true 时生效。

EnableErrorMessagebool

(可选)是否接收智能体错误事件:

  • true:接收智能体错误事件。
  • false:(默认)不接收智能体错误事件。

该设置仅在 advanced_features.enable_rtm 为 true 时生效。

表格内容超出当前宽度,可横向滚动查看更多列。

SilenceConfig

Go
type SilenceConfig struct {
	TimeoutMs *int `json:"timeout_ms,omitempty"`
	Action *string `json:"action,omitempty"`
	Content *string `json:"content,omitempty"`
}

配置智能体的静默行为。

信息

自 v0.11.0 版本新增。

Parameters

Go
type Parameters struct {
	ExtraParams map[string]any
	FixedParams *FixedParams
}

智能体参数配置。

信息

自 v0.11.0 版本新增。

成员参数

参数数据类型描述
ExtraParamsmap[string]any用于灵活键值对的额外参数。
FixedParamsFixedParams类型安全的固定参数,详见 FixedParams。
表格内容超出当前宽度,可横向滚动查看更多列。

ListOption

Go
type ListOption func(*ListOptions)

用于查询智能体列表的过滤条件类型。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
*ListOptionsListOptions
表格内容超出当前宽度,可横向滚动查看更多列。

UpdateReqBody

Go
type UpdateReqBody struct {
	Token string `json:"token"`
	LLM *UpdateLLMBody `json:"llm,omitempty"`
}

调用对话式 AI 引擎的 Update API 时使用的请求体。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Tokenstring用于身份验证的动态密钥(Token)。如果项目启用了 App 证书,必须在此字段中传入项目的动态密钥。
LLMUpdateLLMBody(可选)用于配置智能体的 LLM 设置,详见 UpdateLLMBody。
表格内容超出当前宽度,可横向滚动查看更多列。

UpdateLLMBody

Go
type UpdateLLMBody struct {
	SystemMessages []map[string]any `json:"system_messages,omitempty"`
	Params map[string]any `json:"params,omitempty"`
}

智能体的 LLM 配置。

信息

自 v0.11.0 版本新增。

成员参数

参数数据类型描述
SystemMessages[]map[string]any(可选)附加在每次 LLM 调用开头的一组预定义信息,用于控制 LLM 输出。可以包含角色设置、提示词和回答示例,必须兼容 OpenAI 协议。
Paramsmap[string]any(可选)在 LLM 消息体中传输的附加信息,例如所使用的模型、最大 Token 限制等。不同的 LLM 供应商支持不同的配置,详见各自的 LLM 文档。
表格内容超出当前宽度,可横向滚动查看更多列。

ErrResponse

Go
type ErrResponse struct {
	Detail string `json:"detail"`
	Reason string `json:"reason"`
}

调用对话式 AI 引擎 API 返回的错误响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Detailstring错误详情。
Reasonstring错误原因。
表格内容超出当前宽度,可横向滚动查看更多列。

Response

Go
type Response struct {
	*agora.BaseResponse
	ErrResponse ErrResponse
}

调用对话式 AI 引擎 API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
*agora.BaseResponseBaseResponseHTTP 基础响应,详见 BaseResponse。
ErrResponseErrResponse错误响应,详见 ErrResponse。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinSuccessResp

Go
type JoinSuccessResp struct {
	AgentId string `json:"agent_id"`
	CreateTs int `json:"create_ts"`
	Status string `json:"status"`
}

调用 Join API 返回的成功响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
AgentIdstring智能体的唯一标识。
CreateTsint智能体的创建时间戳。
Statusstring

智能体的运行状态:

  • IDLE (0):智能体处于空闲状态。
  • STARTING (1):智能体正在启动。
  • RUNNING (2):智能体正在运行。
  • STOPPING (3):智能体正在停止。
  • STOPPED (4):智能体已停止。
  • RECOVERING (5):智能体正在恢复。
  • FAILED (6):智能体运行失败。
表格内容超出当前宽度,可横向滚动查看更多列。

JoinResp

Go
type JoinResp struct {
	Response
	SuccessResp JoinSuccessResp
}

调用 Join API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessRespJoinSuccessResp成功响应,详见 JoinSuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

LeaveResp

Go
type LeaveResp struct {
	Response
}

调用 Leave API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse对话式 AI 引擎 API 返回的响应,详见 Response。
表格内容超出当前宽度,可横向滚动查看更多列。

ListSuccessResp

Go
type ListSuccessResp struct {
	Data struct {
		Count int `json:"count"`
		List []struct {
			StartTs int64 `json:"start_ts"`
			Status string `json:"status"`
			AgentId string `json:"agent_id"`
		} `json:"list"`
	} `json:"data"`
	Meta struct {
		Cursor string `json:"cursor"`
		Total int `json:"total"`
	} `json:"meta"`
	Status string `json:"status"`
}

调用 List API 的成功响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Datastruct智能体数据信息。
Countint本次返回的智能体数量。
List[]struct符合条件的智能体列表。
StartTsint64智能体的创建时间戳。
Statusstring

智能体运行状态:

  • IDLE (0):智能体处于空闲状态。
  • STARTING (1):智能体正在启动。
  • RUNNING (2):智能体正在运行。
  • STOPPING (3):智能体正在停止。
  • STOPPED (4):智能体已完成退出。
  • RECOVERING (5):智能体正在恢复中。
  • FAILED (6):智能体执行失败。
AgentIdstring智能体的唯一标识符。
Metastruct返回列表的元信息。
Cursorstring分页游标。
Totalint符合查询条件的智能体总数。
Statusstring请求状态。
表格内容超出当前宽度,可横向滚动查看更多列。

ListResp

Go
type ListResp struct {
	Response
	SuccessRes ListSuccessResp
}

调用 List API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse调用智能对话引擎 API 返回的响应,详见 Response。
SuccessResListSuccessResp成功响应,详见 ListSuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

QuerySuccessResp

Go
type QuerySuccessResp struct {
	Message string `json:"message"`
	StartTs int64 `json:"start_ts"`
	StopTs int64 `json:"stop_ts"`
	AgentId string `json:"agent_id"`
	Status string `json:"status"`
}

调用 Query API 返回的成功响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
Messagestring请求信息。
StartTsint64智能体的创建时间戳。
StopTsint64智能体的停止时间戳。
AgentIdstring智能体的唯一标识符。
Statusstring

智能体的运行状态:

  • IDLE (0):智能体处于空闲状态。
  • STARTING (1):智能体正在启动。
  • RUNNING (2):智能体正在运行。
  • STOPPING (3):智能体正在停止。
  • STOPPED (4):智能体已停止。
  • RECOVERING (5):智能体正在恢复。
  • FAILED (6):智能体运行失败。
表格内容超出当前宽度,可横向滚动查看更多列。

QueryResp

Go
type QueryResp struct {
	Response
	SuccessRes QuerySuccessResp
}

调用对话式 AI 引擎的 Query API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse(必填)由对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessResQuerySuccessResp(必填)成功响应,详见 QuerySuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

UpdateSuccessResp

Go
type UpdateSuccessResp struct {
	AgentId string `json:"agent_id"`
	CreateTs int `json:"create_ts"`
	State string `json:"state"`
}

调用 Update API 返回的成功响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
AgentIdstring智能体的唯一标识。
CreateTsint智能体的创建时间戳。
Statestring

智能体的运行状态:

  • IDLE (0):智能体处于空闲状态。
  • STARTING (1):智能体正在启动。
  • RUNNING (2):智能体正在运行。
  • STOPPING (3):智能体正在停止。
  • STOPPED (4):智能体已停止。
  • RECOVERING (5):智能体正在恢复。
  • FAILED (6):智能体运行失败。
表格内容超出当前宽度,可横向滚动查看更多列。

UpdateResp

Go
type UpdateResp struct {
	Response
	SuccessResp UpdateSuccessResp
}

调用 Update API 返回的响应。

信息

自 v0.7.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessRespUpdateSuccessResp成功响应,详见 UpdateSuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

SpeakBody

Go
type SpeakBody struct {
	Text *string `json:"text"`
	Priority *string `json:"priority,omitempty"`
	Interruptable *bool `json:"interrupt,omitempty"`
}

Speak API 的请求体。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
Textstring要播报的文本内容,最大长度为 512 字节。
Prioritystring

语音播报行为的优先级,支持以下取值:

  • "INTERRUPT"(默认):高优先级,中断并播报。智能体将终止当前交互并直接播报该消息。
  • "APPEND":中等优先级,追加播报。智能体将在当前交互完成后播报该消息。
  • "IGNORE":低优先级,空闲时播报。如果智能体当前正在交互,则会直接忽略并丢弃该消息;仅当智能体处于非交互状态时才会播报该消息。
Interruptablebool

是否允许用户说话来打断智能体的播报:

  • true(默认):允许。
  • false:不允许。
表格内容超出当前宽度,可横向滚动查看更多列。

HistoryResp

Go
type HistoryResp struct {
	Response
	SuccessRes HistorySuccessResp
}

调用 History API 返回的响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse由对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessResHistorySuccessResp成功响应,详见 HistorySuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

HistorySuccessResp

Go
type HistorySuccessResp struct {
	StartTs int64 `json:"start_ts"`
	AgentId string `json:"agent_id"`
	Status string `json:"status"`
	Contents []HistoryContent `json:"contents"`
}

调用 History API 返回的成功响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
StartTsint64智能体的创建时间戳。
AgentIdstring智能体的唯一标识符。
Statusstring仅返回智能体的运行状态。
Contents[]HistoryContent智能体的短期记忆内容,详见 HistoryContent。
表格内容超出当前宽度,可横向滚动查看更多列。

HistoryContent

Go
type HistoryContent struct {
	Role string `json:"role"`
	Content string `json:"content"`
}

智能体的短期记忆内容。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
Rolestring

发送消息的角色:

  • user:用户。
  • assistant:智能体。
Contentstring消息的内容。
表格内容超出当前宽度,可横向滚动查看更多列。

InterruptResp

Go
type InterruptResp struct {
	Response
	SuccessRes InterruptSuccessResp
}

调用 Interrupt API 返回的响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessResInterruptSuccessResp成功响应,详见 InterruptSuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

InterruptSuccessResp

Go
type InterruptSuccessResp struct {
	Channel string `json:"channel"`
	AgentId string `json:"agent_id"`
	StartTs int64 `json:"start_ts"`
}

调用中断对话式 AI 引擎的 API 后返回的成功响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
Channelstring智能体所属的频道场景名称。
AgentIdstring智能体的唯一标识符。
StartTsint64智能体的启动时间戳。
表格内容超出当前宽度,可横向滚动查看更多列。

SpeakResp

Go
type SpeakResp struct {
	Response
	SuccessRes SpeakSuccessResp
}

调用 Speak API 返回的响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
ResponseResponse对话式 AI 引擎 API 返回的响应,详见 Response。
SuccessResSpeakSuccessResp成功响应,详见 SpeakSuccessResp。
表格内容超出当前宽度,可横向滚动查看更多列。

SpeakSuccessResp

Go
type SpeakSuccessResp struct {
	Channel string `json:"channel"`
	AgentId string `json:"agent_id"`
	StartTs int64 `json:"start_ts"`
}

调用 Speak API 返回的成功响应。

信息

自 v0.9.0 版本新增。

成员参数

参数数据类型描述
Channelstring智能体的频道名。
AgentIdstring智能体的唯一标识符。
StartTsint64智能体的启动时间戳。
表格内容超出当前宽度,可横向滚动查看更多列。