Files
homelab/ansible/roles/honcho/templates/honcho-api.container.j2
JARVIS f8cf139b10 fix(honcho): cover all LLM subsystems, enable flush, disable embeddings
Smoke-testing the first deploy uncovered three default-config issues
that no amount of Quadlet tuning would have caught:

  1. DIALECTIC subsystem ignored DERIVER_MODEL_CONFIG__*. Honcho splits
     dialectic into five reasoning levels (minimal/low/medium/high/max)
     each with its own MODEL_CONFIG that defaults to OpenAI. Without
     overrides, every /chat call fails with: ValidationException:
     Missing API key for openai model config. Now setting all five
     DIALECTIC_LEVELS__<level>__MODEL_CONFIG__* env vars to anthropic.

  2. DERIVER batches representation tasks until a token threshold is
     reached. For low-volume homelab use (one chatty operator), tasks
     can sit unprocessed forever. Add DERIVER_FLUSH_ENABLED knob,
     default true.

  3. Embeddings default to OpenAI text-embedding-3-small. Anthropic
     has no embedding API, so without an OpenAI key the embed step
     fails the entire derivation. Default EMBED_MESSAGES=false until
     a separate embedding provider is wired up (OpenAI for embeds-only
     or a local BGE endpoint on astro-orbiter).

defaults/main.yml documents all three issues and the migration path
back to embeddings when ready.
2026-05-31 00:10:59 -05:00

77 lines
3.5 KiB
Django/Jinja

# mk-labs Honcho API service (FastAPI on :8000)
# Managed by Ansible - honcho role
[Unit]
Description=Honcho API
After=network-online.target {{ honcho_postgres_container_name }}.service
Wants=network-online.target
Requires={{ honcho_postgres_container_name }}.service
[Container]
Image={{ honcho_image }}
ContainerName={{ honcho_container_name }}
Network={{ honcho_network_name }}
PublishPort={{ honcho_listen_address }}:{{ honcho_listen_port }}:8000
# Run the entrypoint that performs DB migration before starting FastAPI.
Exec=/app/docker/entrypoint.sh
# -- Database ---------------------------------------------------------------
Environment=DB_CONNECTION_URI=postgresql+psycopg://{{ honcho_db_user }}:{{ honcho_db_password }}@{{ honcho_postgres_container_name }}:5432/{{ honcho_db_name }}
# -- Auth -------------------------------------------------------------------
Environment=AUTH_USE_AUTH=*** honcho_auth_enabled | string | lower }}
Environment=AUTH_JWT_SECRET=*** honcho_jwt_secret }}
# -- LLM provider keys ------------------------------------------------------
{% if honcho_llm_transport == 'anthropic' %}
Environment=LLM_ANTHROPIC_API_KEY=*** honcho_anthropic_api_key }}
{% endif %}
# -- Deriver subsystem (background worker calls these to derive observations)
Environment=DERIVER_FLUSH_ENABLED={{ honcho_deriver_flush_enabled | string | lower }}
Environment=DERIVER_MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DERIVER_MODEL_CONFIG__MODEL={{ honcho_deriver_model }}
# -- Summary subsystem (periodic session summaries) -------------------------
Environment=SUMMARY_MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=SUMMARY_MODEL_CONFIG__MODEL={{ honcho_summary_model }}
# -- Dialectic subsystem (answers theory-of-mind queries via peers/.../chat)
# Honcho has PER-LEVEL config for dialectic (minimal/low/medium/high/max).
# Each level defaults to OpenAI, so we override all five to anthropic.
Environment=DIALECTIC_LEVELS__minimal__MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DIALECTIC_LEVELS__minimal__MODEL_CONFIG__MODEL={{ honcho_dialectic_model }}
Environment=DIALECTIC_LEVELS__low__MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL={{ honcho_dialectic_model }}
Environment=DIALECTIC_LEVELS__medium__MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DIALECTIC_LEVELS__medium__MODEL_CONFIG__MODEL={{ honcho_dialectic_model }}
Environment=DIALECTIC_LEVELS__high__MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DIALECTIC_LEVELS__high__MODEL_CONFIG__MODEL={{ honcho_dialectic_model }}
Environment=DIALECTIC_LEVELS__max__MODEL_CONFIG__TRANSPORT={{ honcho_llm_transport }}
Environment=DIALECTIC_LEVELS__max__MODEL_CONFIG__MODEL={{ honcho_dialectic_model }}
# -- Embeddings -------------------------------------------------------------
# Anthropic has no embedding API. Disable embeddings unless an OpenAI key
# is provided. See defaults/main.yml for the three follow-up options.
Environment=EMBED_MESSAGES={{ honcho_embed_messages | string | lower }}
# -- Vector store -----------------------------------------------------------
Environment=VECTOR_STORE_TYPE=pgvector
# -- Public-facing URL (empty -> relative URLs, host-agnostic) --------------
{% if honcho_web_url | length > 0 %}
Environment=HONCHO_PUBLIC_URL=*** honcho_web_url }}
{% endif %}
# Timezone matches host baseline
Environment=TZ=America/Chicago
Environment=LOG_LEVEL=INFO
[Service]
Restart=always
TimeoutStartSec=180
[Install]
WantedBy=multi-user.target default.target