[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-4o-mini"

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

# LLM used for ingesting visual inputs
vlm = "openai/gpt-4o-mini"

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

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



  [app.max_upload_size_by_type]
    txt  = 2000000
    md   = 2000000
    tsv  = 2000000
    csv  = 5000000
    html = 5000000
    doc  = 10000000
    docx = 10000000
    ppt  = 20000000
    pptx = 20000000
    xls  = 10000000
    xlsx = 10000000
    odt  = 5000000
    pdf  = 30000000
    eml  = 5000000
    msg  = 5000000
    p7s  = 5000000
    bmp  = 5000000
    heic = 5000000
    jpeg = 5000000
    jpg  = 5000000
    png  = 5000000
    tiff = 5000000
    epub = 10000000
    rtf  = 5000000
    rst  = 5000000
    org  = 5000000

[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"
concurrent_request_limit = 256000
#fast_llm = "openai/gpt-4o-mini"

  [completion.generation_config]
  #model = "openai/gpt-4o-mini"
  temperature = 0.1
  top_p = 1.0
  max_tokens_to_sample = 1024
  stream = false
  add_generation_kwargs = { }

[crypto]
provider = "bcrypt"

[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 = 6400

collection_summary_system_prompt = "system"
collection_summary_prompt = "collection_summary"
disable_create_extension = false
kg_store_path = ""

  # 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"

  # 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 = 32
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
add_title_as_prefix = false
concurrent_request_limit = 256

[file]
provider = "postgres"
# If using S3
bucket_name = ""
endpoint_url = ""
region_name = ""
aws_access_key_id = ""
aws_secret_access_key = ""

[ingestion]
provider = "r2r"
chunking_strategy = "recursive"
chunk_size = 800
chunk_overlap = 400
excluded_parsers = ["mp4"]



# 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-4o-mini"
vision_img_model = "openai/gpt-4o-mini"
vision_pdf_model = "openai/gpt-4o-mini"
automatic_extraction = false # enable automatic extraction of entities and relations
vlm_batch_size=20
vlm_max_tokens_to_sample=1024
max_concurrent_vlm_tasks=20
vlm_ocr_one_page_per_chunk = true
# Audio transcription and vision model settings
audio_transcription_model = ""
skip_document_summary = false
document_summary_system_prompt = "system"
document_summary_task_prompt = "summary"
document_summary_max_length = 100000
chunks_for_document_summary = 128
document_summary_model = ""
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-4o-mini" }

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

[logging]
provider = "r2r"
log_table = "logs"
log_info_table = "log_info"

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

################################################################################
# Orchestration Settings (OrchestrationConfig)
################################################################################
[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"
