Provides deep thinking capabilities for large models in multimodal scenarios
Uses the Doubao-1.5-thinking-pro model, which possesses deep thinking capabilities, to analyze and interpret text, and returns structured output. Before answering questions, the model analyzes and decomposes the question, and generates answers based on this analysis.
(Mixing string and list types in the same field is not allowed)
This operator (ArkLLMThinkingVision) is used differently in Daft 0.6.5 (and earlier versions) compared to version 0.6.14 (and later versions).
df = df.with_column( "llm_result", las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-seed-1.6", "system_text": "", "inference_type": "online", }, )(videos=col("videos"), texts=""), )
df = df.with_column( "llm_result", las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-seed-1.6", "multimodal_type": "video", "system_text": "", "prompt": "", "inference_type": "online", }, )(col("videos")), )
Input column name | Description |
|---|---|
texts | (Required) Pass in the user's text prompt. Supports passing in a single text (string) or multiple texts (list). |
By default, the returned field type is struct and contains the following fields:
When the environment variable LAS_LLM_FINISH_REASON_CHECK=true, the returned struct will additionally include the following field:
When the environment variable LAS_LLM_BOTS_REFERENCES=true, the returned struct will additionally include the following field:
Both environment variables can be enabled at the same time, in which case the output struct will contain all of the above fields.
If a parameter does not have a default value, it is required.
Parameter name | Type | Default value | Description |
|---|---|---|---|
model | str | Model name. Supported models are: Doubao model and DeepSeek model. For example: doubao-seed-1.6. | |
version | str or None | Model version Enter the version information corresponding to the model. For example: 250115. | |
inference_type | str | batch | Inference type. Supports online inference and batch inference. The default value is batch, which uses batch inference. - online: Uses the online inference module provided by the ModelArk platform for inference. - batch: Uses the batch inference module provided by the ModelArk platform for inference. |
system_text | str or None | System prompt content The system prompt content is input to the model as the system role to consistently constrain model behavior. | |
system_image_url | str or None | System image URL In scenarios with mixed text and images, enter the system image URL to guide the model's behavior. | |
system_video_url | str or None | System video URL In scenarios with mixed text and images, enter the system video URL to guide the model's behavior. | |
image_format | str | jpeg | Image encoding format. The default is jpeg. Supported formats: JPEG, PNG, WEBP, GIF, BMP, TIFF, and other common formats. |
image_url_detail | str or None | Image quality Supports manual setting of image quality. Valid values are high, low, and auto. - high: High detail mode, suitable for scenarios requiring understanding of image details, such as multiple local information/feature extraction, complex/rich detail image understanding, and many other similar scenarios, for more comprehensive understanding. - low: Low detail mode, suitable for simple image classification/recognition, overall content understanding/description, and similar scenarios, for faster understanding. - auto: Default mode. The mode selected by different models may vary. For details, refer to the official documentation. | |
video_format | str | mp4 | Video encoding format Configure the video format. The default is mp4. Supported video formats: MP4, AVI, MOV. Each video file must be within 50MB. |
video_fps | float or None | Video frame rate Value range: [0.2, 5]. The default value is 1. Extracts the specified number of images from the video per second. The higher the value, the more precisely the model understands changes in the video frames; the lower the value, the less sensitive the model is to changes in the video frames, but fewer tokens are used and the speed is faster. | |
source_type | str | url | Data source type Specifies the source format of the media data. The default is url. Optional values: - binary: Original binary data - base64: Base64-encoded data - url: Network resource address (supports http/https/tos/s3), where tos/s3 will be automatically converted to a pre-signed URL |
max_tokens | int or None | Maximum length of the model response (in tokens). The total input and output length is limited by the model context. | |
max_completion_tokens | int or None | The maximum number of tokens generated by the model, including reasoning chain content (reasoning_content) and answer content (content), but excluding the input messages. When this limit is exceeded, the model stops outputting reasoning chain content and answers, and returns the finish_reason field as length. | |
stop | list or None | Stop word list. When the model encounters a string specified in the stop field, it stops generating further output. The string itself will not be included in the output. Up to 4 strings are supported. For example, ["你好", "天气"]. | |
frequency_penalty | float | 0 | Frequency penalty coefficient. If the value is positive, new tokens are penalized based on their frequency in the text, reducing the likelihood of the model repeating tokens verbatim. Value range is [-2.0, 2.0], default is 0. |
presence_penalty | float | 0 | Presence penalty coefficient. If the value is positive, new tokens are penalized based on whether they have already appeared in the text, increasing the likelihood that the model discusses new topics. Value range is [-2.0, 2.0]. Default value is 0. |
temperature | float | 1 | Sampling temperature. The sampling temperature controls the degree to which the probability distribution of candidate words is smoothed during text generation. - When set to 0, the model only considers the token with the highest log probability. - Higher values (such as 0.8) make the output more random, while lower values (such as 0.2) make the output more focused and deterministic. It is generally recommended to adjust only one of temperature or top_p, not both. Value range is [0, 2], default is 1. |
top_p | float | 0.7 | Nucleus sampling probability threshold. The model considers tokens whose cumulative probability mass is within top_p. When set to 0, the model only considers the token with the highest log probability. 0.1 means only the top 10% of tokens by probability mass are considered. A higher value increases the randomness of the output, while a lower value makes the output more deterministic. Default value is 0.7. |
logit_bias | dict or None | Adjusts the probability of specified tokens appearing in the model's output, so that the generated content better aligns with specific preferences. The logit_bias field accepts a map, where each key is a token ID from the vocabulary (which can be obtained using the tokenization interface), and each value is the bias for that token, ranging from -100 to 100. -1 reduces the likelihood of selection, 1 increases the likelihood of selection; -100 completely prohibits the selection of this token, and 100 results in only this token being selectable. The actual effect of this parameter may vary depending on the model. | |
tools | list or None | Tool invocation configuration. List of tools to be invoked, which can be included in the model's returned information. To have the model return the tools to be invoked, configure this structure. | |
thinking_type | str or None | Thinking mode. Controls whether the model enables deep thinking mode. If not configured, deep thinking mode is used by default and can be manually disabled. Optional values: - enabled: Enables thinking mode; the model will always think before answering. - disabled: Disables thinking mode; the model answers questions directly without thinking. - auto: Automatic thinking mode; the model autonomously determines whether thinking is needed based on the question, and answers simple questions directly. | |
llm_config | dict or None | Custom LLM configuration. In addition to the parameters above, other parameters will be passed through to the model. The parameters above will override the values in llm_config. | |
request_timeout | int | 1200 | Timeout period. Timeout period for a single request (in seconds). |
max_concurrency | int | 100 | Concurrency. Maximum concurrency per process. |
The following code demonstrates how to use Daft to access the Volcengine ModelArk multimodal deep thinking model (Doubao series) for text reasoning. Note that each inference may yield different results.
from __future__ import annotations import os 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 os.getenv("DAFT_RUNNER", "native") == "ray": import logging import ray def configure_logging(): logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S.%s".format(), ) logging.getLogger("tracing.span").setLevel(logging.WARNING) logging.getLogger("daft_io.stats").setLevel(logging.WARNING) logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING) logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING) logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING) ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging}) daft.set_runner_ray() daft.set_execution_config(min_cpu_per_task=0) 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": [ "", ] } df = daft.from_pydict(queries) df = df.with_column( "llm_result", las_udf( ArkLLMThinkingVision, construct_args={ "model": "doubao-1.5-thinking-pro", "inference_type": "online", }, )(texts=col("query")), ) df = df.with_column("reasoning_content", col("llm_result")["reasoning_content"]) df = df.with_column("llm_result", col("llm_result")["llm_result"]) df.show() # Output (the result of each large model inference may vary) # ╭──────────────────────────────────┬──────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────╮ # │ query ┆ llm_result ┆ reasoning_content │ # │ --- ┆ --- ┆ --- │ # │ Utf8 ┆ Utf8 ┆ Utf8 │ # ╞══════════════════════════════════╪══════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════╡ # │ Help me plan a 10-day trip to Xinjiang in May… ┆ ┆ Okay, the user asked me to help plan a 10-day trip to Xinjiang in May. First… │ # │ ┆ ┆ │ # │ ┆ May is the "early summer golden period" for traveling in Xinjiang, when the grasslands are turning green and the flower fields are just beginning to bloom… ┆ │ # ╰──────────────────────────────────┴──────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────╯