This topic was translated by AI and is currently in queue for revision by our editors. Alibaba Cloud does not guarantee the accuracy of AI-translated content. Request expedited revision

Pass user information to Model Studio or a self-developed model

Updated at: 2025-08-08 05:54

This topic describes how to pass business parameters to Alibaba Cloud Model Studio or your self-developed large model.

Function overview

Business parameter pass-through is a mechanism that transmits key business data between components in a distributed system or service invocation chain. This data, such as user context, environment tags, user IDs, and membership information, is passed securely and coherently without data loss. The main goal is to maintain business logic integrity and observability. This process ensures that data is not tampered with, lost, or fragmented during transmission.

Scenarios

In an agent application, you can pass parameters to an Alibaba Cloud Model Studio large model or your self-developed large model as needed. In an intelligent customer service scenario, business parameters such as the type of user inquiry, the relevant business sector, and past inquiry records are passed to the large model. The model can then understand the context of the user's problem based on these parameters. This allows the model to provide more accurate and context-aware answers, significantly improving customer service efficiency and user satisfaction. For example, in the E-commerce intelligent customer service realm, by passing information about the products a user has purchased, the large model can quickly resolve user issues related to product usage and after-sales service.

Implementation

Audio and video agent
Messaging agent

Pass through to an Alibaba Cloud Model Studio large model

  • Server-side startup: Call the GenerateAIAgentCall or StartAIAgentInstance API and configure the AIAgentConfig parameter. For more information about the AIAgentConfig parameter, see AIAgentConfig.

  • Client-side startup: In the AIAgentConfig parameter, the parameter for passing data to Alibaba Cloud Model Studio is BailianAppParams. Convert the BailianAppParams parameter to a JSON string and pass it to TemplateConfig. For more information about the BailianAppParams parameter, see Model Studio parameter details.

Client-side sample code
Android
iOS
Web
// Create an ARTCAICallConfig object and configure ARTCAICallAgentTemplateConfig.
ARTCAICallEngine.ARTCAICallConfig artcaiCallConfig = new ARTCAICallEngine.ARTCAICallConfig();
 
// Configure the bailianAppParams parameter of agentConfig. This is a JSON string.
artcaiCallConfig.agentConfig.llmConfig.bailianAppParams = "XXX";

// Omit the call initiation process.
// Configure the bailianAppParams parameter of agentConfig.
let agentConfig = ARTCAICallAgentConfig()         // Create an ARTCAICallAgentConfig object.
agentConfig.llmConfig.bailianAppParams = ["xxx", "xxxx"]
// Omit the call initiation process.
... 
// Configure the aiAgentBailianAppParams parameter of agentConfig.
const agentConfig = new AICallAgentConfig(); // Create an ARTCAICallAgentConfig object.
agentConfig.llmConfig.bailianAppParams = {
  // Configure the bailianAppParams parameter.
};

// Omit the call initiation process.

Pass through to a self-developed large model

After the agent starts, to learn how to retrieve the custom userData data that you passed, see Standard interfaces for self-developed LLMs.

Client-side sample code
Android
iOS
Web
ARTCAICallEngine.ARTCAICallConfig artcaiCallConfig = new ARTCAICallEngine.ARTCAICallConfig();  // Create an ARTCAICallConfig object. For more information, see the user guide.
artcaiCallConfig.userData = "{\"xxx\": \"xxx\"}"  // Set the business parameters for the model.
...                                               // Set other parameters as needed.
    
engine.init(artcaiCallConfig);                    // Initialize the engine.
engine.call(token);                               // Initiate the call.
let callConfig = ARTCAICallConfig()        // Create an ARTCAICallConfig object. For more information, see the user guide.
callConfig.userData = ["xxx": "xxxx"]      // Set the business parameters for the model.
...                                        // Set other parameters as needed.
    
self.engine.call(config: callConfig)       // Initiate the call.
const callConfig = {
  // Create an AICallConfig object. For more information, see the user guide.
};

callConfig.userData = JSON.stringify({xxx: 'xxx'})

 // Initiate the call.
engine.callWithConfig(callConfig);

Pass through to an Alibaba Cloud Model Studio large model

  1. Before you configure business parameters using the interface provided by the AICallKit SDK, ensure that the AICallKit SDK library is correctly imported.

  2. ARTCAIChatTemplateConfig is a class used to create a messaging template configuration. Its bailianParam parameter is a JSON string that contains the business parameters to pass to the Alibaba Cloud Model Studio model.

  3. ARTCAIChatEngine is the engine class for managing messaging. You can use the setTemplateConfig method to set the templateConfig in the engine. This ensures that the passed business parameters are included in subsequent interactions with the Alibaba Cloud Model Studio model.

Sample code
Android
iOS
Web
// Parameters for the Alibaba Cloud Model Studio application center. This is a JSON string.
String bailianParam = "XXX";
// Create the TemplateConfig parameter for messaging.
ARTCAIChatEngine.ARTCAIChatTemplateConfig templateConfig= new ARTCAIChatEngine.ARTCAIChatTemplateConfig(bailianParam, "");
// Set the configuration parameters for messaging. mChatEngine is an ARTCAIChatEngine object.               
mChatEngine.setTemplateConfig(templateConfig);
// Create the TemplateConfig parameter for messaging.
let templateConfig = ARTCAIChatTemplateConfig()
// Set the parameters for the Alibaba Cloud Model Studio application center.
templateConfig.bailianAppParams = ["xxx":"xxxxx"]

// Set templateConfig for the messaging engine.              
self.engine.templateConfig = templateConfig
const engine = new AIChatEngine();

// Create the TemplateConfig parameter for messaging.
const templateConfig = new AIChatTemplateConfig();
// Set the parameters for the Alibaba Cloud Model Studio application center.
templateConfig.bailianAppParams = {
  xxx: 'xxxxx',
};

// Set templateConfig for the messaging engine.
engine.templateConfig = templateConfig;

Pass through to a self-developed large model

  1. You can call the setUserData method of the AICallKit SDK to pass business parameters to your self-developed large model. Before you do this, ensure that the SDK library is correctly imported.

  2. The userData parameter is a JSON string that contains the business parameters to pass to the self-developed large model.

  3. You can use the mChatEngine.setUserData() method to set the business parameters in the messaging engine to enable parameter pass-through.

Sample code
Android
iOS
Web
// Self-developed business parameters. This is a JSON string.
String userData = "XXX";
// Set the configuration parameters for messaging. mChatEngine is an ARTCAIChatEngine object.
mChatEngine.setUserData(userData);
// Set self-developed business parameters.
let userData = ["xxx":"xxxxx"]

// Set userData for the messaging engine.              
self.engine.userData = userData
// Set self-developed business parameters.
const userData = { xxx: 'xxxxx' };

// Set userData for the messaging engine.
engine.userData = userData;

Model Studio parameter details

Parameter name

Parameter type

Description

Example

Parameter name

Parameter type

Description

Example

biz_params

Object

The pass-through field for custom parameters in workflow and agent orchestration applications. For more information about passing parameters in Alibaba Cloud Model Studio, see Pass parameters for applications.

Note
  • Alibaba Cloud passes additional agent instance parameters. You do not need to pass them again:

    • instanceId: The ID of the Real-time Conversational AI agent instance.

    • channelId: The RTC channel number for Real-time Conversational AI.

  • To pass parameters to an Alibaba Cloud Model Studio plugin, use user_defined_params. This parameter is not required for Alibaba Cloud Model Studio workflows.

  • Alibaba Cloud Model Studio plugin

{
 "user_defined_params": {
 "city":"Hangzhou"
 }
}
  • Alibaba Cloud Model Studio workflow

{
 "city":"Hangzhou"
}

memory_id

String

A unique identifier for the long-term memory. This parameter saves and retrieves historical information.

YOUR_MEMORY_ID

image_list

Array

A list of image links that provide visual information related to the current operation.

["https://example.com/images/example.jpg"]

rag_options

Object

The retrieval configurations for a knowledge base. These configurations specify how the agent retrieves information from the knowledge base.

  • pipeline_ids

Array

The ID of the knowledge base. This ID is used to identify and invoke a specific knowledge base.

["Knowledge Base ID 1", "Knowledge Base ID 2"]

  • file_ids

Array

The ID of an unstructured document. This ID specifies the unstructured document to process.

["Document ID 1", "Document ID 2"]

  • metadata_filter

Object

The metadata of an unstructured document. Use this metadata to filter and find specific documents.

{

"name": "John Doe"

}

  • structured_filter

Object

The column names and corresponding values used to filter structured documents.

{

"key1": "value1",

"key2": "value2"

}

  • tags

Array

The tags for an unstructured document. These tags help with classification and retrieval.

["Tag 1", "Tag 2"]

For more information, see Alibaba Cloud Model Studio applications. The following code provides parameter examples:

Pass parameters for an Alibaba Cloud Model Studio plugin
Pass parameters for an Alibaba Cloud Model Studio workflow
aliyunBailianParamsJson = {
    "biz_params": {
        "user_defined_params": 
        {
            "your_plugin_id":
            {
                "article_index": 2
            }
        }
    },
    "memory_id": "your_memory_id",
    "image_list": [
        "https://your_image_url"  # Example image URL
    ],
    "rag_options": {
        "pipeline_ids": [
            "your_id",  # Replace with the actual knowledge base ID
        ],
        "file_ids": [
            "Document ID 1",  # Replace with the actual document ID
            "Document ID 2"   # Replace with the actual document ID
        ],
        "metadata_filter": {
            "name": "John Doe"  # Replace with the required metadata filter condition
        },
        "structured_filter": {
            "key1": "value1",  # Example filter condition
            "key2": "value2"   # Example filter condition
        },
        "tags": [
            "Tag 1",  # Replace with the actual tags
            "Tag 2"   # Replace with the actual tags
        ]
    }
}
bailianParams = json.dumps(aliyunBailianParamsJson)

aliyunBailianParamsJson = {
    "biz_params": {
        "key1": "value1"
    },
    "memory_id": "your_memory_id",
    "image_list": [
        "https://your_image_url"  # Example image URL
    ],
    "rag_options": {
        "pipeline_ids": [
            "your_id",  # Replace with the actual knowledge base ID
        ],
        "file_ids": [
            "Document ID 1",  # Replace with the actual document ID
            "Document ID 2"  # Replace with the actual document ID
        ],
        "metadata_filter": {
            "name": "John Doe"  # Replace with the required metadata filter condition
        },
        "structured_filter": {
            "key1": "value1",  # Example filter condition
            "key2": "value2"  # Example filter condition
        },
        "tags": [
            "Tag 1",  # Replace with the actual tags
            "Tag 2"  # Replace with the actual tags
        ]
    }
}
bailianParams = json.dumps(aliyunBailianParamsJson)

  • On this page (1)
  • Function overview
  • Scenarios
  • Implementation
  • Model Studio parameter details
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare
AI Assistant Powered By QWEN