MicroFish/backend/app
Pedro Renan af75f626fd feat(llm): add LLM_JSON_MODE to support runtimes without response_format
OpenAI-compatible runtimes differ in how they handle `response_format`:
cloud providers (OpenAI, Qwen/Dashscope, Ollama) accept
`{"type": "json_object"}`, while local runtimes like LM Studio and
llama.cpp server reject it with HTTP 400, only accepting `json_schema`
or `text`. This prevented MiroFish from running against fully-local
stacks.

Introduce `LLM_JSON_MODE` (default `json_object`) so users can opt out
of strict JSON response mode by setting `LLM_JSON_MODE=none`. The
existing prompt-based JSON + markdown-tolerant parsing already handles
the unstructured response path robustly, so `none` is viable for any
OpenAI-compatible endpoint.

Applied at all three call sites that send `response_format`:
- utils/llm_client.py (chat_json helper)
- services/oasis_profile_generator.py (persona synthesis)
- services/simulation_config_generator.py (time/event/agent config)

Documented in .env.example with guidance on when to pick each value.
2026-04-24 21:46:12 +01:00
..
api fix(i18n): replace hardcoded Chinese stage names in simulation prepare SSE 2026-04-01 17:31:00 +08:00
models feat(i18n): replace hardcoded Chinese in backend SSE progress messages 2026-04-01 16:32:10 +08:00
services feat(llm): add LLM_JSON_MODE to support runtimes without response_format 2026-04-24 21:46:12 +01:00
utils feat(llm): add LLM_JSON_MODE to support runtimes without response_format 2026-04-24 21:46:12 +01:00
__init__.py Implement Report Agent for automated report generation and interaction 2025-12-09 15:10:55 +08:00
config.py feat(llm): add LLM_JSON_MODE to support runtimes without response_format 2026-04-24 21:46:12 +01:00