You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Text generation
Text generation (Doubao-1.5-lite-32K)
Copy page
Download PDF
Text generation (Doubao-1.5-lite-32K)

Operator introduction

Description

Dedicated processor for large model text generation (Doubao/DeepSeek)

Key features

  • Optimization for pure text scenarios: Automatically constructs message structures compliant with model specifications based on user input text data
  • Input simplification mechanism: Native support for string type input, automatically packaged in the {role: user, content: text} format
  • Multi-task support: Translation, summarization, question answering, and other NLP scenarios available out of the box
  • Dual prompt system:
    • system_content: System-level behavioral guidance (such as translation style control)
    • prompt: User-level instruction template (supports {query} placeholder replacement)

Input and output specifications

  • Input format: Pure text data
  • Output format:
    • Default mode: string type generated result
    • Diagnostic mode: Set the environment variable LAS_LLM_FINISH_REASON_CHECK=true to return the complete generated result and the model's finish reason:
      • llm_result: string type, generated result
      • finish_reason: string type, model finish reason, value range: stop, length, content_filter

Daft invocation

Operator parameters

Input

Input column name

Note

raw_text

Contains the text data to be processed. Type is string

Output

By default, when the environment variable LAS_LLM_FINISH_REASON_CHECK=false, the returned field type is string.
When the environment variable LAS_LLM_FINISH_REASON_CHECK=true, the returned field type is struct and includes the following fields:

  • llm_result: Model output result
  • finish_reason: Model output finish reason

Parameters

If a parameter does not have a default value, it is required

Parameter name

Type

Default value

Description

model

str

Model name. Supported models: Doubao model and DeepSeek model. Example doubao-1.5-lite-32k

version

str or None

Model version. Enter the corresponding version information for the model. 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 ModelArk platform for inference - batch: Uses the batch inference module provided by ModelArk platform for inference

max_tokens

int or None

Maximum length of 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_content and content, but excluding the input messages. When this limit is exceeded, the model stops outputting reasoning_content and answers, and returns the finish_reason field with the value "length".

stop

list or None

The model stops generating when it encounters a string specified in the stop field; the stop string itself will not be output. Supports up to 4 strings. 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: [-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 appeared in the text so far, increasing the likelihood that the model discusses new topics. Value range: [-2.0, 2.0]. Default value: 0

temperature

float

1

Sampling temperature. Controls the degree to which the probability distribution for each candidate word is smoothed when generating text. - When set to 0, the model considers only 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 temperature or top_p, not both. Value range: [0, 2]. Default value: 1

top_p

float

0.7

Nucleus sampling probability threshold. The model considers token results within the top_p probability mass. When set to 0, the model considers only the token with the highest log probability. 0.1 means only the top 10% of tokens by probability mass are considered; the higher the value, the greater the randomness in generation, and the lower the value, the more deterministic the output. It is generally recommended to adjust only temperature or top_p, not both. Default value: 0.7

logit_bias

dict or None

Adjusts the probability of specified tokens appearing in the model's output, making the generated content better match specific preferences. The logit_bias field accepts a map value, where each key is a token ID from the vocabulary (obtained using the tokenization interface), and each value is the bias value for that token, with a range of [-100, 100]. -1 decreases the likelihood of selection, 1 increases the likelihood of selection; -100 completely prohibits the selection of that token, and 100 causes only that token to be selectable. The actual effect of this parameter may vary depending on the model.

tools

list or None

A list of tools to be called, which can be included in the model's returned information. To have the model return tools to be called, configure this structure.

llm_config

dict or None

Custom LLM configuration. In addition to the above parameters, other parameters will be passed through to the model. The above parameters will override the values in llm_config.

request_timeout

int

1200

Timeout. The timeout period for a single request (in seconds).

max_concurrency

int

100

Concurrency. The maximum number of concurrent requests per process.

system_content

str or None

System prompt content. The system prompt content is input to the model as the system role.

prompt

str or None

User prompt. The user prompt is 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.

Examples

The following code demonstrates how to use daft to access the ModelArk text generation model for batch inference. Note that the result of each large model inference may vary.

from __future__ import annotations

import os

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 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__":
    # 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-lite-32k",
                "inference_type": "online",
            },
        )(col("query")),
    )
    ds.show()

    #  Output (the result of each large model inference may vary)
    # ╭────────────────────┬───────────────────────────────────────╮
    # │ query              ┆ llm_result                            │
    # │ ---                ┆ ---                                   │
    # │ Utf8               ┆ Utf8                                  │
    # ╞════════════════════╪═══════════════════════════════════════╡
    # │ Where is the capital of China?      ┆ The capital of China is Beijing.                        │
    # │                    ┆                                       │
    # │                    ┆ Beijing is the political center, cultural center, and international... of China.       │
    # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    # │ What are cruciferous plants?    ┆ There are many types of cruciferous plants, common ones include:           │
    # │                    ┆ 1. **Vegetables**                          │
    # │                    ┆  …                                    │
    # ╰────────────────────┴───────────────────────────────────────╯
Last updated: 2026.05.12 19:06:29