config.yaml 13.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 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
runtime:
  environment: prod
  index_namespace: ''
  api_host: 0.0.0.0
  api_port: 6002
  indexer_host: 0.0.0.0
  indexer_port: 6004
  embedding_host: 0.0.0.0
  embedding_port: 6005
  embedding_text_port: 6005
  embedding_image_port: 6008
  translator_host: 0.0.0.0
  translator_port: 6006
  reranker_host: 0.0.0.0
  reranker_port: 6007
infrastructure:
  elasticsearch:
    host: http://localhost:9200
    username: null
    password: null
  redis:
    host: localhost
    port: 6479
    snapshot_db: 0
    password: null
    socket_timeout: 1
    socket_connect_timeout: 1
    retry_on_timeout: false
    cache_expire_days: 720
    embedding_cache_prefix: embedding
    anchor_cache_prefix: product_anchors
    anchor_cache_expire_days: 30
  database:
    host: null
    port: 3306
    database: null
    username: null
    password: null
  secrets:
    dashscope_api_key: null
    deepl_auth_key: null
es_index_name: search_products
indexes: []
assets:
  query_rewrite_dictionary_path: config/dictionaries/query_rewrite.dict
product_enrich:
  max_workers: 40
es_settings:
  number_of_shards: 1
  number_of_replicas: 0
  refresh_interval: 30s
field_boosts:
  title: 3.0
  qanchors: 2.5
  tags: 2.0
  category_name_text: 2.0
  category_path: 2.0
  brief: 1.5
  description: 1.5
  vendor: 1.5
  option1_values: 1.5
  option2_values: 1.5
  option3_values: 1.5
query_config:
  supported_languages:
  - zh
  - en
  default_language: en
  enable_text_embedding: true
  enable_query_rewrite: true
  zh_to_en_model: nllb-200-distilled-600m
  en_to_zh_model: nllb-200-distilled-600m
  default_translation_model: nllb-200-distilled-600m
  zh_to_en_model__source_not_in_index: nllb-200-distilled-600m
  en_to_zh_model__source_not_in_index: nllb-200-distilled-600m
  default_translation_model__source_not_in_index: nllb-200-distilled-600m
  translation_embedding_wait_budget_ms_source_in_index: 200
  translation_embedding_wait_budget_ms_source_not_in_index: 300
  style_intent:
    enabled: true
    selected_sku_boost: 1.2
    color_dictionary_path: config/dictionaries/style_intent_color.csv
    size_dictionary_path: config/dictionaries/style_intent_size.csv
    dimension_aliases:
      color:
      - color
      - colors
      - colour
      - colours
      - 颜色
      - 
      - 色系
      size:
      - size
      - sizes
      - sizing
      - 尺码
      - 尺寸
      - 码数
      - 号码
      - 
  product_title_exclusion:
    enabled: true
    dictionary_path: config/dictionaries/product_title_exclusion.tsv
  search_fields:
    multilingual_fields:
    - title
    - qanchors
    - category_path
    - category_name_text
    - brief
    - description
    - vendor
    shared_fields: null
    core_multilingual_fields:
    - title
    - qanchors
    - category_name_text
  text_query_strategy:
    base_minimum_should_match: 60%
    translation_minimum_should_match: 60%
    translation_boost: 0.75
    tie_breaker_base_query: 0.5
    best_fields_boost: 2.0
    best_fields:
      title: 4.0
      qanchors: 3.0
      category_name_text: 2.0
    phrase_fields:
      title: 5.0
      qanchors: 4.0
    phrase_match_boost: 3.0
  text_embedding_field: title_embedding
  image_embedding_field: image_embedding.vector
  source_fields:
  - spu_id
  - handle
  - title
  - brief
  - description
  - vendor
  - category_name
  - category_name_text
  - category_path
  - category_id
  - category_level
  - category1_name
  - category2_name
  - category3_name
  - tags
  - min_price
  - compare_at_price
  - image_url
  - sku_prices
  - sku_weights
  - sku_weight_units
  - total_inventory
  - option1_name
  - option1_values
  - option2_name
  - option2_values
  - option3_name
  - option3_values
  - specifications
  - skus
  knn_text_boost: 4
  knn_image_boost: 4
  knn_text_k: 160
  knn_text_num_candidates: 560
  knn_text_k_long: 400
  knn_text_num_candidates_long: 1200
  knn_image_k: 400
  knn_image_num_candidates: 1200
function_score:
  score_mode: sum
  boost_mode: multiply
  functions: []
coarse_rank:
  enabled: true
  input_window: 700
  output_window: 240
  fusion:
    text_bias: 0.1
    text_exponent: 0.35
    text_translation_weight: 1.0
    knn_text_weight: 1.0
    knn_image_weight: 1.0
    knn_tie_breaker: 0.1
    knn_bias: 0.6
    knn_exponent: 0.0
fine_rank:
  enabled: false
  input_window: 160
  output_window: 80
  timeout_sec: 10.0
  rerank_query_template: '{query}'
  rerank_doc_template: '{title}'
  service_profile: fine
rerank:
  enabled: true
  rerank_window: 160
  timeout_sec: 15.0
  weight_es: 0.4
  weight_ai: 0.6
  rerank_query_template: '{query}'
  rerank_doc_template: '{title}'
  service_profile: default
  fusion:
    rerank_bias: 1.0e-05
    rerank_exponent: 1.15
    fine_bias: 1.0e-05
    fine_exponent: 1.0
    text_bias: 0.1
    text_exponent: 0.25
    text_translation_weight: 0.8
    knn_text_weight: 1.0
    knn_image_weight: 1.0
    knn_tie_breaker: 0.1
    knn_bias: 0.6
    knn_exponent: 0.0
services:
  translation:
    service_url: http://127.0.0.1:6006
    default_model: nllb-200-distilled-600m
    default_scene: general
    timeout_sec: 10.0
    cache:
      ttl_seconds: 62208000
      sliding_expiration: true
      enable_model_quality_tier_cache: true
      model_quality_tiers:
        deepl: 30
        qwen-mt: 30
        llm: 30
        nllb-200-distilled-600m: 20
        opus-mt-zh-en: 10
        opus-mt-en-zh: 10
    capabilities:
      qwen-mt:
        enabled: true
        backend: qwen_mt
        model: qwen-mt-flash
        base_url: https://dashscope-us.aliyuncs.com/compatible-mode/v1
        timeout_sec: 10.0
        use_cache: true
      llm:
        enabled: true
        backend: llm
        model: qwen-flash
        base_url: https://dashscope-us.aliyuncs.com/compatible-mode/v1
        timeout_sec: 30.0
        use_cache: true
      deepl:
        enabled: true
        backend: deepl
        api_url: https://api.deepl.com/v2/translate
        timeout_sec: 10.0
        glossary_id: ''
        use_cache: true
      nllb-200-distilled-600m:
        enabled: true
        backend: local_nllb
        model_id: facebook/nllb-200-distilled-600M
        model_dir: ./models/translation/facebook/nllb-200-distilled-600M
        ct2_model_dir: ./models/translation/facebook/nllb-200-distilled-600M/ctranslate2-float16
        ct2_compute_type: float16
        ct2_conversion_quantization: float16
        ct2_auto_convert: true
        ct2_inter_threads: 4
        ct2_intra_threads: 0
        ct2_max_queued_batches: 32
        ct2_batch_type: examples
        ct2_decoding_length_mode: source
        ct2_decoding_length_extra: 8
        ct2_decoding_length_min: 32
        device: cuda
        torch_dtype: float16
        batch_size: 64
        max_input_length: 256
        max_new_tokens: 64
        num_beams: 1
        use_cache: true
      opus-mt-zh-en:
        enabled: false
        backend: local_marian
        model_id: Helsinki-NLP/opus-mt-zh-en
        model_dir: ./models/translation/Helsinki-NLP/opus-mt-zh-en
        ct2_model_dir: ./models/translation/Helsinki-NLP/opus-mt-zh-en/ctranslate2-float16
        ct2_compute_type: float16
        ct2_conversion_quantization: float16
        ct2_auto_convert: true
        ct2_inter_threads: 1
        ct2_intra_threads: 0
        ct2_max_queued_batches: 0
        ct2_batch_type: examples
        device: cuda
        torch_dtype: float16
        batch_size: 16
        max_input_length: 256
        max_new_tokens: 256
        num_beams: 1
        use_cache: true
      opus-mt-en-zh:
        enabled: false
        backend: local_marian
        model_id: Helsinki-NLP/opus-mt-en-zh
        model_dir: ./models/translation/Helsinki-NLP/opus-mt-en-zh
        ct2_model_dir: ./models/translation/Helsinki-NLP/opus-mt-en-zh/ctranslate2-float16
        ct2_compute_type: float16
        ct2_conversion_quantization: float16
        ct2_auto_convert: true
        ct2_inter_threads: 1
        ct2_intra_threads: 0
        ct2_max_queued_batches: 0
        ct2_batch_type: examples
        device: cuda
        torch_dtype: float16
        batch_size: 16
        max_input_length: 256
        max_new_tokens: 256
        num_beams: 1
        use_cache: true
  embedding:
    provider: http
    providers:
      http:
        text_base_url: http://127.0.0.1:6005
        image_base_url: http://127.0.0.1:6008
    backend: tei
    backends:
      tei:
        base_url: http://127.0.0.1:8080
        timeout_sec: 20
        model_id: Qwen/Qwen3-Embedding-0.6B
      local_st:
        model_id: Qwen/Qwen3-Embedding-0.6B
        device: cuda
        batch_size: 32
        normalize_embeddings: true
    image_backend: clip_as_service
    image_backends:
      clip_as_service:
        server: grpc://127.0.0.1:51000
        model_name: CN-CLIP/ViT-L-14
        batch_size: 8
        normalize_embeddings: true
      local_cnclip:
        model_name: ViT-L-14
        device: null
        batch_size: 8
        normalize_embeddings: true
  rerank:
    provider: http
    providers:
      http:
        instances:
          default:
            base_url: http://127.0.0.1:6007
            service_url: http://127.0.0.1:6007/rerank
          fine:
            base_url: http://127.0.0.1:6009
            service_url: http://127.0.0.1:6009/rerank
    request:
      max_docs: 1000
      normalize: true
    default_instance: default
    instances:
      default:
        host: 0.0.0.0
        port: 6007
        backend: qwen3_vllm_score
        runtime_dir: ./.runtime/reranker/default
      fine:
        host: 0.0.0.0
        port: 6009
        backend: bge
        runtime_dir: ./.runtime/reranker/fine
    backends:
      bge:
        model_name: BAAI/bge-reranker-v2-m3
        device: null
        use_fp16: true
        batch_size: 80
        max_length: 160
        cache_dir: ./model_cache
        enable_warmup: true
      jina_reranker_v3:
        model_name: jinaai/jina-reranker-v3
        device: null
        dtype: float16
        batch_size: 64
        max_doc_length: 160
        max_query_length: 64
        sort_by_doc_length: true
        cache_dir: ./model_cache
        trust_remote_code: true
      qwen3_vllm:
        model_name: Qwen/Qwen3-Reranker-0.6B
        engine: vllm
        max_model_len: 256
        tensor_parallel_size: 1
        gpu_memory_utilization: 0.2
        dtype: float16
        enable_prefix_caching: true
        enforce_eager: false
        infer_batch_size: 100
        sort_by_doc_length: true
        instruction_format: standard
        instruction: rank products by given query
      qwen3_vllm_score:
        model_name: Qwen/Qwen3-Reranker-0.6B
        use_original_qwen3_hf_overrides: true
        engine: vllm
        max_model_len: 172
        tensor_parallel_size: 1
        gpu_memory_utilization: 0.15
        dtype: float16
        enable_prefix_caching: true
        enforce_eager: false
        infer_batch_size: 80
        sort_by_doc_length: true
        instruction_format: standard
        instruction: Rank products by query with category & style match prioritized
      qwen3_transformers:
        model_name: Qwen/Qwen3-Reranker-0.6B
        instruction: rank products by given query
        max_length: 8192
        batch_size: 64
        use_fp16: true
        attn_implementation: sdpa
      qwen3_transformers_packed:
        model_name: Qwen/Qwen3-Reranker-0.6B
        instruction: Rank products by query with category & style match prioritized
        max_model_len: 256
        max_doc_len: 160
        max_docs_per_pack: 0
        use_fp16: true
        sort_by_doc_length: true
        attn_implementation: eager
      qwen3_gguf:
        repo_id: DevQuasar/Qwen.Qwen3-Reranker-4B-GGUF
        filename: '*Q8_0.gguf'
        cache_dir: ./model_cache
        local_dir: ./models/reranker/qwen3-reranker-4b-gguf
        instruction: Rank products by query with category & style match prioritized
        n_ctx: 512
        n_batch: 512
        n_ubatch: 512
        n_gpu_layers: 999
        main_gpu: 0
        n_threads: 2
        n_threads_batch: 4
        flash_attn: true
        offload_kqv: true
        use_mmap: true
        use_mlock: false
        infer_batch_size: 8
        sort_by_doc_length: true
        length_sort_mode: char
        enable_warmup: true
        verbose: false
      qwen3_gguf_06b:
        repo_id: ggml-org/Qwen3-Reranker-0.6B-Q8_0-GGUF
        filename: qwen3-reranker-0.6b-q8_0.gguf
        cache_dir: ./model_cache
        local_dir: ./models/reranker/qwen3-reranker-0.6b-q8_0-gguf
        instruction: Rank products by query with category & style match prioritized
        n_ctx: 256
        n_batch: 256
        n_ubatch: 256
        n_gpu_layers: 999
        main_gpu: 0
        n_threads: 2
        n_threads_batch: 4
        flash_attn: true
        offload_kqv: true
        use_mmap: true
        use_mlock: false
        infer_batch_size: 32
        sort_by_doc_length: true
        length_sort_mode: char
        reuse_query_state: false
        enable_warmup: true
        verbose: false
      dashscope_rerank:
        model_name: qwen3-rerank
        endpoint: https://dashscope.aliyuncs.com/compatible-api/v1/reranks
        api_key_env: RERANK_DASHSCOPE_API_KEY_CN
        timeout_sec: 10.0
        top_n_cap: 0
        batchsize: 64
        instruct: Given a shopping query, rank product titles by relevance
        max_retries: 2
        retry_backoff_sec: 0.2
spu_config:
  enabled: true
  spu_field: spu_id
  inner_hits_size: 10
  searchable_option_dimensions:
  - option1
  - option2
  - option3
tenant_config:
  default:
    primary_language: en
    index_languages:
    - en
    - zh
  tenants:
    '1':
      primary_language: zh
      index_languages:
      - zh
      - en
    '2':
      primary_language: en
      index_languages:
      - en
      - zh
    '3':
      primary_language: zh
      index_languages:
      - zh
      - en
    '162':
      primary_language: zh
      index_languages:
      - zh
      - en
    '170':
      primary_language: en
      index_languages:
      - en
      - zh