[app]
# app settings are global available like `r2r_config.agent.app`
# project_name = "r2r_default" # optional, can also set with `R2R_PROJECT_NAME` env var
default_max_documents_per_user = 1_000_000
default_max_chunks_per_user = 10_000_000
default_max_collections_per_user = 1_000_000

# Set the default max upload size to 2 GB for local testing
default_max_upload_size = 2147483648  # 2 GB for anything not explicitly listed

# LLM used for internal operations, like deriving conversation names
fast_llm = "openai/gpt-5-nano"

# LLM used for user-facing output, like RAG replies
quality_llm = "openai/gpt-5-mini"

# LLM used for ingesting visual inputs
vlm = "openai/gpt-5"

# LLM used for transcription
audio_lm = "openai/whisper-1"

# Reasoning model, used for `research` agent
reasoning_llm = "openai/o4-mini"
# Planning model, used for `research` agent
planning_llm = "anthropic/claude-3-7-sonnet-20250219"



  [app.max_upload_size_by_type]
    # Common text-based formats
    txt   = 2147483648  # 2 GB
    md    = 2147483648
    tsv   = 2147483648
    csv   = 2147483648
    xml   = 2147483648
    html  = 2147483648

    # Office docs
    doc   = 2147483648
    docx  = 2147483648
    ppt   = 2147483648
    pptx  = 2147483648
    xls   = 2147483648
    xlsx  = 2147483648
    odt   = 2147483648

    # PDFs
    pdf   = 2147483648

    # E-mail
    eml   = 2147483648
    msg   = 2147483648
    p7s   = 2147483648

    # Images
    bmp   = 2147483648
    heic  = 2147483648
    jpeg  = 2147483648
    jpg   = 2147483648
    png   = 2147483648
    tiff  = 2147483648

    # E-books and other formats
    epub  = 2147483648
    rtf   = 2147483648
    rst   = 2147483648
    org   = 2147483648

[agent]
rag_agent_static_prompt = "static_rag_agent"
rag_agent_dynamic_prompt = "dynamic_rag_agent"
#tools = ["search_file_knowledge", "content"]
rag_tools = ["search_file_descriptions", "search_file_knowledge", "get_file_content"] # can add  "web_search" | "web_scrape"
# The following tools are available to the `research` agent
research_tools = ["rag", "reasoning", "critique", "python_executor"]


# tool_names = ["local_search", "web_search"] # uncomment to enable web search
#tool_names = ["local_search"]

#  [agent.generation_config]
#  model = "openai/gpt-4o"

[auth]
provider = "r2r"
access_token_lifetime_in_minutes = 6000 # set a very high default value, for easier testing
refresh_token_lifetime_in_days = 7
require_authentication = false
require_email_verification = false
default_admin_email = "xujiawei@cocorobo.cc"
default_admin_password = "usestudio-1"

[completion]
provider = "r2r"
#fast_llm = "openai/gpt-4o-mini"
concurrent_request_limit = 256000
#fast_llm = "openai/gpt-4.1-mini"
request_timeout = 60

  [completion.generation_config]
  model = "openai/gpt-4.1-mini"
  temperature = 0.1
  top_p = 1.0
  max_tokens_to_sample = 10_240
  stream = false
  add_generation_kwargs = { }

[crypto]
provider = "bcrypt"

[file]
#provider = "postgres"
provider = "s3"
bucket_name = "r2r"
endpoint_url = "https://r2r.s3.cn-north-1.amazonaws.com.cn"
region_name = "cn-north-1"
aws_access_key_id = "AKIATLPEDU37YCOTNRHY"
aws_secret_access_key = "kUm8d4tKlvsApIXgJ8obn/RdK0EavYXJ977PIpRz"

[database]
provider = "postgres"
default_collection_name = "Default"
default_collection_description = "Your default collection."
# collection_summary_system_prompt = 'default_system'
# collection_summary_task_prompt = 'default_collection_summary'

# KG settings
batch_size = 64


  # PostgreSQL tuning settings
  [database.postgres_configuration_settings]
    checkpoint_completion_target = 0.7
    default_statistics_target = 100
    effective_io_concurrency = 4
    effective_cache_size = 5242880
    huge_pages = "try"
    maintenance_work_mem = 655360
    max_connections = 2560
    max_parallel_workers_per_gather = 16
    max_parallel_workers = 4
    max_parallel_maintenance_workers = 4
    max_wal_size = 102400
    max_worker_processes = 8
    min_wal_size = 80
    shared_buffers = 163840
    statement_cache_size = 1000
    random_page_cost = 1.1
    wal_buffers = 2560
    work_mem = 409600

  # Graph creation settings
  [database.graph_creation_settings]
    graph_entity_description_prompt = "graph_entity_description"
    graph_extraction_prompt = "graph_extraction"
    entity_types = []
    relation_types = []
    automatic_deduplication = false

  # Graph enrichment settings
  [database.graph_enrichment_settings]
    graph_communities_prompt = "graph_communities"

  # (Optional) Graph search settings – add fields as needed
  [database.graph_search_settings]
    # e.g., search_mode = "default"

  # Rate limiting settings
  [database.limits]
    global_per_min = 60
    route_per_min = 20
    monthly_limit = 10000

  # Route-specific limits (empty by default)
  [database.route_limits]
    # e.g., "/api/search" = { global_per_min = 30, route_per_min = 10, monthly_limit = 5000 }

  # User-specific limits (empty by default)
  [database.user_limits]
    # e.g., "user_uuid_here" = { global_per_min = 20, route_per_min = 5, monthly_limit = 2000 }

  [database.maintenance]
    vacuum_schedule = "0 3 * * *"  # Run at 3:00 AM daily


[embedding]
provider = "litellm"

# For basic applications, use `openai/text-embedding-3-small` with `base_dimension = 512`

# RECOMMENDED - For advanced applications,
# use `openai/text-embedding-3-large` with `base_dimension = 3072` and binary quantization
#base_model = "openai/text-embedding-3-small"
#base_dimension = 512

base_model = "openai/text-embedding-3-large"

#base_model = "/text-embedding-v3"

base_dimension = 256

rerank_model = ""
rerank_url = ""

# rerank_model = "huggingface/mixedbread-ai/mxbai-rerank-large-v1" # reranking model

batch_size = 256
prefixes = {}   # Provide prefix overrides here if needed
add_title_as_prefix = false
concurrent_request_limit = 2560
max_retries = 3
initial_backoff = 1.0
max_backoff = 64.0
# Deprecated fields (if still used)
rerank_dimension = 0
rerank_transformer_type = ""


  # Vector quantization settings for embeddings
  [embedding.quantization_settings]
    quantization_type = "FP32"
    # (Additional quantization parameters can be added here)

[completion_embedding]
# Generally this should be the same as the embedding config, but advanced users may want to run with a different provider to reduce latency
provider = "litellm"
base_model = "openai/text-embedding-3-large"
#base_model = "dashscope/text-embedding-v3"
base_dimension = 256
batch_size = 128
concurrent_request_limit = 256

[ingestion]
provider = "r2r"
chunking_strategy = "recursive"
chunk_size = 800
chunk_overlap = 400
excluded_parsers = ["mp4"]
max_concurrent_vlm_tasks=200
vlm_ocr_one_page_per_chunk = true

vlm_batch_size=200


# Ingestion-time document summary parameters
# skip_document_summary = False
# document_summary_system_prompt = 'default_system'
# document_summary_task_prompt = 'default_summary'
# chunks_for_document_summary = 128
document_summary_model = "openai/gpt-4.1-mini"
vision_img_model = "openai/gpt-4.1-mini"
vision_pdf_model = "openai/gpt-4.1-mini"
automatic_extraction = false # enable automatic extraction of entities and relations
parser_overrides = {}


  # Chunk enrichment settings
  [ingestion.chunk_enrichment_settings]
    chunk_enrichment_prompt = "chunk_enrichment"
    enable_chunk_enrichment = false
    n_chunks = 2

#  [ingestion.chunk_enrichment_settings]
#    enable_chunk_enrichment = false # disabled by default
#    n_chunks = 2 # the number of chunks (both preceeding and succeeding) to use in enrichment
#    generation_config = { model = "openai/gpt-4.1-mini" }

  [ingestion.extra_parsers]
    pdf = ["ocr", "zerox"]
    #pdf = "ocr"

[ocr]
provider = "mistral"
model = "mistral-ocr-latest"

[orchestration]
#provider = "no"
max_runs = 2048
kg_creation_concurrency_limit = 32
ingestion_concurrency_limit = 16
kg_concurrency_limit = 4

[prompt]
provider = "r2r"

[email]
provider = "console_mock"

[scheduler]
provider = "apscheduler"
