Skip to content

Configs

lazyllm.Config

Config is a configuration class provided by LazyLLM, which loads configurations of LazyLLM framework from config files, environment variables, or specify them explicitly. it can export all configuration items as well. The Config module automatically generates an object named 'config' containing all configurations.

Parameters:

  • prefix (str, default: 'LAZYLLM' ) –

    Environment variable prefix. Defaults to 'LAZYLLM'

  • home (str, default: None ) –

    Configuration file directory path. Defaults to '~/.lazyllm'

LazyLLM Configurations:

  • home:
  • Description: The default home directory for LazyLLM., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_HOME

  • mode:
  • Description: The default mode for LazyLLM., type: Mode, default: {desc["default"]}
  • Environment Variable:
    • LAZYLLM_DISPLAY: Mode.Display
    • LAZYLLM_DEBUG: Mode.Debug

  • repr_ml:
  • Description: Whether to use Markup Language for repr., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_REPR_USE_ML

  • repr_show_child:
  • Description: Whether to show child modules in repr., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_REPR_SHOW_CHILD

  • rag_store:
  • Description: The default store for RAG., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_RAG_STORE

  • gpu_type:
  • Description: The default GPU type for LazyLLM., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GPU_TYPE

  • train_target_root:
  • Description: The default target root for training., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRAIN_TARGET_ROOT

  • infer_log_root:
  • Description: The default log root for inference., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_INFER_LOG_ROOT

  • temp_dir:
  • Description: The default temp directory for LazyLLM., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TEMP_DIR

  • thread_pool_worker_num:
  • Description: The default number of workers for thread pool., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_THREAD_POOL_WORKER_NUM

  • deploy_skip_check_kw:
  • Description: Whether to skip check keywords for deployment., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEPLOY_SKIP_CHECK_KW

  • allow_internal_network:
  • Description: Whether to allow loading images from internal network addresses. Set to False for security in production environments., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_ALLOW_INTERNAL_NETWORK

  • redis_url:
  • Description: The URL of the Redis server., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_REDIS_URL

  • redis_recheck_delay:
  • Description: The delay of the Redis server check., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_REDIS_RECHECK_DELAY

  • use_builtin:
  • Description: Whether to use registry modules in python builtin., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_USE_BUILTIN

  • default_fsqueue:
  • Description: The default file system queue to use., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_FSQUEUE

  • fsqredis_url:
  • Description: The URL of the Redis server for the file system queue., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_FSQREDIS_URL

  • default_recent_k:
  • Description: The number of recent inputs that RecentQueue keeps track of., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_RECENT_K

  • save_flow_result:
  • Description: Whether to save the intermediate result of the pipeline., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SAVE_FLOW_RESULT

  • parallel_multiprocessing:
  • Description: Whether to use multiprocessing for parallel execution, if not, default to use threading., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_PARALLEL_MULTIPROCESSING

  • launcher:
  • Description: The default remote launcher to use if no launcher is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_LAUNCHER

  • cuda_visible:
  • Description: Whether to set the CUDA_VISIBLE_DEVICES environment variable., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CUDA_VISIBLE

  • partition:
  • Description: The default slurm partition to use if no partition is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SLURM_PART

  • sco.workspace:
  • Description: The default SCO workspace to use if no workspace is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SCO_WORKSPACE

  • sco_env_name:
  • Description: The default SCO environment name to use if no environment name is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SCO_ENV_NAME

  • sco_keep_record:
  • Description: Whether to keep the record of the Sensecore job., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SCO_KEEP_RECORD

  • sco_resource_type:
  • Description: The default SCO resource type to use if no resource type is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SCO_RESOURCE_TYPE

  • k8s_env_name:
  • Description: The default k8s environment name to use if no environment name is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_K8S_ENV_NAME

  • k8s_config_path:
  • Description: The default k8s configuration path to use if no configuration path is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_K8S_CONFIG_PATH

  • k8s_device_type:
  • Description: The default k8s device type to use if no device type is specified., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_K8S_DEVICE_TYPE

  • disable_system_prompt:
  • Description: Whether to disable default system prompt., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DISABLE_SYSTEM_PROMPT

  • model_source:
  • Description: The default model source to use., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MODEL_SOURCE

  • model_cache_dir:
  • Description: The default model cache directory to use(Read and Write)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MODEL_CACHE_DIR

  • model_path:
  • Description: The default model path to use(ReadOnly)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MODEL_PATH

  • model_source_token:
  • Description: The default token for configed model source(hf or ms) to use., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MODEL_SOURCE_TOKEN

  • data_path:
  • Description: The default data path to use., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DATA_PATH

  • openai_api:
  • Description: Whether to use OpenAI API for vllm deployer., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_OPENAI_API

  • use_ray:
  • Description: Whether to use Ray for ServerModule(relay server)., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_USE_RAY

  • num_gpus_per_node:
  • Description: The number of GPUs per node for Ray launcher when deploy models., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_NUM_GPUS_PER_NODE

  • lmdeploy_eager_mode:
  • Description: Whether to use eager mode for lmdeploy., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LMDEPLOY_EAGER_MODE

  • default_embedding_engine:
  • Description: The default embedding engine to use., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_EMBEDDING_ENGINE

  • mindie_home:
  • Description: The home directory of MindIE., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINDIE_HOME

  • gpu_memory:
  • Description: The memory of the GPU., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GPU_MEMORY

  • cache_dir:
  • Description: The default result cache directory for module to use(Read and Write)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CACHE_DIR

  • cache_strategy:
  • Description: The default cache strategy to use(memory, file, sqlite, redis)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CACHE_STRATEGY

  • cache_mode:
  • Description: The default cache mode to use(Read and Write, Read Only, Write Only, None)., type: str, default: {desc["default"]}
  • Options: RW, RO, WO, NONE
  • Environment Variable: LAZYLLM_CACHE_MODE

  • cache_online_module:
  • Description: Whether to cache the online module result. Use for unit test., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CACHE_ONLINE_MODULE

  • default_source:
  • Description: The default model source for online modules., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_SOURCE

  • default_key:
  • Description: The default API key for online modules., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEFAULT_KEY

  • dynamic_model_configs:
  • Description: Per-module dynamic params: chat, embed, multimodal; each with source, model, url, skip_auth. Use lazyllm.globals.config.ConfigsDict for {module_id: {chat:..., embed:..., multimodal:...}}., type: dict, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DYNAMIC_MODEL_CONFIGS

  • aiping_api_key:
  • Description: The API key for aiping, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AIPING_API_KEY

  • aiping_model_name:
  • Description: The default model name for aiping, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AIPING_MODEL_NAME

  • aiping_text2image_model_name:
  • Description: The default text2image model name for aiping, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AIPING_TEXT2IMAGE_MODEL_NAME

  • claude_api_key:
  • Description: The API key for claude, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CLAUDE_API_KEY

  • claude_model_name:
  • Description: The default model name for claude, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CLAUDE_MODEL_NAME

  • deepseek_api_key:
  • Description: The API key for deepseek, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEEPSEEK_API_KEY

  • deepseek_model_name:
  • Description: The default model name for deepseek, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEEPSEEK_MODEL_NAME

  • doubao_api_key:
  • Description: The API key for doubao, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DOUBAO_API_KEY

  • doubao_model_name:
  • Description: The default model name for doubao, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DOUBAO_MODEL_NAME

  • doubao_multimodal_embed_model_name:
  • Description: The default multimodal embed model name for doubao, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DOUBAO_MULTIMODAL_EMBED_MODEL_NAME

  • doubao_text2image_model_name:
  • Description: The default text2image model name for doubao, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DOUBAO_TEXT2IMAGE_MODEL_NAME

  • glm_api_key:
  • Description: The API key for glm, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GLM_API_KEY

  • glm_model_name:
  • Description: The default model name for glm, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GLM_MODEL_NAME

  • glm_stt_model_name:
  • Description: The default stt model name for glm, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GLM_STT_MODEL_NAME

  • glm_text2image_model_name:
  • Description: The default text2image model name for glm, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GLM_TEXT2IMAGE_MODEL_NAME

  • kimi_api_key:
  • Description: The API key for kimi, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_KIMI_API_KEY

  • kimi_model_name:
  • Description: The default model name for kimi, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_KIMI_MODEL_NAME

  • minimax_api_key:
  • Description: The API key for minimax, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINIMAX_API_KEY

  • minimax_model_name:
  • Description: The default model name for minimax, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINIMAX_MODEL_NAME

  • minimax_text2image_model_name:
  • Description: The default text2image model name for minimax, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINIMAX_TEXT2IMAGE_MODEL_NAME

  • minimax_tts_model_name:
  • Description: The default tts model name for minimax, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINIMAX_TTS_MODEL_NAME

  • openai_api_key:
  • Description: The API key for openai, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_OPENAI_API_KEY

  • openai_model_name:
  • Description: The default model name for openai, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_OPENAI_MODEL_NAME

  • ppio_api_key:
  • Description: The API key for ppio, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_PPIO_API_KEY

  • ppio_model_name:
  • Description: The default model name for ppio, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_PPIO_MODEL_NAME

  • qwen_api_key:
  • Description: The API key for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_API_KEY

  • qwen_model_name:
  • Description: The default model name for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_MODEL_NAME

  • qwen_multimodal_embed_model_name:
  • Description: The default multimodal embed model name for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_MULTIMODAL_EMBED_MODEL_NAME

  • qwen_stt_model_name:
  • Description: The default stt model name for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_STT_MODEL_NAME

  • qwen_text2image_model_name:
  • Description: The default text2image model name for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_TEXT2IMAGE_MODEL_NAME

  • qwen_tts_model_name:
  • Description: The default tts model name for qwen, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_QWEN_TTS_MODEL_NAME

  • sensenova_secret_key:
  • Description: The secret key for SenseNova., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SENSENOVA_SECRET_KEY

  • sensenova_api_key:
  • Description: The API key for sensenova, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SENSENOVA_API_KEY

  • sensenova_model_name:
  • Description: The default model name for sensenova, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SENSENOVA_MODEL_NAME

  • siliconflow_api_key:
  • Description: The API key for siliconflow, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SILICONFLOW_API_KEY

  • siliconflow_model_name:
  • Description: The default model name for siliconflow, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SILICONFLOW_MODEL_NAME

  • siliconflow_multimodal_embed_model_name:
  • Description: The default multimodal embed model name for siliconflow, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SILICONFLOW_MULTIMODAL_EMBED_MODEL_NAME

  • siliconflow_text2image_model_name:
  • Description: The default text2image model name for siliconflow, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SILICONFLOW_TEXT2IMAGE_MODEL_NAME

  • siliconflow_tts_model_name:
  • Description: The default tts model name for siliconflow, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SILICONFLOW_TTS_MODEL_NAME

  • trainable_module_config_map_path:
  • Description: The default path for trainable module config map., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRAINABLE_MODULE_CONFIG_MAP_PATH

  • auto_model_config_map_path:
  • Description: The default path for automodel config map., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AUTO_MODEL_CONFIG_MAP_PATH

  • trainable_magic_mock:
  • Description: Whether to use magic mock for trainable module(used for unit test)., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRAINABLE_MAGIC_MOCK

  • cache_local_module:
  • Description: Whether to cache the local module result. Use for unit test., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CACHE_LOCAL_MODULE

  • cpp_switch:
  • Description: None, type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_ENABLE_CPP_OVERRIDE

  • raise_on_add_doc_error:
  • Description: Whether to raise an error when adding doc failed., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_RAISE_ON_ADD_DOC_ERROR

  • language:
  • Description: The language of the documentation., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LANGUAGE

  • init_doc:
  • Description: whether to init docs, type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_INIT_DOC

  • trace_enabled:
  • Description: Whether LazyLLM tracing is enabled by default., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_ENABLED

  • trace_backend:
  • Description: The tracing backend used by LazyLLM., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_BACKEND

  • trace_content_enabled:
  • Description: Whether tracing records basic input and output payloads by default., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_CONTENT_ENABLED

  • trace_local_storage_dir:
  • Description: Directory used by the local tracing backend to store JSONL trace files., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_LOCAL_STORAGE_DIR

  • git_backend:
  • Description: Default git backend: github, gitlab, gitee, gitcode. None for auto-detect., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GIT_BACKEND

  • github_app_private_key_path:
  • Description: Path to GitHub App private key PEM file for App authentication., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GITHUB_APP_PRIVATE_KEY_PATH

  • sandbox_type:
  • Description: None, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SANDBOX_TYPE

  • sandbox_fusion_base_url:
  • Description: None, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SANDBOX_FUSION_BASE_URL

  • skills_dir:
  • Description: The directory of skills, supports multiple directories separated by commas, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_SKILLS_DIR

  • max_skill_md_bytes:
  • Description: The maximum size of SKILL.md that can be loaded by default, type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MAX_SKILL_MD_BYTES

  • eval_result_dir:
  • Description: The default result directory for eval., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_EVAL_RESULT_DIR

  • max_embedding_workers:
  • Description: The default number of workers for embedding in RAG., type: int, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MAX_EMBEDDING_WORKERS

  • auto_detect_encoding:
  • Description: Whether auto detecting txt encoding, type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AUTO_DETECT_ENCODING

  • enable_chardet:
  • Description: Whether to use chardet when detect txt encoding, type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_ENABLE_CHARDET

  • use_encoding_cache:
  • Description: Whether use cahce to accelerate txt encoding, type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_USE_ENCODING_CACHE

  • mineru_api_key:
  • Description: The API key for Mineru, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_MINERU_API_KEY

  • paddle_api_key:
  • Description: The API key for PaddleOCR, type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_PADDLE_API_KEY

  • rag_filename_as_id:
  • Description: Whether to use filename as id for RAG., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_RAG_FILENAME_AS_ID

  • use_fallback_reader:
  • Description: Whether to use fallback reader for RAG., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_USE_FALLBACK_READER

  • algo_register_policy:
  • Description: Algorithm registration policy when re-registering an existing algo. force=overwrite reader and node groups unconditionally; update=overwrite reader if signature matches, error otherwise; empty/other=skip if reader already registered., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_ALGO_REGISTER_POLICY

  • dynamic_fs_auth:
  • Description: Per-source dynamic FS auth: {source: token}., type: dict, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DYNAMIC_FS_AUTH

  • dynamic_tool_auth:
  • Description: Per-tool dynamic auth: {tool_name: token}. Used by search engines and other API-key-based tools., type: dict, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DYNAMIC_TOOL_AUTH

  • feishu_app_id:
  • Description: Feishu App ID for tenant_access_token., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_FEISHU_APP_ID

  • feishu_app_secret:
  • Description: Feishu App Secret for tenant_access_token., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_FEISHU_APP_SECRET

  • feishu_wiki_space_id:
  • Description: Default Feishu wiki space_id for tree ops (ls/mkdir) when not set in URI., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_FEISHU_WIKI_SPACE_ID

  • confluence_token:
  • Description: Confluence API token., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CONFLUENCE_TOKEN

  • confluence_email:
  • Description: Confluence cloud login email for Basic auth., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CONFLUENCE_EMAIL

  • confluence_cloud_id:
  • Description: Confluence cloud instance ID., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CONFLUENCE_CLOUD_ID

  • notion_token:
  • Description: Notion API token (notion-client official env)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_NOTION_TOKEN

  • googledrive_credentials:
  • Description: Path to Google service account JSON (ADC)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_GOOGLE_APPLICATION_CREDENTIALS

  • onedrive_client_id:
  • Description: OneDrive/Microsoft Graph client ID., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AZURE_CLIENT_ID

  • onedrive_client_secret:
  • Description: OneDrive/Microsoft Graph client secret., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AZURE_CLIENT_SECRET

  • onedrive_tenant_id:
  • Description: OneDrive/Microsoft Graph tenant ID., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AZURE_TENANT_ID

  • yuque_token:
  • Description: Yuque API token (yuque-sdk official env)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_YUQUE_TOKEN

  • ones_token:
  • Description: Ones API token., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_ONES_TOKEN

  • obsidian_vault_path:
  • Description: Obsidian vault directory path., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_OBSIDIAN_VAULT_PATH

  • s3_access_key:
  • Description: S3 access key (boto3 official)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AWS_ACCESS_KEY_ID

  • s3_secret_key:
  • Description: S3 secret key (boto3 official)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AWS_SECRET_ACCESS_KEY

  • s3_endpoint_url:
  • Description: S3-compatible endpoint URL (optional)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_CLOUDFS_S3_ENDPOINT_URL

  • s3_region_name:
  • Description: S3 region (boto3 official)., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_AWS_DEFAULT_REGION

  • trace_consume_backend:
  • Description: The tracing consume backend used by LazyLLM., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_CONSUME_BACKEND

  • trace_consume_timeout:
  • Description: Timeout in seconds for tracing consume backend requests., type: float, default: {desc["default"]}
  • Environment Variable: LAZYLLM_TRACE_CONSUME_TIMEOUT

  • debug:
  • Description: Whether to enable debug mode., type: bool, default: {desc["default"]}
  • Environment Variable: LAZYLLM_DEBUG

  • log_name:
  • Description: The name of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_NAME

  • expected_log_modules:
  • Description: The expected log modules, separated by comma., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_EXPECTED_LOG_MODULES

  • log_level:
  • Description: The level of the log., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_LEVEL

  • log_format:
  • Description: The format of the log., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_FORMAT

  • log_dir:
  • Description: The directory of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_DIR

  • log_file_level:
  • Description: The level of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_FILE_LEVEL

  • log_file_size:
  • Description: The size of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_FILE_SIZE

  • log_file_retention:
  • Description: The retention of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_FILE_RETENTION

  • log_file_mode:
  • Description: The mode of the log file., type: str, default: {desc["default"]}
  • Environment Variable: LAZYLLM_LOG_FILE_MODE
Source code in lazyllm/configs.py
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
class Config(metaclass=_ConfigMeta):
    """Config is a configuration class provided by LazyLLM, which loads configurations of LazyLLM framework from config files,
environment variables, or specify them explicitly. it can export all configuration items as well.
The Config module automatically generates an object named 'config' containing all configurations.

Args:
    prefix (str, optional): Environment variable prefix. Defaults to 'LAZYLLM'
    home (str, optional): Configuration file directory path. Defaults to '~/.lazyllm'

**LazyLLM Configurations:**

- **home**:<br>
  - Description: The default home directory for LazyLLM., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_HOME<br>
<br>
- **mode**:<br>
  - Description: The default mode for LazyLLM., type: `Mode`, default: `{desc["default"]}`<br>
  - Environment Variable:<br>
    - LAZYLLM_DISPLAY: Mode.Display<br>
    - LAZYLLM_DEBUG: Mode.Debug<br>
<br>
- **repr_ml**:<br>
  - Description: Whether to use Markup Language for repr., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_REPR_USE_ML<br>
<br>
- **repr_show_child**:<br>
  - Description: Whether to show child modules in repr., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_REPR_SHOW_CHILD<br>
<br>
- **rag_store**:<br>
  - Description: The default store for RAG., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_RAG_STORE<br>
<br>
- **gpu_type**:<br>
  - Description: The default GPU type for LazyLLM., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GPU_TYPE<br>
<br>
- **train_target_root**:<br>
  - Description: The default target root for training., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRAIN_TARGET_ROOT<br>
<br>
- **infer_log_root**:<br>
  - Description: The default log root for inference., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_INFER_LOG_ROOT<br>
<br>
- **temp_dir**:<br>
  - Description: The default temp directory for LazyLLM., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TEMP_DIR<br>
<br>
- **thread_pool_worker_num**:<br>
  - Description: The default number of workers for thread pool., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_THREAD_POOL_WORKER_NUM<br>
<br>
- **deploy_skip_check_kw**:<br>
  - Description: Whether to skip check keywords for deployment., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEPLOY_SKIP_CHECK_KW<br>
<br>
- **allow_internal_network**:<br>
  - Description: Whether to allow loading images from internal network addresses. Set to False for security in production environments., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_ALLOW_INTERNAL_NETWORK<br>
<br>
- **redis_url**:<br>
  - Description: The URL of the Redis server., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_REDIS_URL<br>
<br>
- **redis_recheck_delay**:<br>
  - Description: The delay of the Redis server check., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_REDIS_RECHECK_DELAY<br>
<br>
- **use_builtin**:<br>
  - Description: Whether to use registry modules in python builtin., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_USE_BUILTIN<br>
<br>
- **default_fsqueue**:<br>
  - Description: The default file system queue to use., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_FSQUEUE<br>
<br>
- **fsqredis_url**:<br>
  - Description: The URL of the Redis server for the file system queue., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_FSQREDIS_URL<br>
<br>
- **default_recent_k**:<br>
  - Description: The number of recent inputs that RecentQueue keeps track of., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_RECENT_K<br>
<br>
- **save_flow_result**:<br>
  - Description: Whether to save the intermediate result of the pipeline., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SAVE_FLOW_RESULT<br>
<br>
- **parallel_multiprocessing**:<br>
  - Description: Whether to use multiprocessing for parallel execution, if not, default to use threading., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_PARALLEL_MULTIPROCESSING<br>
<br>
- **launcher**:<br>
  - Description: The default remote launcher to use if no launcher is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_LAUNCHER<br>
<br>
- **cuda_visible**:<br>
  - Description: Whether to set the CUDA_VISIBLE_DEVICES environment variable., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CUDA_VISIBLE<br>
<br>
- **partition**:<br>
  - Description: The default slurm partition to use if no partition is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SLURM_PART<br>
<br>
- **sco.workspace**:<br>
  - Description: The default SCO workspace to use if no workspace is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SCO_WORKSPACE<br>
<br>
- **sco_env_name**:<br>
  - Description: The default SCO environment name to use if no environment name is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SCO_ENV_NAME<br>
<br>
- **sco_keep_record**:<br>
  - Description: Whether to keep the record of the Sensecore job., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SCO_KEEP_RECORD<br>
<br>
- **sco_resource_type**:<br>
  - Description: The default SCO resource type to use if no resource type is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SCO_RESOURCE_TYPE<br>
<br>
- **k8s_env_name**:<br>
  - Description: The default k8s environment name to use if no environment name is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_K8S_ENV_NAME<br>
<br>
- **k8s_config_path**:<br>
  - Description: The default k8s configuration path to use if no configuration path is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_K8S_CONFIG_PATH<br>
<br>
- **k8s_device_type**:<br>
  - Description: The default k8s device type to use if no device type is specified., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_K8S_DEVICE_TYPE<br>
<br>
- **disable_system_prompt**:<br>
  - Description: Whether to disable default system prompt., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DISABLE_SYSTEM_PROMPT<br>
<br>
- **model_source**:<br>
  - Description: The default model source to use., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MODEL_SOURCE<br>
<br>
- **model_cache_dir**:<br>
  - Description: The default model cache directory to use(Read and Write)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MODEL_CACHE_DIR<br>
<br>
- **model_path**:<br>
  - Description: The default model path to use(ReadOnly)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MODEL_PATH<br>
<br>
- **model_source_token**:<br>
  - Description: The default token for configed model source(hf or ms) to use., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MODEL_SOURCE_TOKEN<br>
<br>
- **data_path**:<br>
  - Description: The default data path to use., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DATA_PATH<br>
<br>
- **openai_api**:<br>
  - Description: Whether to use OpenAI API for vllm deployer., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_OPENAI_API<br>
<br>
- **use_ray**:<br>
  - Description: Whether to use Ray for ServerModule(relay server)., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_USE_RAY<br>
<br>
- **num_gpus_per_node**:<br>
  - Description: The number of GPUs per node for Ray launcher when deploy models., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_NUM_GPUS_PER_NODE<br>
<br>
- **lmdeploy_eager_mode**:<br>
  - Description: Whether to use eager mode for lmdeploy., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LMDEPLOY_EAGER_MODE<br>
<br>
- **default_embedding_engine**:<br>
  - Description: The default embedding engine to use., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_EMBEDDING_ENGINE<br>
<br>
- **mindie_home**:<br>
  - Description: The home directory of MindIE., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINDIE_HOME<br>
<br>
- **gpu_memory**:<br>
  - Description: The memory of the GPU., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GPU_MEMORY<br>
<br>
- **cache_dir**:<br>
  - Description: The default result cache directory for module to use(Read and Write)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CACHE_DIR<br>
<br>
- **cache_strategy**:<br>
  - Description: The default cache strategy to use(memory, file, sqlite, redis)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CACHE_STRATEGY<br>
<br>
- **cache_mode**:<br>
  - Description: The default cache mode to use(Read and Write, Read Only, Write Only, None)., type: `str`, default: `{desc["default"]}`<br>
  - Options: RW, RO, WO, NONE<br>
  - Environment Variable: LAZYLLM_CACHE_MODE<br>
<br>
- **cache_online_module**:<br>
  - Description: Whether to cache the online module result. Use for unit test., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CACHE_ONLINE_MODULE<br>
<br>
- **default_source**:<br>
  - Description: The default model source for online modules., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_SOURCE<br>
<br>
- **default_key**:<br>
  - Description: The default API key for online modules., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEFAULT_KEY<br>
<br>
- **dynamic_model_configs**:<br>
  - Description: Per-module dynamic params: chat, embed, multimodal; each with source, model, url, skip_auth. Use lazyllm.globals.config.ConfigsDict for {module_id: {chat:..., embed:..., multimodal:...}}., type: `dict`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DYNAMIC_MODEL_CONFIGS<br>
<br>
- **aiping_api_key**:<br>
  - Description: The API key for aiping, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AIPING_API_KEY<br>
<br>
- **aiping_model_name**:<br>
  - Description: The default model name for aiping, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AIPING_MODEL_NAME<br>
<br>
- **aiping_text2image_model_name**:<br>
  - Description: The default text2image model name for aiping, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AIPING_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **claude_api_key**:<br>
  - Description: The API key for claude, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CLAUDE_API_KEY<br>
<br>
- **claude_model_name**:<br>
  - Description: The default model name for claude, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CLAUDE_MODEL_NAME<br>
<br>
- **deepseek_api_key**:<br>
  - Description: The API key for deepseek, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEEPSEEK_API_KEY<br>
<br>
- **deepseek_model_name**:<br>
  - Description: The default model name for deepseek, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEEPSEEK_MODEL_NAME<br>
<br>
- **doubao_api_key**:<br>
  - Description: The API key for doubao, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DOUBAO_API_KEY<br>
<br>
- **doubao_model_name**:<br>
  - Description: The default model name for doubao, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DOUBAO_MODEL_NAME<br>
<br>
- **doubao_multimodal_embed_model_name**:<br>
  - Description: The default multimodal embed model name for doubao, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DOUBAO_MULTIMODAL_EMBED_MODEL_NAME<br>
<br>
- **doubao_text2image_model_name**:<br>
  - Description: The default text2image model name for doubao, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DOUBAO_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **glm_api_key**:<br>
  - Description: The API key for glm, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GLM_API_KEY<br>
<br>
- **glm_model_name**:<br>
  - Description: The default model name for glm, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GLM_MODEL_NAME<br>
<br>
- **glm_stt_model_name**:<br>
  - Description: The default stt model name for glm, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GLM_STT_MODEL_NAME<br>
<br>
- **glm_text2image_model_name**:<br>
  - Description: The default text2image model name for glm, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GLM_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **kimi_api_key**:<br>
  - Description: The API key for kimi, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_KIMI_API_KEY<br>
<br>
- **kimi_model_name**:<br>
  - Description: The default model name for kimi, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_KIMI_MODEL_NAME<br>
<br>
- **minimax_api_key**:<br>
  - Description: The API key for minimax, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINIMAX_API_KEY<br>
<br>
- **minimax_model_name**:<br>
  - Description: The default model name for minimax, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINIMAX_MODEL_NAME<br>
<br>
- **minimax_text2image_model_name**:<br>
  - Description: The default text2image model name for minimax, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINIMAX_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **minimax_tts_model_name**:<br>
  - Description: The default tts model name for minimax, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINIMAX_TTS_MODEL_NAME<br>
<br>
- **openai_api_key**:<br>
  - Description: The API key for openai, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_OPENAI_API_KEY<br>
<br>
- **openai_model_name**:<br>
  - Description: The default model name for openai, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_OPENAI_MODEL_NAME<br>
<br>
- **ppio_api_key**:<br>
  - Description: The API key for ppio, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_PPIO_API_KEY<br>
<br>
- **ppio_model_name**:<br>
  - Description: The default model name for ppio, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_PPIO_MODEL_NAME<br>
<br>
- **qwen_api_key**:<br>
  - Description: The API key for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_API_KEY<br>
<br>
- **qwen_model_name**:<br>
  - Description: The default model name for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_MODEL_NAME<br>
<br>
- **qwen_multimodal_embed_model_name**:<br>
  - Description: The default multimodal embed model name for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_MULTIMODAL_EMBED_MODEL_NAME<br>
<br>
- **qwen_stt_model_name**:<br>
  - Description: The default stt model name for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_STT_MODEL_NAME<br>
<br>
- **qwen_text2image_model_name**:<br>
  - Description: The default text2image model name for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **qwen_tts_model_name**:<br>
  - Description: The default tts model name for qwen, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_QWEN_TTS_MODEL_NAME<br>
<br>
- **sensenova_secret_key**:<br>
  - Description: The secret key for SenseNova., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SENSENOVA_SECRET_KEY<br>
<br>
- **sensenova_api_key**:<br>
  - Description: The API key for sensenova, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SENSENOVA_API_KEY<br>
<br>
- **sensenova_model_name**:<br>
  - Description: The default model name for sensenova, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SENSENOVA_MODEL_NAME<br>
<br>
- **siliconflow_api_key**:<br>
  - Description: The API key for siliconflow, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SILICONFLOW_API_KEY<br>
<br>
- **siliconflow_model_name**:<br>
  - Description: The default model name for siliconflow, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SILICONFLOW_MODEL_NAME<br>
<br>
- **siliconflow_multimodal_embed_model_name**:<br>
  - Description: The default multimodal embed model name for siliconflow, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SILICONFLOW_MULTIMODAL_EMBED_MODEL_NAME<br>
<br>
- **siliconflow_text2image_model_name**:<br>
  - Description: The default text2image model name for siliconflow, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SILICONFLOW_TEXT2IMAGE_MODEL_NAME<br>
<br>
- **siliconflow_tts_model_name**:<br>
  - Description: The default tts model name for siliconflow, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SILICONFLOW_TTS_MODEL_NAME<br>
<br>
- **trainable_module_config_map_path**:<br>
  - Description: The default path for trainable module config map., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRAINABLE_MODULE_CONFIG_MAP_PATH<br>
<br>
- **auto_model_config_map_path**:<br>
  - Description: The default path for automodel config map., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AUTO_MODEL_CONFIG_MAP_PATH<br>
<br>
- **trainable_magic_mock**:<br>
  - Description: Whether to use magic mock for trainable module(used for unit test)., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRAINABLE_MAGIC_MOCK<br>
<br>
- **cache_local_module**:<br>
  - Description: Whether to cache the local module result. Use for unit test., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CACHE_LOCAL_MODULE<br>
<br>
- **cpp_switch**:<br>
  - Description: None, type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_ENABLE_CPP_OVERRIDE<br>
<br>
- **raise_on_add_doc_error**:<br>
  - Description: Whether to raise an error when adding doc failed., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_RAISE_ON_ADD_DOC_ERROR<br>
<br>
- **language**:<br>
  - Description: The language of the documentation., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LANGUAGE<br>
<br>
- **init_doc**:<br>
  - Description: whether to init docs, type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_INIT_DOC<br>
<br>
- **trace_enabled**:<br>
  - Description: Whether LazyLLM tracing is enabled by default., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_ENABLED<br>
<br>
- **trace_backend**:<br>
  - Description: The tracing backend used by LazyLLM., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_BACKEND<br>
<br>
- **trace_content_enabled**:<br>
  - Description: Whether tracing records basic input and output payloads by default., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_CONTENT_ENABLED<br>
<br>
- **trace_local_storage_dir**:<br>
  - Description: Directory used by the local tracing backend to store JSONL trace files., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_LOCAL_STORAGE_DIR<br>
<br>
- **git_backend**:<br>
  - Description: Default git backend: github, gitlab, gitee, gitcode. None for auto-detect., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GIT_BACKEND<br>
<br>
- **github_app_private_key_path**:<br>
  - Description: Path to GitHub App private key PEM file for App authentication., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GITHUB_APP_PRIVATE_KEY_PATH<br>
<br>
- **sandbox_type**:<br>
  - Description: None, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SANDBOX_TYPE<br>
<br>
- **sandbox_fusion_base_url**:<br>
  - Description: None, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SANDBOX_FUSION_BASE_URL<br>
<br>
- **skills_dir**:<br>
  - Description: The directory of skills, supports multiple directories separated by commas, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_SKILLS_DIR<br>
<br>
- **max_skill_md_bytes**:<br>
  - Description: The maximum size of SKILL.md that can be loaded by default, type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MAX_SKILL_MD_BYTES<br>
<br>
- **eval_result_dir**:<br>
  - Description: The default result directory for eval., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_EVAL_RESULT_DIR<br>
<br>
- **max_embedding_workers**:<br>
  - Description: The default number of workers for embedding in RAG., type: `int`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MAX_EMBEDDING_WORKERS<br>
<br>
- **auto_detect_encoding**:<br>
  - Description: Whether auto detecting txt encoding, type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AUTO_DETECT_ENCODING<br>
<br>
- **enable_chardet**:<br>
  - Description: Whether to use chardet when detect txt encoding, type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_ENABLE_CHARDET<br>
<br>
- **use_encoding_cache**:<br>
  - Description: Whether use cahce to accelerate txt encoding, type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_USE_ENCODING_CACHE<br>
<br>
- **mineru_api_key**:<br>
  - Description: The API key for Mineru, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_MINERU_API_KEY<br>
<br>
- **paddle_api_key**:<br>
  - Description: The API key for PaddleOCR, type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_PADDLE_API_KEY<br>
<br>
- **rag_filename_as_id**:<br>
  - Description: Whether to use filename as id for RAG., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_RAG_FILENAME_AS_ID<br>
<br>
- **use_fallback_reader**:<br>
  - Description: Whether to use fallback reader for RAG., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_USE_FALLBACK_READER<br>
<br>
- **algo_register_policy**:<br>
  - Description: Algorithm registration policy when re-registering an existing algo. force=overwrite reader and node groups unconditionally; update=overwrite reader if signature matches, error otherwise; empty/other=skip if reader already registered., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_ALGO_REGISTER_POLICY<br>
<br>
- **dynamic_fs_auth**:<br>
  - Description: Per-source dynamic FS auth: {source: token}., type: `dict`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DYNAMIC_FS_AUTH<br>
<br>
- **dynamic_tool_auth**:<br>
  - Description: Per-tool dynamic auth: {tool_name: token}. Used by search engines and other API-key-based tools., type: `dict`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DYNAMIC_TOOL_AUTH<br>
<br>
- **feishu_app_id**:<br>
  - Description: Feishu App ID for tenant_access_token., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_FEISHU_APP_ID<br>
<br>
- **feishu_app_secret**:<br>
  - Description: Feishu App Secret for tenant_access_token., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_FEISHU_APP_SECRET<br>
<br>
- **feishu_wiki_space_id**:<br>
  - Description: Default Feishu wiki space_id for tree ops (ls/mkdir) when not set in URI., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_FEISHU_WIKI_SPACE_ID<br>
<br>
- **confluence_token**:<br>
  - Description: Confluence API token., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CONFLUENCE_TOKEN<br>
<br>
- **confluence_email**:<br>
  - Description: Confluence cloud login email for Basic auth., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CONFLUENCE_EMAIL<br>
<br>
- **confluence_cloud_id**:<br>
  - Description: Confluence cloud instance ID., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CONFLUENCE_CLOUD_ID<br>
<br>
- **notion_token**:<br>
  - Description: Notion API token (notion-client official env)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_NOTION_TOKEN<br>
<br>
- **googledrive_credentials**:<br>
  - Description: Path to Google service account JSON (ADC)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_GOOGLE_APPLICATION_CREDENTIALS<br>
<br>
- **onedrive_client_id**:<br>
  - Description: OneDrive/Microsoft Graph client ID., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AZURE_CLIENT_ID<br>
<br>
- **onedrive_client_secret**:<br>
  - Description: OneDrive/Microsoft Graph client secret., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AZURE_CLIENT_SECRET<br>
<br>
- **onedrive_tenant_id**:<br>
  - Description: OneDrive/Microsoft Graph tenant ID., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AZURE_TENANT_ID<br>
<br>
- **yuque_token**:<br>
  - Description: Yuque API token (yuque-sdk official env)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_YUQUE_TOKEN<br>
<br>
- **ones_token**:<br>
  - Description: Ones API token., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_ONES_TOKEN<br>
<br>
- **obsidian_vault_path**:<br>
  - Description: Obsidian vault directory path., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_OBSIDIAN_VAULT_PATH<br>
<br>
- **s3_access_key**:<br>
  - Description: S3 access key (boto3 official)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AWS_ACCESS_KEY_ID<br>
<br>
- **s3_secret_key**:<br>
  - Description: S3 secret key (boto3 official)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AWS_SECRET_ACCESS_KEY<br>
<br>
- **s3_endpoint_url**:<br>
  - Description: S3-compatible endpoint URL (optional)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_CLOUDFS_S3_ENDPOINT_URL<br>
<br>
- **s3_region_name**:<br>
  - Description: S3 region (boto3 official)., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_AWS_DEFAULT_REGION<br>
<br>
- **trace_consume_backend**:<br>
  - Description: The tracing consume backend used by LazyLLM., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_CONSUME_BACKEND<br>
<br>
- **trace_consume_timeout**:<br>
  - Description: Timeout in seconds for tracing consume backend requests., type: `float`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_TRACE_CONSUME_TIMEOUT<br>
<br>
- **debug**:<br>
  - Description: Whether to enable debug mode., type: `bool`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_DEBUG<br>
<br>
- **log_name**:<br>
  - Description: The name of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_NAME<br>
<br>
- **expected_log_modules**:<br>
  - Description: The expected log modules, separated by comma., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_EXPECTED_LOG_MODULES<br>
<br>
- **log_level**:<br>
  - Description: The level of the log., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_LEVEL<br>
<br>
- **log_format**:<br>
  - Description: The format of the log., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_FORMAT<br>
<br>
- **log_dir**:<br>
  - Description: The directory of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_DIR<br>
<br>
- **log_file_level**:<br>
  - Description: The level of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_FILE_LEVEL<br>
<br>
- **log_file_size**:<br>
  - Description: The size of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_FILE_SIZE<br>
<br>
- **log_file_retention**:<br>
  - Description: The retention of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_FILE_RETENTION<br>
<br>
- **log_file_mode**:<br>
  - Description: The mode of the log file., type: `str`, default: `{desc["default"]}`<br>
  - Environment Variable: LAZYLLM_LOG_FILE_MODE<br>
"""
    def __init__(self, prefix: str = 'LAZYLLM', home: Optional[str] = None, config_file: str = 'config.json'):
        self._prefix = prefix.upper()
        self._impl, self._cfgs = dict(), dict()
        if not home:
            home = '.lazyllm' if self._prefix == 'LAZYLLM' else f'.lazyllm_{prefix.lower()}'
            home = os.path.join(os.path.expanduser('~'), home)
        _ConfigMeta._homes[self._prefix] = home
        self._update_impl('home', str, None, 'HOME')
        os.makedirs(self['home'], exist_ok=True)
        self._cgf_path = os.path.join(self['home'], config_file)
        if os.path.exists(self._cgf_path):
            with open(self._cgf_path, 'r+') as f:
                self._cfgs = Config.get_config(json.loads(f))
        for name, cfg in _ConfigMeta._registered_cfgs.items():
            if name == 'home': continue
            self._update_impl(name, cfg['type'], cfg['default'], cfg['env'])

    def add(self, name: str, type: type, default: Optional[Union[int, str, bool]] = None, env: Union[str, dict] = None,
            *, options: Optional[List] = None, description: Optional[str] = None):
        """Loads value into LazyLLM configuration item. The function first attempts to find the value with the given name from the
dict loaded from config.json. If found, it removes the key from the dict and saves the value to the config.
If 'env' is a string, the function calls getenv to look for the corresponding LazyLLM environment variable, and if
it's found, writes it to the config. If 'env' is a dictionary, the function attempts to call getenv to find the
environment variables corresponding to the keys in the dict and convert them to boolean type.
If the converted boolean value is True, the value corresponding to the current key in the dict is written to the config.

Args:
    name (str): The name of the configuration item
    type (type): The type of the configuration
    default (optional): The default value of the configuration if no value can be obtained
    env (optional): The name of the environment variable without the prefix, or a dictionary where the keys are the
    names of the environment variables(without the prefix), and the values are what to be added to the configuration.
"""
        if (name := name.lower()) in Config.__dict__.keys():
            raise RuntimeError(f'{name} is attribute of Config, please change it!')
        _ConfigMeta.add(name, type, default, env, options=options, description=description)

    def getenv(self, name, type, default=None):
        """Get value of LazyLLM-related environment variables.

Args:
    name (str): The name of the environment variable (without the prefix), case-insensitive. The function obtains value
    from environment variable by concatenating the prefix and this name, with all uppercase letters.
    type (type): Specifies the type of the configuration, for example, str. For boolean types, the function will
    convert inputs ‘TRUE’, ‘True’, 1, ‘ON’, and ‘1’ to True.
    default (optional): If the value of the environment variable cannot be obtained, this value is returned.
"""
        r = os.getenv(f'{self._prefix}_{name.upper()}', default)
        if type == bool:
            return r in (True, 'TRUE', 'true', 'True', 1, 'ON', 'On', 'on', '1', 'yes', 'Yes', 'Y', 'y')
        return type(r) if r is not None else r

    @staticmethod
    def get_config(cfg):
        """
Static method: Get configuration from config dictionary.
This is a simple configuration retrieval method mainly used to extract configuration information from already loaded configuration dictionaries.

Args:
    cfg (dict): The configuration dictionary read from the config file.
"""
        return cfg

    def get_all_configs(self):
        """Get all configurations from the config.

Args:
    None.


Examples:
    >>> import lazyllm
    >>> from lazyllm.configs import config
    >>> config['launcher']
    'empty'
    >>> config.get_all_configs()
    {'home': '~/.lazyllm/', 'mode': <Mode.Normal: (1,)>, 'repr_ml': False, 'rag_store': 'None', 'redis_url': 'None', ...}
    """
        return self._impl

    def done(self):
        """Check if any configuration items in the config.json file that is not loaded by the add method.

Args:
    None.
"""
        ins = _ConfigMeta._instances['lazyllm']
        assert len(ins._cfgs) == 0, f'Invalid cfgs ({"".join(ins._cfgs.keys())}) are given in {ins._cgf_path}'

    @contextmanager
    def temp(self, name, value):
        """
Context manager for temporary configuration modification.
Temporarily modifies the value of the specified configuration item within the with statement block, and automatically restores the original value when exiting the block.
Attention: this function is not thread-safe, you should not use it in multi-thread or multi-coroutine environment.

Args:
    name (str): The name of the configuration item to temporarily change.
    value (Any): The temporary value to set.
"""
        old_value = self[name]
        self._impl[name] = value
        yield
        self._impl[name] = old_value

    def _update_impl(self, name: str, type: type, default: Optional[Union[int, str, bool]] = None,
                     env: Union[str, dict, list] = None):
        self._impl[name] = self._cfgs.pop(name) if name in self._cfgs else (
            _ConfigMeta._get_default_home(self._prefix) if name == 'home' else default)
        if isinstance(env, dict):
            for k, v in env.items():
                if self.getenv(k, bool):
                    self._impl[name] = v
                    break
        elif isinstance(env, list):
            for k in env:
                if (v := self.getenv(k, type)):
                    self._impl[name] = v
                    break
        elif env:
            self._impl[name] = self.getenv(env, type, self._impl[name])
        if not isinstance(self._impl[name], type) and self._impl[name] is not None: raise TypeError(
            f'Invalid config type for {name}, type is {type}')

    def __getitem__(self, name):
        if isinstance(name, bytes): name = name.decode('utf-8')
        name = name.lower()
        if name.startswith(f'{self._prefix.lower()}_'): name = name[len(self._prefix) + 1:]
        try:
            return self._impl[name]
        except KeyError:
            raise KeyError(
                f'Unknown config key: "{name}". '
                'Please register it via config.add(...) before access.'
            ) from None

    def __str__(self):
        return str(self._impl)

    @property
    def _envs(self):
        return [f'{self._prefix}_{e}'.lower() for e in _ConfigMeta._env_name_map.keys()]

    def refresh(self, targets: Union[bytes, str, List[str]] = None) -> None:
        """
Refresh configuration items based on the latest environment variable values.  
If `targets` is a string, updates the single corresponding configuration item;  
if it's a list, updates multiple;  
if None, scans all environment-variable-mapped configuration items and updates them.

Args:
    targets (str | list[str] | None): Name of the config key or list of keys to refresh, or None to refresh all environment-backed keys.
"""
        names, all_envs = targets, self._envs
        if isinstance(targets, bytes): targets = targets.decode('utf-8')
        if isinstance(targets, str): names = [targets.lower()]
        elif targets is None:
            names = [key.lower() for key in os.environ.keys() if key.lower() in all_envs]
        assert isinstance(names, list)
        for name in names:
            if name.lower() in all_envs:
                name = _ConfigMeta._env_name_map[name[len(self._prefix) + 1:]]
            elif name in Config: continue
            cfg = _ConfigMeta._registered_cfgs[name]
            if name in self._impl: self._update_impl(name, cfg['type'], cfg['default'], cfg['env'])

done()

Check if any configuration items in the config.json file that is not loaded by the add method.

Source code in lazyllm/configs.py
    def done(self):
        """Check if any configuration items in the config.json file that is not loaded by the add method.

Args:
    None.
"""
        ins = _ConfigMeta._instances['lazyllm']
        assert len(ins._cfgs) == 0, f'Invalid cfgs ({"".join(ins._cfgs.keys())}) are given in {ins._cgf_path}'

getenv(name, type, default=None)

Get value of LazyLLM-related environment variables.

Parameters:

  • name (str) –

    The name of the environment variable (without the prefix), case-insensitive. The function obtains value

  • type (type) –

    Specifies the type of the configuration, for example, str. For boolean types, the function will

  • default (optional, default: None ) –

    If the value of the environment variable cannot be obtained, this value is returned.

Source code in lazyllm/configs.py
    def getenv(self, name, type, default=None):
        """Get value of LazyLLM-related environment variables.

Args:
    name (str): The name of the environment variable (without the prefix), case-insensitive. The function obtains value
    from environment variable by concatenating the prefix and this name, with all uppercase letters.
    type (type): Specifies the type of the configuration, for example, str. For boolean types, the function will
    convert inputs ‘TRUE’, ‘True’, 1, ‘ON’, and ‘1’ to True.
    default (optional): If the value of the environment variable cannot be obtained, this value is returned.
"""
        r = os.getenv(f'{self._prefix}_{name.upper()}', default)
        if type == bool:
            return r in (True, 'TRUE', 'true', 'True', 1, 'ON', 'On', 'on', '1', 'yes', 'Yes', 'Y', 'y')
        return type(r) if r is not None else r

add(name, type, default=None, env=None, *, options=None, description=None)

Loads value into LazyLLM configuration item. The function first attempts to find the value with the given name from the dict loaded from config.json. If found, it removes the key from the dict and saves the value to the config. If 'env' is a string, the function calls getenv to look for the corresponding LazyLLM environment variable, and if it's found, writes it to the config. If 'env' is a dictionary, the function attempts to call getenv to find the environment variables corresponding to the keys in the dict and convert them to boolean type. If the converted boolean value is True, the value corresponding to the current key in the dict is written to the config.

Parameters:

  • name (str) –

    The name of the configuration item

  • type (type) –

    The type of the configuration

  • default (optional, default: None ) –

    The default value of the configuration if no value can be obtained

  • env (optional, default: None ) –

    The name of the environment variable without the prefix, or a dictionary where the keys are the

Source code in lazyllm/configs.py
    def add(self, name: str, type: type, default: Optional[Union[int, str, bool]] = None, env: Union[str, dict] = None,
            *, options: Optional[List] = None, description: Optional[str] = None):
        """Loads value into LazyLLM configuration item. The function first attempts to find the value with the given name from the
dict loaded from config.json. If found, it removes the key from the dict and saves the value to the config.
If 'env' is a string, the function calls getenv to look for the corresponding LazyLLM environment variable, and if
it's found, writes it to the config. If 'env' is a dictionary, the function attempts to call getenv to find the
environment variables corresponding to the keys in the dict and convert them to boolean type.
If the converted boolean value is True, the value corresponding to the current key in the dict is written to the config.

Args:
    name (str): The name of the configuration item
    type (type): The type of the configuration
    default (optional): The default value of the configuration if no value can be obtained
    env (optional): The name of the environment variable without the prefix, or a dictionary where the keys are the
    names of the environment variables(without the prefix), and the values are what to be added to the configuration.
"""
        if (name := name.lower()) in Config.__dict__.keys():
            raise RuntimeError(f'{name} is attribute of Config, please change it!')
        _ConfigMeta.add(name, type, default, env, options=options, description=description)

get_all_configs()

Get all configurations from the config.

Examples:

>>> import lazyllm
>>> from lazyllm.configs import config
>>> config['launcher']
'empty'
>>> config.get_all_configs()
{'home': '~/.lazyllm/', 'mode': <Mode.Normal: (1,)>, 'repr_ml': False, 'rag_store': 'None', 'redis_url': 'None', ...}
Source code in lazyllm/configs.py
    def get_all_configs(self):
        """Get all configurations from the config.

Args:
    None.


Examples:
    >>> import lazyllm
    >>> from lazyllm.configs import config
    >>> config['launcher']
    'empty'
    >>> config.get_all_configs()
    {'home': '~/.lazyllm/', 'mode': <Mode.Normal: (1,)>, 'repr_ml': False, 'rag_store': 'None', 'redis_url': 'None', ...}
    """
        return self._impl

get_config(cfg) staticmethod

Static method: Get configuration from config dictionary. This is a simple configuration retrieval method mainly used to extract configuration information from already loaded configuration dictionaries.

Parameters:

  • cfg (dict) –

    The configuration dictionary read from the config file.

Source code in lazyllm/configs.py
    @staticmethod
    def get_config(cfg):
        """
Static method: Get configuration from config dictionary.
This is a simple configuration retrieval method mainly used to extract configuration information from already loaded configuration dictionaries.

Args:
    cfg (dict): The configuration dictionary read from the config file.
"""
        return cfg

temp(name, value)

Context manager for temporary configuration modification. Temporarily modifies the value of the specified configuration item within the with statement block, and automatically restores the original value when exiting the block. Attention: this function is not thread-safe, you should not use it in multi-thread or multi-coroutine environment.

Parameters:

  • name (str) –

    The name of the configuration item to temporarily change.

  • value (Any) –

    The temporary value to set.

Source code in lazyllm/configs.py
    @contextmanager
    def temp(self, name, value):
        """
Context manager for temporary configuration modification.
Temporarily modifies the value of the specified configuration item within the with statement block, and automatically restores the original value when exiting the block.
Attention: this function is not thread-safe, you should not use it in multi-thread or multi-coroutine environment.

Args:
    name (str): The name of the configuration item to temporarily change.
    value (Any): The temporary value to set.
"""
        old_value = self[name]
        self._impl[name] = value
        yield
        self._impl[name] = old_value

refresh(targets=None)

Refresh configuration items based on the latest environment variable values.
If targets is a string, updates the single corresponding configuration item;
if it's a list, updates multiple;
if None, scans all environment-variable-mapped configuration items and updates them.

Parameters:

  • targets (str | list[str] | None, default: None ) –

    Name of the config key or list of keys to refresh, or None to refresh all environment-backed keys.

Source code in lazyllm/configs.py
    def refresh(self, targets: Union[bytes, str, List[str]] = None) -> None:
        """
Refresh configuration items based on the latest environment variable values.  
If `targets` is a string, updates the single corresponding configuration item;  
if it's a list, updates multiple;  
if None, scans all environment-variable-mapped configuration items and updates them.

Args:
    targets (str | list[str] | None): Name of the config key or list of keys to refresh, or None to refresh all environment-backed keys.
"""
        names, all_envs = targets, self._envs
        if isinstance(targets, bytes): targets = targets.decode('utf-8')
        if isinstance(targets, str): names = [targets.lower()]
        elif targets is None:
            names = [key.lower() for key in os.environ.keys() if key.lower() in all_envs]
        assert isinstance(names, list)
        for name in names:
            if name.lower() in all_envs:
                name = _ConfigMeta._env_name_map[name[len(self._prefix) + 1:]]
            elif name in Config: continue
            cfg = _ConfigMeta._registered_cfgs[name]
            if name in self._impl: self._update_impl(name, cfg['type'], cfg['default'], cfg['env'])