Get the LLM configuration status. Returns whether LLM is enabled at system and user level, and the configured provider and model.
()
| 368 | @blueprint.route("/status", methods=["GET"], endpoint='status') |
| 369 | @pga_login_required |
| 370 | def get_llm_status(): |
| 371 | """ |
| 372 | Get the LLM configuration status. |
| 373 | Returns whether LLM is enabled at system and user level, |
| 374 | and the configured provider and model. |
| 375 | """ |
| 376 | from pgadmin.llm.utils import ( |
| 377 | is_llm_enabled, is_llm_enabled_system, get_default_provider, |
| 378 | get_anthropic_model, get_openai_model, get_ollama_model, |
| 379 | get_docker_model |
| 380 | ) |
| 381 | |
| 382 | provider = get_default_provider() |
| 383 | model = None |
| 384 | if provider == 'anthropic': |
| 385 | model = get_anthropic_model() |
| 386 | elif provider == 'openai': |
| 387 | model = get_openai_model() |
| 388 | elif provider == 'ollama': |
| 389 | model = get_ollama_model() |
| 390 | elif provider == 'docker': |
| 391 | model = get_docker_model() |
| 392 | |
| 393 | return make_json_response( |
| 394 | success=1, |
| 395 | data={ |
| 396 | 'enabled': is_llm_enabled(), |
| 397 | 'system_enabled': is_llm_enabled_system(), |
| 398 | 'provider': provider, |
| 399 | 'model': model |
| 400 | } |
| 401 | ) |
| 402 | |
| 403 | |
| 404 | @blueprint.route( |
nothing calls this directly
no test coverage detected