This article explains how to access the models provided by the ModelArk large model service platform of Volcano Engine in LAS, along with usage examples:
LAS_API_KEY.The AI Data Lake Service (LAS) allows you to register and access the large models provided by ModelArk of Volcano Engine through the API Key Management module. For the models supported in LAS, refer to Data Marketplace - Operator Marketplace - ModelArk Large Model Series. Supported scenarios include text generation, video understanding, deep reasoning, image-text vectorization, and more.
The following sections provide specific usage instructions, including basic examples and parameter descriptions.
tip
When calling the Doubao series models, if the version field does not specify a particular model version, such as "version": "250428", the system will use the latest model version released by ModelArk by default.
For the deep reasoning models available on ModelArk, you can use the operators provided by the AI Data Lake Service to easily perform batch computations on data. Supported model examples include:
The following example uses the doubao-1.5-thinking-pro model. Log in to the development machine and run the following code:
from __future__ import annotations import daft from daft import col from daft.las.functions.ark_llm.ark_llm_thinking_vision import ArkLLMThinkingVision from daft.las.functions.udf import las_udf if __name__ == "__main__": # The environment variable LAS_API_KEY must be configured: LAS_API_KEY is created and obtained on the AI Data Lake service page queries = { "query": [ "帮我规划5月去新疆的10天旅行安排", ] } df = daft.from_pydict(queries) df = df.with_column( "llm_result", las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-1.5-thinking-pro", "multimodal_type": "text", "inference_type": "online", }, )(col("query")), ) df = df.with_column("reasoning_content", col("llm_result").struct.get("reasoning_content")) df = df.with_column("llm_result", col("llm_result").struct.get("llm_result")) output_pd_df = df.to_pandas() df.show()
The following demonstrates how to use the doubao-1.5-thinking-vision-pro model to process video data in TOS, output the video path, video understanding result (llm_result), reasoning chain (reasoning_content), and save the results to TOS.
from __future__ import annotations import os import ray import daft from daft import col from daft.las.functions.ark_llm.ark_llm_thinking_vision import ArkLLMThinkingVision from daft.las.functions.udf import las_udf from daft.las.io.tos import TOSConfig # The following two lines convert a standalone program into a distributed task submitted to the Ray cluster. The following two lines are required when executing in "Task Management". The following two lines are not required for debugging on the development machine. ray.init() daft.context.set_runner_ray("ray://127.0.0.1:10001") def run_pipeline(input_tos_dir, output_tos_path): input_s3_dir = input_tos_dir.rstrip('/') tos_config = TOSConfig.from_env() io_config = daft.io.IOConfig(s3=tos_config.to_s3_config()) # Load all mp4 files under the "input_s3_dir" path on TOS df = daft.from_glob_path( f"{input_s3_dir}/*.mp4", io_config=io_config, ) # Call the ArkLLMThinkingVision function to perform inference on each video file df = df.with_column( "response", las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-1.5-thinking-vision-pro", "multimodal_type": "video", "prompt": "视频里有什么?", "inference_type": "online", }, )(col("path")), ) # Extract the reasoning_content and llm_result fields from the inference results df = df.with_column("reasoning_content", col("response").struct.get("reasoning_content")) df = df.with_column("llm_result", col("response").struct.get("llm_result")) # Select the required fields df = df.select("path", "llm_result", "reasoning_content") # Write to the "output_tos_path" path on TOS df.write_csv(output_tos_path, io_config=io_config) if __name__ == "__main__": input_tos_dir = os.getenv("input_tos_dir", "input_tos_dir").replace("tos://", "s3://", 1) output_tos_path = os.getenv("output_tos_path", "output_tos_path").replace("tos://", "s3://", 1) run_pipeline(input_tos_dir, output_tos_path)
Set environment variables:
# TOS configuration parameters: since the data is stored on TOS, TOS parameter information must be configured export TOS_ENDPOINT="https://tos-cn-beijing.ivolces.com" export LAS_TOS_ACCESS_KEY="xxx" export LAS_TOS_SECRET_KEY="xx=" export LAS_API_KEY="xxx" # Input file path on TOS export input_tos_dir="xx" # Output file path on TOS export output_tos_path="xx"
Operation steps
Debugging steps in the development machine:
doubao_think_demo.pyinput_tos_dir with the TOS address where the video data is storedpython doubao_think_demo.pyPerform distributed computation in Task Management
In the above example, the ArkLLMThinkingVision class is used to perform inference on models within ModelArk. The request body, usage method, and configuration of request parameters are described as follows:
las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-1.5-thinking-vision-pro", "multimodal_type": "video", "prompt": "视频里有什么?", "inference_type": "online", }, )
Parameter name | Required | Default value | Parameter description | Example |
|---|---|---|---|---|
model | Yes |
| doubao-1.5-thinking-vision-pro | |
version | No | The latest version of the model | Model version | 250428 |
multimodal_type | No | image | Media content type, specifies whether to process image, video, or text data. Optional values:
| video |
system_text | No | System prompt content, used as input to the model with the system role | You are a professional video content planning assistant | |
prompt | No | User prompt, used to guide the model's behavior. When this field is configured, it will be concatenated with the input text and provided to the model as the user role. At the same time, this field can also be set to {query}; in this case, the input text will replace this field. | What is in the video? | |
inference_type | No | batch | Inference type, supports online inference and batch inference.
It is recommended to use the online mode during the day. | online |
For explanations of other parameters, refer to the descriptions in the Operator Plaza of AI Data Lake Operator Plaza.
For the text generation models available on ModelArk, you can use the operators provided by AI Data Lake to easily perform batch processing on data. Supported model examples include:
from __future__ import annotations import daft from daft import col from daft.las.functions.ark_llm.ark_llm_text_generate import ArkLLMTextGenerate from daft.las.functions.udf import las_udf if __name__ == "__main__": # The environment variable LAS_API_KEY must be configured: LAS_API_KEY is obtained by creating it on the LAS service page queries = { "query": [ "中国的首都在哪里", "十字花科植物有哪些", ] } ds = daft.from_pydict(queries) ds = ds.with_column( "llm_result", las_udf( ArkLLMTextGenerate, construct_args={ "model": "doubao-1.5-pro-32k", "inference_type": "online", }, )(col("query")), ) ds.show()
In the above example, the ArkLLMTextGenerate class is used to perform inference on models within ModelArk. The request body, usage method, and configuration of request parameters are described as follows:
las_udf( ArkLLMTextGenerate, construct_args={ "model": "doubao-1.5-pro-32k", "inference_type": "online", }, )
Parameter name | Required | Default value | Parameter description | Example |
|---|---|---|---|---|
model | Yes | Model name | doubao-1.5-lite-32k | |
version | No | The latest version of the model | Model version | 250115 |
system_content | No | System prompt content, used as input to the model with the system role | You are a professional translation expert | |
prompt | No | User prompt, used to guide the model's behavior. When this field is configured, it will be concatenated with the input text and provided to the model as the user role. Additionally, this field can be set to {query}, in which case the input text will replace this field. | Translate the following content | |
inference_type | No | batch | Inference type, supports online inference and batch inference.
It is recommended to use the online mode during the day. | online |
For explanations of other parameters, refer to the descriptions in the Operator Plaza of AI Data Lake Operator Plaza.
For the visual understanding models available on ModelArk, you can use the operators provided by AI Data Lake to easily perform batch processing on data. Supported model examples include:
from __future__ import annotations import os import daft from daft import col from daft.las.functions.ark_llm.ark_llm_vision_understanding import ArkLLMVisionUnderstanding from daft.las.functions.udf import las_udf if __name__ == "__main__": # The environment variable LAS_API_KEY must be configured: LAS_API_KEY is obtained by creating it on the LAS service page TOS_TEST_DIR = os.getenv("TOS_TEST_DIR", "tos_bucket") samples = {"videos": [f"tos://{TOS_TEST_DIR}/ark_llm_vision_understanding/eating_56.mp4"]} df = daft.from_pydict(samples) df = df.with_column( "llm_result", las_udf( ArkLLMVisionUnderstanding, construct_args={ "model": "doubao-1.5-vision-pro", "multimodal_type": "video", "prompt": "视频里有什么?", "inference_type": "batch", }, )(col("videos")), ) df.show()
In the above example, the ArkLLMVisionUnderstanding class is used to perform inference on models within ModelArk. The request body, usage method, and configuration of request parameters are described as follows:
las_udf( ArkLLMVisionUnderstanding, construct_args={ "model": "doubao-1.5-vision-pro", "multimodal_type": "video", "prompt": "视频里有什么?", "inference_type": "batch", }, )
Parameter name | Required | Default value | Parameter description | Example |
|---|---|---|---|---|
model | Yes |
| doubao-1.5-vision-pro | |
version | No | The latest version of the model | Model version | 250328 |
multimodal_type | No | image | Media content type, specifies whether to process image, video, or text data. Optional values:
| video |
system_text | No | System prompt content, used as input to the model with the system role | You are a professional video content planning assistant | |
prompt | No | User prompt, used to guide the model's behavior. When this field is configured, it will be concatenated with the input text and provided to the model as the user role. Additionally, this field can be set to {query}, in which case the input text will replace this field. | What is in the video? | |
inference_type | No | batch | Inference type, supports online inference and batch inference.
It is recommended to use the online mode during the day. | online |
For explanations of other parameters, refer to the descriptions in the Operator Plaza of AI Data Lake Operator Plaza.
For the image-text embedding models available on ModelArk, you can use the operators provided by AI Data Lake to easily perform batch processing on data. Supported model examples include:
from __future__ import annotations import os import daft from daft import col from daft.las.functions.ark_llm.doubao_embedding_vision import DoubaoEmbeddingVision from daft.las.functions.udf import las_udf if __name__ == "__main__": # The environment variable LAS_API_KEY must be configured: LAS_API_KEY is obtained by creating LAS_API_KEY on the LAS service page TOS_TEST_DIR = os.getenv("TOS_TEST_DIR", "tos_bucket") samples = { "image_path": [f"tos://{TOS_TEST_DIR}/doubao_embedding_vision/cat_ip_adapter.jpeg"], "text": ["猫"], } df = daft.from_pydict(samples) # Calculate vectorized data for images and text df = df.with_column( "embeeding_for_image_text", las_udf( DoubaoEmbeddingVision, construct_args={ "image_format": "jpeg", }, )(col("image_path"), col("text")), ) # Calculate vectorized data for images df = df.with_column( "embeeding_for_image", las_udf( DoubaoEmbeddingVision, construct_args={ "image_format": "jpeg", }, )(col("image_path")), ) # Calculate vectorized data for text df = df.with_column( "embeeding_for_text", las_udf( DoubaoEmbeddingVision, construct_args={ "multimodal_type": "text", }, )(col("text")), ) df.show()
In the above example, the DoubaoEmbeddingVision class is used to perform inference on models within ModelArk. The request body, usage, and request parameter configuration are described as follows:
las_udf( DoubaoEmbeddingVision, construct_args={ "multimodal_type": "text", }, )
Parameter name | Required | Default value | Parameter description | Example |
|---|---|---|---|---|
version | No | The latest version of the model | Model version | 250328 |
multimodal_type | No | image | Type of media content, specifies whether to process image, video, or text data. Optional values:
| video |
For explanations of other parameters, refer to the introduction in the AI Data Lake Operator Plaza.