If you integrate a large language model (LLM) from Alibaba Cloud Model Studio to a workflow of AI real-time interaction, you can configure a knowledge base and pass through custom parameters to the LLM for a specific call. This topic introduces how to do so.
Procedure
When invoking the GenerateAIAgentCall or StartAIAgentInstance operations, configure
TemplateConfig
. For details, see AIAgentTemplateConfig.In
TemplateConfig
,BailianAppParams
specifies the parameters passed to Alibaba Cloud Model Studio. ConfigureBailianAppParams
as needed, then convert it into a JSON-formatted string. For details, see Parameters passed to Alibaba Cloud Model Studio.
Sample code
Android
//Create ARTCAICallConfig. Configure ARTCAICallAgentTemplateConfig.
ARTCAICallEngine.ARTCAICallConfig artcaiCallConfig = new ARTCAICallEngine.ARTCAICallConfig();
//Configure aiAgentBailianAppParams. The value must be a JSON string.
artcaiCallConfig.mAiCallAgentTemplateConfig.aiAgentBailianAppParams = "XXX";
//Omit the steps of initiating a call.
iOS
// Create ARTCAICallTemplateConfig and configure bailianAppParams.
let templateConfig = ARTCAICallTemplateConfig()
templateConfig.bailianAppParams = ["xxx", "xxxx"]
// If you use the integration solution with UI, set config.templateConfig when you start a call.
let controller = AUIAICallStandardController(userId: userId)
controller.config.templateConfig = templateConfig
...
// If you use the integration solution without UI, convert templateConfig to a JSON string and use it as a request parameter in StartAIAgentInstance or GenerateAIAgentCall.
let jsonString = templateConfig.getJsonString(agentType)
...
Web
// Create AICallTemplateConfig. Configure wakeUpQuery.
const templateConfig = new AICallTemplateConfig();
templateConfig.bailianAppParams = {
xxx: 'xxxx',
};
// If you use the integration solution with UI, modify src/runConfig.ts.
const runConfig: AICallRunConfig = {
// ...
callTemplateConfig: templateConfig,
// ...
};
// If you use the integration solution without UI, convert templateConfig to a JSON string as a request parameter in StartAIAgentInstance or GenerateAIAgentCall.
const jsonString = templateConfig.getJsonString(agentType)
...