Build an AI chat application with real-time web search using the IQS Web Search Chat Assistant template in LangStudio. Extend and customize the template for your use case.
Preparations
1. Deploy an LLM model service
This application flow requires an LLM model service. If you already have one that supports the OpenAI API, skip this step.
This example uses a DeepSeek-R1 model deployed via EAS. Deploy from Quick Start > Model Gallery. One-click deployment of DeepSeek-V4 and DeepSeek-R1 models. Model deployment and training.
2. Activate Alibaba Cloud Information Query Service
This application flow uses Alibaba Cloud Information Query Service (IQS) to retrieve web search results.
Activate Alibaba Cloud Information Query Service. New user guide.
Create an LLM service connection
Create an LLM service connection using the EAS service deployed in QuickStart > Model Gallery. Connection configuration.
Go to LangStudio, select your workspace, then on the Connection > Model Service tab, click New Connection to set up a generic LLM model service connection.
Set Model Name to DeepSeek-R1-Distill-Qwen-7B and set Tool Call to Not supported.
Key parameters:
|
Parameter |
Description |
|
Service provider |
|
|
Model name |
For models deployed via Model Gallery, find the model name on the model's product page in Model Gallery. Create connection – Model service. |
Create a runtime (execution environment)
The runtime is a PAI-DSW instance that provides the execution environment for LangStudio application flows.
Create a new runtime as described below, or verify that your existing runtime meets these requirements.
On the Runtime tab, click New Runtime.
In the Create Runtime dialog box, enter a Runtime Name, set Resource Source to Public Resources, choose ecs.g6.xlarge (4 vCPU / 16 GiB) for Resource Specification, and select Public Gateway for Internet Access Gateway.
Key parameters:
-
Runtime Working Path: Must match the application flow's working path. Use your workspace's default storage path.
-
Instance RAM Role: Use a custom role.
-
Default Roles of PAI (not recommended): Requires an
api_keyfor IQS web search over the public network, reducing data security. -
Custom Roles (recommended): Uses the RAM role below to access IQS via VPC-based RAM authentication—no public network traffic, higher security.
-
Develop the application flow
-
Go to LangStudio, select your workspace, then on the Application Flow tab, click Create Application Flow.
-
Creation Method: From template.
-
Select template: IQS Web Search Chat Assistant.
-
Select Runtime: Choose the runtime created in Step 2.
-
Working Path: Fills automatically after selecting a runtime.
-
-
On the Application Flow tab, click your application flow to open its details page.
This flow contains four sequential nodes: Start Node (input parameters:
chat_history,question) → Alibaba Cloud IQS – Standard Search → LLM Node → End Node (output parameter:answer).Configure key nodes as follows. Keep other settings at default. Prebuilt component reference.
-
Alibaba Cloud IQS – Standard Search:
-
Time range: Select the time range for search results.
-
IQS connection:
-
If you assigned a RAM role to the runtime in the previous step, no configuration is needed.
-
If the runtime uses the PAI default role, configure an IQS connection. On the Connection tab, choose . Set the custom key to
api_key. Obtain the value from Information Query Service – Credential Management.
-
-
-
LLM Node: Calls a large language model to process natural language queries.
-
Model settings: Select the connection created in Create an LLM service connection.
-
Chat history: Enable to include prior conversation as input.
-
-
-
Click Run in the top-right corner to run the flow. For troubleshooting, see FAQ.
The Run panel on the right shows the interaction result, including user input and the generated response with reference websites.
-
Click View Traces under the answer to view trace details.
The waterfall chart shows the call chain: root span
chat-pfchen-001(CHAIN) includes child spansiqs_generic_search(search) andllm(LLM inference), which callsChatCompletion. Click any span to view its details, including app name, API name, spanId, status code, Attributes, and Resources.
Deploy the application flow
Click Deploy to deploy the flow as an EAS service. Key parameters:
-
Resource Info > Instance Count: Number of service instances. This example uses 1 for testing. In production, use multiple instances for high availability.
-
VPC > Virtual Private Cloud (VPC): IQS depends on Alibaba Cloud Information Query Service. Check Endpoints for regions with VPC access. In unsupported regions, the system falls back to the Zhangjiakou public endpoint. EAS services cannot access the public network by default—configure a VPC with public network access if needed. EAS access to public or private network resources.
-
Role and Permissions > Instance RAM Role: Match the setting used for the runtime instance.
Invoke the service
After deployment, go to PAI-EAS and on the Online Debugging tab, send a request. The key in the request body must match the Start Node's "Dialog Input" field. This example uses the default field question.
Enter sample JSON such as {"question": "What is NVIDIA's stock price?"} and click Send Request. Status Code 200 indicates success. The response body contains the answer.
Other invocation methods including API calls: Application flow deployment – Invoke service.
Clean up resources
-
Stop or delete your runtime after development to avoid charges. Runtime management.
-
If you no longer need the EAS model service:
-
Public resources: Stop or delete the service to prevent ongoing billing.
-
Pay-as-you-go instances: Delete the instances to stop billing.
-
References
-
Before deploying to production, run an application evaluation.
-
Customize this template: Workflow application development.
-
LangStudio billing: Billing for Large Language Model Application Development (LangStudio).