LangStudio data retrieval nodes fetch context from knowledge bases, the web, and external APIs for LLM nodes.
Index lookup
Retrieves knowledge base text relevant to a user query for use as context in downstream LLM nodes.
Input
Knowledge base index name: Select a registered knowledge base. Knowledge Base Management.
Search keywords: Keywords to query the knowledge base. Reference a string output from an upstream node.
Top k: Number of most relevant results to return.
Output
The output variable result is a List[Dict] with the following keys:
Key | Description |
content | Content of the retrieved document chunk. |
score | Similarity score between the chunk and the query. Higher values indicate greater relevance. |
Example output with the top_k highest-scoring records:
[
{
"score": 0.8057173490524292,
"content": "Affected by the uncertainty of the COVID-19 pandemic, xx Bank proactively increased provisions for impairment losses on loans, advances, and non-credit assets based on economic trends and forecasts for China or mainland China. The bank also intensified the write-off and disposal of non-performing assets to improve its provision coverage ratio. In 2020, it achieved a net profit of 28.928 billion yuan, a year-on-year increase of 2.6%, and its profitability gradually improved. (RMB in millions) 2020 2019 Change (%) Operating Results & Profitability Operating Income 153,542 137,958 11.3 Operating Profit Before Impairment Losses 107,327 95,816 12.0 Net Profit 28,928 28,195 2.6 Cost-to-Income Ratio(1)(%) 29.11 29.61 decrease of 0.50 percentage points Return on Average Assets (%) 0.69 0.77 decrease of 0.08 percentage points Weighted Average Return on Equity (%) 9.58 11.30 decrease of 1.72 percentage points Net Interest Margin(2)(%) 2.53 2.62 decrease of 0.09 percentage points Note: (1) Cost-to-income ratio = Operating and administrative expenses / Operating income.",
"id": "49f04c4cb1d48cbad130647bd0d75f***1cf07c4aeb7a5d9a1f3bda950a6b86e",
"metadata": {
"page_label": "40",
"file_name": "2021-02-04_China_xx_Insurance_Group_Co_Ltd_xx_China_xx_2020_Annual_Report.pdf",
"file_path": "oss://my-bucket-name/datasets/chatglm-fintech/2021-02-04_China_xx_Insurance_Group_Co_Ltd__601318__China_xx__2020_Annual_Report.pdf",
"file_type": "application/pdf",
"file_size": 7982999,
"creation_date": "2024-10-10",
"last_modified_date": "2024-10-10"
}
},
{
"score": 0.7708036303520203,
"content": "7.2 billion yuan, a year-on-year increase of 5.2%. 2020 (RMB in millions) Life and Health Insurance Business, Property and Casualty Insurance Business, Banking Business, Trust Business, Securities Business, Other Asset Management Business, Technology Business, Other Business and Consolidation Eliminations, Group Consolidated Net Profit Attributable to Shareholders of the Parent Company 95,018 16,083 16,766 2,476 2,959 5,737 7,936 (3,876) 143,099 Minority Interest 1,054 76 12,162 3 143 974 1,567 281 16,260 Net Profit (A) 96,072 16,159 28,928 2,479 3,102 6,711 9,503 (3,595) 159,359 Items to be excluded: Short-term investment fluctuations(1)(B) 10,308 – – – – – – – 10,308 Impact of discount rate changes (C) (7,902) – – – – – – – (7,902) One-time significant items and others excluded by management as not part of daily operational income and expenses (D) – – – – – – 1,282 – 1,282 Operating Profit (E=A-B-C-D) 93,666 16,159 28,928 2,479 3,102 6,711 8,221 (3,595) 155,670 Operating profit attributable to shareholders of the parent company 92,672 16,",
"id": "8066c16048bd722d030a85ee8b1***36d5f31624b28f1c0c15943855c5ae5c9f",
"metadata": {
"page_label": "19",
"file_name": "2021-02-04_China_xx_Insurance_Group_Co_Ltd_xxx_China_xx__2020_Annual_Report.pdf",
"file_path": "oss://my-bucket-name/datasets/chatglm-fintech/2021-02-04__China_xx_Insurance_Group_Co_Ltd__601318__China_xx__2020_Annual_Report.pdf",
"file_type": "application/pdf",
"file_size": 7982999,
"creation_date": "2024-10-10",
"last_modified_date": "2024-10-10"
}
}
]Use cases
SerpAPI-GenericSearch
Performs a web search using SerpApi. Supports Bing, Google, Baidu, Yahoo, and custom engines. Configure search location and result count.
Input
SerpApi connection: Select a SerpApi connection created in LangStudio. Create SerpApi Connection.
Search keywords: Keywords for the web search. Reference a string output from an upstream node.
Search engine: Supports Bing, Google, Baidu, Yahoo, and custom engines.
Location: Search location. Specify a city, such as
Shanghai, China.Number of search results: The number of search results to return.
Output
The output variable output is a List[Dict] with the following keys:
Key | Description |
title | Title of the result. |
link | URL of the result. |
summary | Summary of the result. |
Use cases
A Chatbot Solution with RAG and Web Search Based on LangStudio and DeepSeek
HTTP request
Calls external API endpoints with configurable HTTP methods, authentication, and request body formats.
Input
Request method: HTTP method: GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS.
URL: The destination URL for the request.
Request headers: Custom HTTP headers. One key-value pair per line.
Request parameters: Query string parameters. One key-value pair per line.
Authentication: Disabled by default. If enabled, you can choose a standard authentication method (Bearer or Basic).
Bearer: Bearer Token authentication. Omit the
Bearerprefix when entering the token.Basic: Basic authentication. Enter a username and password. The system Base64-encodes them automatically.
For custom authentication methods, configure the request headers manually.
Request body: Supported request body formats:
none: No request body.
JSON: Sends data in JSON format.
form-data: Sends multipart/form-data. Supports file uploads.
x-www-form-urlencoded: Sends URL-encoded form data.
raw-text: Sends data as plain text.
binary: Sends a binary file. Supports file uploads.
SSL verification: Enabled by default. Verifies the server SSL certificate. Keep enabled in production.
Timeout: Request timeout in seconds. Valid values: 1-600. Default: 10.
Retry configuration: Disabled by default. Configures automatic retries for failed requests.
Max Retries: Maximum retry attempts. Valid values: 0-10.
Retry Interval: Interval between retries in milliseconds. Valid values: 100-10,000.
Output
body: The text content of the response. If the response is a file, this field is an empty string.
status_code: HTTP status code (for example, 200, 404, 500).
headers: HTTP response headers as key-value pairs.
file: File object. Returned only when the response is a file.