AIGCService API 参考

  • iOS

更新时间

AgoraAIGCService SDK 主要包含以下两大类:

本文提供 AgoraAIGCService SDK 的 API 参考。

AgoraAIGCService

create

Objective-C
+ (instancetype)create;

创建 AgoraAIGCService 实例。

返回值

成功创建后,该方法会返回一个 AgoraAIGCService 实例。

initialize

Objective-C
- (void)initialize:(AgoraAIGCConfigure *)config;

初始化 AgoraAIGCService。

该方法为异步操作。调用结果会在 onEventResultWithEvent 回调中返回。

参数

参数描述
configAgoraAIGC 初始化参数。详见 AgoraAIGCConfigure。
表格内容超出当前宽度,可横向滚动查看更多列。

getRoles

Objective-C
- (NSArray <AgoraAIGCAIRole *>* _Nullable)getRoles;

获取 SDK 支持的所有的 AgoraAIGCAIRole 数组。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

返回值

SDK 支持的 AgoraAIGCAIRole 数组。

setRoleWithId

Objective-C
- (void)setRoleWithId:(NSString *)roleId;

设置 SDK 使用的 AgoraAIGCAIRole。该方法设置即时生效。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

参数

参数描述
roleId标明 AgoraAIGCAIRole 的 ID。
表格内容超出当前宽度,可横向滚动查看更多列。

getCurrentRole

Objective-C
(AgoraAIGCAIRole * _Nullable)getCurrentRole;

获取当前使用的 AgoraAIGCAIRole。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

返回值

当前使用的 AgoraAIGCAIRole。

getServiceVendors

Objective-C
- (AgoraAIGCServiceVendorGroup * _Nullable)getServiceVendors;

获取所有 AI 服务商的信息。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

返回值

包含了所有 AI 服务商信息的 AgoraAIGCServiceVendorGroup 对象,由多个 AgoraAIGCSTTVendor、AgoraAIGCLLMVendor 和 AgoraAIGCTTSVendor 组成。

setServiceVendor

Objective-C
- (AgoraAIGCServiceCode)setServiceVendor:(AgoraAIGCServiceVendor *)vendor;

设置所使用的 AI 服务商。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

参数

参数描述
vendor设置的服务商对象 AgoraAIGCServiceVendor,包含 AgoraAIGCSTTVendor、AgoraAIGCLLMVendor 和 AgoraTTSVendor。每种类型只支持设置一个服务商。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

start

Objective-C
- (void)start;

开启 AgoraAIGCService 服务。

该方法为异步操作。调用结果会在 onEventResultWithEvent 回调中返回。

注意

该方法需要在成功调用 initialize,且收到 onEventResultWithEvent(Initialize, Success) 后调用。

stop

Objective-C
- (void)stop;

停止 AgoraAIGCService 服务。

该方法为异步操作。调用结果会在 onEventResultWithEvent 回调中返回。

注意

该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。

pushSpeechDialogueWithData

Objective-C
- (AgoraAIGCServiceCode)pushSpeechDialogueWithData:(NSData *)data
                                               vad:(AgoraAIGCVad)vad
                                       isLastFrame:(BOOL)isLastFrame;

推送采集到的音频数据到 SDK。

注意

该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。

参数

参数描述
data待推送的音频数据。
vad本地是否有人声。详见 AgoraAIGCVad。
isLastFrame

是否是最后一帧音频数据:

  • true:是
  • false:不是

该参数仅在 setSTTMode 设置为 AgoraAIGCServiceSTTModeControlled 时有效。

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

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

pushTxtDialogue

Objective-C
- (AgoraAIGCServiceCode)pushTxtDialogue:(NSString *)text roundId:(NSString * _Nullable)roundId;

推送采集到的文本数据到 SDK 的 LLM 模块,用于 LLM 处理文本数据。

该方法和 pushMessagesToLlm 均可用于推送文本数据到 LLM 模块,区别为该方法仅支持推送单条消息,pushMessagesToLlm 支持推送多条消息(消息及其上下文语境)。

注意

  • 该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。
  • 建议文本数据的长度不超过 1 KB。对高于 1 KB 的数据我们不保证能正确处理。

参数

参数描述
text待推送的文本数据。
roundId

请求的 roundId,可为空。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果自行设置 roundId,为准确区分不同请求,请确保设置的 ID 全局唯一;
  • 如果 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

pushMessagesToLlm

Objective-C
- (AgoraAIGCServiceCode)pushMessagesToLlm:(NSString *)messagesJsonArray
                            extraInfoJson:(NSString * _Nullable)extraInfoJson
                                  roundId:(NSString * _Nullable)roundId;

推送请求数据的 JSON 数组和其他字段信息到 LLM 模块,用于 LLM 处理相应请求数据。

该方法和 pushTxtDialogue 均可用于推送文本数据到 LLM 模块,区别为 pushTxtDialogue 仅支持推送单条消息,该方法支持推送多条消息(消息及其上下文语境)。

注意

  • 该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。
  • 建议 JSON 数据的长度不超过 1 KB。对高于 1 KB 的数据我们不保证能正确处理。

参数

参数描述
messagesJsonArray请求数据的 JSON 数组。
extraInfoJson其他特定字段信息的 JSON。
roundId

请求的 roundId,可为空。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果自行设置 roundId,为准确区分不同请求,请确保设置的 ID 全局唯一;
  • 如果 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

pushTxtToTTS

Objective-C
- (AgoraAIGCServiceCode)pushTxtToTTS:(NSString *)text roundId:(NSString * _Nullable)roundId;

推送采集到的文本数据到 SDK 的 TTS 模块,用于 TTS 播报文本。

注意

  • 该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。
  • 建议文本数据的长度不超过 1 KB。对高于 1 KBB 的数据我们不保证能正确处理。

参数

参数描述
text待推送的文本数据。
roundId

请求的 roundId,可为空。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果自行设置 roundId,为准确区分不同请求,请确保设置的 ID 全局唯一;
  • 如果 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

interrupt

Objective-C
- (void)interrupt:(AgoraAIGCServiceInterruptMask)mask;

中断指定服务。

注意

该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。

参数

参数描述
mask服务类型的掩码值。详见 AgoraAIGCServiceInterruptMask。服务类型支持使用按位或运算符(|)进行组合,例:mask = AgoraAIGCServiceInterruptMaskSTT | AgoraAIGCServiceInterruptMaskLLM 代表同时中断 STT 和 LLM 服务。
表格内容超出当前宽度,可横向滚动查看更多列。

setSTTMode

Objective-C
- (AgoraAIGCServiceCode)setSTTMode:(AgoraAIGCServiceSTTMode)mode;

设置 STT 服务的模式。

注意

该方法需要在成功调用 start,且收到 onEventResultWithEvent(Start, Success) 后调用。

参数

参数描述
modeSTT 服务模式。详见 AgoraAIGCServiceSTTMode。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

setPrompt

Objective-C
- (AgoraAIGCServiceCode)setPrompt:(NSString *)prompt;

设置大语言模型的 Prompt 信息。

注意

该方法需要在成功 init,且收到 onEventResultWithEvent(Initialize, Success) 后,且 start 前调用。

参数

参数描述
promptPrompt 信息。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

该方法调用的结果,详见 AgoraAIGCServiceCode。

getSdkVersion

Objective-C
+ (NSString *)getSdkVersion;

获取 AIGCService SDK 的版本号。

返回值

当前 SDK 的版本号。

destroy

Objective-C
+ (void)destory;

销毁 AgoraAIGCService 实例。

该方法为异步操作。调用结果会在 onEventResultWithEvent 回调中返回。

AgoraAIGCServiceDelegate

onEventResultWithEvent

Objective-C
- (void)onEventResultWithEvent:(AgoraAIGCServiceEvent)event
                          code:(AgoraAIGCServiceCode)code
                       message:(NSString * _Nullable)message;

AIGCService 实例事件回调。

该回调在 SDK 调用 initialize、start、stop、destroy 后触发,报告对应方法的调用结果。

参数

参数描述
event该服务事件的类型,详见 AgoraAIGCServiceEvent。
code该服务事件的结果,详见 AgoraAIGCServiceCode。
message事件信息。该字串可能为空。
表格内容超出当前宽度,可横向滚动查看更多列。

onSpeech2TextWithRoundId

Objective-C
- (AgoraAIGCHandleResult)onSpeech2TextWithRoundId:(NSString *)roundId
                                           result:(NSString *)result
                                 recognizedSpeech:(BOOL)recognizedSpeech
                                             code:(AgoraAIGCServiceCode)code;

报告语音转文字 (STT) 处理后的结果。

参数

参数描述
roundId

请求的 roundId。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果你在推送时设置了 roundId,回调中沿用你设置的 roundId;
  • 如果推送时 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
result语音识别出来的文字(UTF-8 字符集)。该参数为只读模式。
recognizedSpeech

该回调返回的 result 是否是一个完整的句子:

  • YES:是
  • NO:不是
codeSTT 语音识别结果。详见 AgoraAIGCServiceCode。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

AgoraAIGCHandleResult,该回调的处理结果类型。你需要设置该返回值:

  • AgoraAIGCHandleResultContinue:SDK 会继续处理后续流程
  • AgoraAIGCHandleResultDiscard:SDK 会中断处理后续流程

注意

该规则仅在 recognizedSpeech 返回 YES 下有效。

onLLMResultWithRoundId

Objective-C
- (AgoraAIGCHandleResult)onLLMResultWithRoundId:(NSString *)roundId
                                         answer:(NSString *)answer
                                     isRoundEnd:(BOOL)isRoundEnd
                        estimatedResponseTokens:(NSUInteger)tokens
                                           code:(AgoraAIGCServiceCode)code;

回调大语言模型 (LLM) 处理后的结果。

参数

参数描述
roundId

请求的 roundId。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果你在推送时设置了 roundId,回调中沿用你设置的 roundId;
  • 如果推送时 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
answer大语言模型处理后的结果(UTF-8 字符集)。该参数为只读模式。
isRoundEnd

本轮大语言模型返回结果是否结束:

  • YES:是。
  • NO:否。
tokens本轮 LLM 大模型处理返回内容大约消耗的 Token 数。该数值只是估算值,不作为计费标准,你可以利用该值监测并限制 Token 的消耗。如果返回的 token 为 0,可忽略该值。
codeLLM 大模型处理结果。详见 AgoraAIGCServiceCode。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

AgoraAIGCHandleResult,该回调的处理结果类型。你需要设置该返回值:

  • AgoraAIGCHandleResultContinue:SDK 会继续处理后续流程
  • AgoraAIGCHandleResultDiscard:SDK 会中断处理后续流程

onText2SpeechResultWithRoundId

Objective-C
- (AgoraAIGCHandleResult)onText2SpeechResultWithRoundId:(NSString *)roundId
                                             voice:(NSData *)voice
                                       sampleRates:(NSInteger)sampleRates
                                          channels:(NSInteger)channels
                                              bits:(NSInteger)bits
                                              code:(AgoraAIGCServiceCode)code;

回调文字转语音 (TTS) 处理后的结果。

参数

参数描述
roundId

请求的 roundId。用于跟踪后续 LLM/TTS 对应关系的 ID,你可以利用该参数在 UI 层实现相关的业务逻辑。

  • 如果你在推送时设置了 roundId,回调中沿用你设置的 roundId;
  • 如果推送时 roundId 为空,SDK 内部会分配一个 roundId,并在每形成一个完整句子时更新为新的 roundId。
voice文字转语音处理后的语音数据。该参数为读写模式。如果 voice 参数被修改,后续流程会用更新后的 voice 参数值作为输入。
sampleRates语音数据 (PCM) 的采样率,单位为 Hz。
channels语音数据 (PCM) 的通道数。
bits语音数据 (PCM) 的位数。
codeTTS 文本转语音处理结果。详见 AgoraAIGCServiceCode。
表格内容超出当前宽度,可横向滚动查看更多列。

返回值

AgoraAIGCHandleResult,该回调的处理结果类型。你需要设置该返回值:

  • AgoraAIGCHandleResultContinue:SDK 会继续处理后续流程
  • AgoraAIGCHandleResultDiscard:SDK 会中断处理后续流程

信息

该回调是目前最后一个业务流程,返回值 Continue 和 Discard 效果一样,均不会影响后续业务。后续版本中我们可能会在该回调后添加其他业务。

onSpeechStateChange

Objective-C
- (void)onSpeechStateChange:(AgoraAIGCServiceSpeechState)state;

识别语音开始和结束的状态。

参数

参数描述
state语音的状态。详见 AgoraAIGCServiceSpeechState。
表格内容超出当前宽度,可横向滚动查看更多列。

类型定义

AgoraAIGCConfigure

Objective-C
@interface AgoraAIGCConfigure : NSObject
@property (nonatomic, copy, readonly)NSString *appId;
@property (nonatomic, copy, readonly)NSString *rtmToken;
@property (nonatomic, copy, readonly)NSString *userId;
@property (nonatomic, assign, readonly)BOOL enableMultiTurnShortTermMemory;
@property (nonatomic, assign, readonly)NSUInteger speechRecognitionFiltersLength;
@property (nonatomic, strong, readonly)AgoraAIGCSceneMode *input;
@property (nonatomic, strong, readonly)AgoraAIGCSceneMode *output;
@property (nonatomic, assign, readonly)BOOL enableLog;
@property (nonatomic, assign, readonly)BOOL enableSaveLogToFile;
@property (nonatomic, copy, readonly, nullable)NSString *logFilePath;
@property (nonatomic, copy, readonly)NSString *userName;
@property (nonatomic, assign, readonly)BOOL enableChatIdleTip;
@property (nonatomic, assign, readonly) AgoraNoiseEnvironment noiseEnvironment;
@property (nonatomic, assign, readonly) AgoraSpeechRecognitionCompletenessLevel speechRecognitionCompletenessLevel;

- (instancetype)initWithAppId:(NSString *)appId
                     rtmToken:(NSString *)rtmToken
                       userId:(NSString *)userId
enableMultiTurnShortTermMemory:(BOOL)enableMultiTurnShortTermMemory
speechRecognitionFiltersLength:(NSUInteger)speechRecognitionFiltersLength
                        input:(AgoraAIGCSceneMode *)input
                       output:(AgoraAIGCSceneMode *)output
                    enableLog:(BOOL)enableLog
          enableSaveLogToFile:(BOOL)enableSaveLogToFile
                  logFilePath:(NSString *)logFilePath
                     userName:(NSString *)userName;
            enableChatIdleTip:(BOOL)enableChatIdleTip;
             noiseEnvironment:(AgoraNoiseEnvironment)noiseEnvironment
speechRecognitionCompletenessLevel:(AgoraSpeechRecognitionCompletenessLevel)speechRecognitionCompletenessLevel;
- (instancetype)init __attribute__((unavailable("Use initWithAppId instead")));
- (NSString *)description;
@end

AgoraAIGCConfigure 的初始化配置。

参数描述
appId声网项目的 App ID。
rtmToken声网项目的 RTM Token。
userId用户 ID。
enableMultiTurnShortTermMemory

是否开启多轮短时记忆:

  • YES:是。开启后,后续流程的处理会结合上下文语境。
  • NO:否。

注意

该参数配置在调用 pushMessagesToLlm 时无效。

speechRecognitionFiltersLength过滤语音识别结果的字数长度。
input输入参数,详见 AgoraAIGCSceneMode。
output输出参数,详见 AgoraAIGCSceneMode。
enableLog

是否开启日志输出到 IDE 的控制台:

  • YES:是。
  • NO:否。
enableSaveLogToFile

是否保存日志到文件系统:

  • YES:是。
  • NO:否。

注意

该参数的设置只有在 enableLog 为 YES 时才生效。

logFilePath设置 Log 的存储路径。如果不设或设为空字串,SDK 会使用默认的存储路径。
userName用户名。
enableChatIdleTip

是否开启闲时聊天提示信息:

  • YES:是。
  • NO:(默认)否。
noiseEnvironment设置噪音环境级别,详见 AgoraNoiseEnvironment。SDK会根据你的设置等级,相应地处理环境噪音对语音数据的影响。
speechRecognitionCompletenessLevel设置语音识别句子完整度级别,详见 AgoraSpeechRecognitionCompletenessLevel。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCAIRole

Objective-C
@interface AgoraAIGCAIRole : NSObject
@property (nonatomic, copy, readonly)NSString *roleId;
@property (nonatomic, copy, readonly)NSString *roleName;
/// means description
@property (nonatomic, copy, readonly)NSString *desc;
@property (nonatomic, copy, readonly)NSString *profession;
/// ["male","female"]
@property (nonatomic, copy, readonly)NSString *gender;

- (instancetype)initWithRoleId:(NSString *)roleId
                      roleName:(NSString *)roleName
                          desc:(NSString *)desc
                    profession:(NSString *)profession
                        gender:(NSString *)gender;
@end

AI 服务的属性。

参数描述
roleIdAI 服务的 ID,是 AI 服务的唯一标识。
roleNameAI 服务的名称。
descAI 服务的简单介绍。
professionAI 服务的职业。
genderAI 服务的性别:"male" 表示男性,"female" 表示女性。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCSceneMode

Objective-C
@interface AgoraAIGCSceneMode : NSObject
@property (nonatomic, assign, readonly)AgoraAIGCLanguage language;
@property (nonatomic, assign, readonly)NSUInteger speechFrameBits;
@property (nonatomic, assign, readonly)NSUInteger speechFrameSampleRates;
@property (nonatomic, assign, readonly)NSUInteger speechFrameChannels;

- (instancetype)initWithLanguage:(AgoraAIGCLanguage)language
                 speechFrameBits:(NSUInteger)speechFrameBits
          speechFrameSampleRates:(NSUInteger)speechFrameSampleRates
             speechFrameChannels:(NSUInteger)speechFrameChannels;
- (instancetype)init __attribute__((unavailable("Use initWithLanguage instead")));
@end

AgoraAIGCConfigure 中 input 和 output 参数的详细配置项。

参数描述
language语言类型,详见 AgoraAIGCLanguage。
speechFrameBits语音数据 (PCM) 的位数。SDK 仅支持 16。
speechFrameSampleRates语音数据 (PCM) 的采样率。SDK 仅支持 16000。
speechFrameChannels语音数据 (PCM) 的通道数。SDK 仅支持 1。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCSTTVendor

Objective-C
@interface AgoraAIGCSTTVendor : AgoraAIGCBaseVendor
@property (nonatomic, copy, readonly)NSString *Id;
@property (nonatomic, copy, readonly)NSString *vendorName;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson Id:(NSString *)Id vendorName:(NSString *)vendorName;
- (instancetype)init __attribute__((unavailable("Use initWithAccountInJson:Id:vendorName instead")));
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson __attribute__((unavailable("Use initWithAccountInJson:Id:vendorName instead")));
@end

@interface AgoraAIGCBaseVendor : NSObject
@property (nonatomic, copy, nullable, readonly)NSString *accountInJson;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson;
@end

语音转文字的供应商信息。

参数描述
Id语音转文字供应商的 ID。
vendorName供应商名称。
accountInJson供应商自有的账号信息。若使用该字段,联系 sales@shengwang.cn 了解字段的 JSON 格式。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCLLMVendor

Objective-C
@interface AgoraAIGCLLMVendor : AgoraAIGCBaseVendor
@property (nonatomic, copy, readonly)NSString *Id;
@property (nonatomic, copy, readonly)NSString *vendorName;
@property (nonatomic, copy, readonly)NSString *model;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson
                                    Id:(NSString *)Id
                            vendorName:(NSString *)vendorName
                                 model:(NSString *)model;
- (instancetype)init __attribute__((unavailable("Use initWithAccountInJson:Id:vendorName:model instead")));
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson __attribute__((unavailable("Use initWithAccountInJson:Id:vendorName:model instead")));
@end

@interface AgoraAIGCBaseVendor : NSObject
@property (nonatomic, copy, nullable, readonly)NSString *accountInJson;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson;
@end

大语言模型的供应商信息。

参数描述
Id大语言模型供应商的 ID。
vendorName供应商名称。
model模型参数。
accountInJson供应商自有的账号信息。若使用该字段,联系 sales@shengwang.cn 了解字段的 JSON 格式。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCTTSVendor

Objective-C
@interface AgoraAIGCTTSVendor : AgoraAIGCBaseVendor
@property (nonatomic, copy, readonly)NSString *Id;
@property (nonatomic, copy, readonly)NSString *language;
@property (nonatomic, copy, readonly)NSString *voiceName;
@property (nonatomic, copy, readonly)NSString *voiceNameValue;
@property (nonatomic, copy, readonly)NSString *vendorName;
@property (nonatomic, copy, readonly)NSString *voiceStyle;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson
                                    Id:(NSString *)Id
                              language:(NSString *)language
                             voiceName:(NSString *)voiceName
                        voiceNameValue:(NSString *)voiceNameValue
                            vendorName:(NSString *)vendorName
                            voiceStyle:(NSString *)voiceStyle;
- (instancetype)init __attribute__((unavailable("Use initWithAccountInJson instead")));
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson __attribute__((unavailable("Use initWithAccountInJson:Id:language:voiceName:voiceNameValue:vendorName:voiceStyle instead")));
@end

@interface AgoraAIGCBaseVendor : NSObject
@property (nonatomic, copy, nullable, readonly)NSString *accountInJson;
- (instancetype)initWithAccountInJson:(NSString * _Nullable)accountInJson;
@end

文字转语音的供应商信息。

参数描述
Id文字转语音供应商的 ID。
language所支持的语言。如果为空,则表示支持所有语言。
voiceName发言人名称,仅用于标签上展示的名称。
voiceNameValue发言人名称参数值。
vendorName供应商名称。
voiceStyle(选填)发言人风格参数值。
accountInJson供应商自有的账号信息。若使用该字段,联系 sales@shengwang.cn 了解字段的 JSON 格式。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCServiceEvent

服务事件类型。

枚举名枚举值描述
AgoraAIGCServiceEventIdle0初始状态。
AgoraAIGCServiceEventInitialize1初始化状态,对应调用 initialize 方法。
AgoraAIGCServiceEventStart2启动状态,对应调用 start 方法。
AgoraAIGCServiceEventStop3停止服务状态,对应调用 stop 方法。
AgoraAIGCServiceEventDestory4销毁服务状态,对应调用 destroy 方法。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCServiceCode

服务事件结果。

枚举名枚举值描述
AgoraAIGCServiceCodeErrorGeneral-1通用错误。
AgoraAIGCServiceCodeSuccess0成功。
AgoraAIGCServiceCodeInitializeFail1初始化失败。
AgoraAIGCServiceCodeStartFail2启动失败。
AgoraAIGCServiceCodeLicenseExpire5License 过期。
AgoraAIGCServiceCodeTimeout9服务超时。
AgoraAIGCServiceCodeContentManagementPolicy10LLM 判定请求内容不合规,触发内容审核。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCVad

本地是否有人声。

枚举名枚举值描述
AgoraAIGCVadUnknow-1不确定。
AgoraAIGCVadMute0本地无人声。
AgoraAIGCVadNonMute1本地有人声。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCLanguage

语言类型。

枚举名枚举值描述
AgoraAIGCLanguageZH_CN0中文。
AgoraAIGCLanguageEN_US1英文。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraNoiseEnvironment

噪音环境级别。

枚举名枚举值描述
AgoraNoiseEnvironmentQuiet0周围环境噪音很少,比较安静。
AgoraNoiseEnvironmentNormal1周围环境噪音正常。
AgoraNoiseEnvironmentNoise2周围环境噪音很强。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraSpeechRecognitionCompletenessLevel

语音识别句子的完整性级别。级别越高,则识别句子的完整性越好;相应地,语音识别的整体时间也会越长。

枚举名枚举值描述
AgoraSpeechRecognitionCompletenessLevelLow0低级别。
AgoraSpeechRecognitionCompletenessLevelNormal1正常级别。
AgoraSpeechRecognitionCompletenessLevelHigh2高级别。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCServiceInterruptMask

服务类型的掩码值。

枚举名枚举值描述
AgoraAIGCServiceInterruptMaskSTT0b0001STT 服务类型值。
AgoraAIGCServiceInterruptMaskLLM0b0010LLM 服务类型值。
AgoraAIGCServiceInterruptMaskTTS0b0100TTS 服务类型值。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCServiceSTTMode

STT 服务模式类型。

枚举名枚举值描述
AgoraAIGCServiceSTTModeFreeStyle0(默认)自由模式,适用于实时对话、实时语音识别。
AgoraAIGCServiceSTTModeControlled1受控模式,适用于单段语音输入。
表格内容超出当前宽度,可横向滚动查看更多列。

AgoraAIGCServiceSpeechState

语音的状态

枚举名枚举值描述
AgoraAIGCServiceSpeechStateStateStart0语音开始。
AgoraAIGCServiceSpeechStateStateEnd1语音结束。
表格内容超出当前宽度,可横向滚动查看更多列。

这个页面有帮助吗?