MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_ollama_models

Function get_ollama_models

web/pgadmin/llm/__init__.py:619–646  ·  view source on GitHub ↗

Fetch available Ollama models.

()

Source from the content-addressed store, hash-verified

617@blueprint.route("/models/ollama", methods=["GET"], endpoint='models_ollama')
618@pga_login_required
619def get_ollama_models():
620 """
621 Fetch available Ollama models.
622 """
623 from pgadmin.llm.utils import get_ollama_api_url
624
625 api_url = get_ollama_api_url()
626 if not api_url:
627 return make_json_response(
628 data={'models': [], 'error': 'No API URL configured'},
629 status=200
630 )
631
632 try:
633 models = _fetch_ollama_models(api_url)
634 return make_json_response(data={'models': models}, status=200)
635 except LLMApiError as e:
636 return make_json_response(
637 data={'models': [], 'error': str(e)},
638 status=200
639 )
640 except Exception:
641 return make_json_response(
642 data={'models': [],
643 'error': 'Failed to fetch Ollama models. '
644 'Check the API URL configuration.'},
645 status=200
646 )
647
648
649@blueprint.route(

Callers

nothing calls this directly

Calls 3

get_ollama_api_urlFunction · 0.90
make_json_responseFunction · 0.90
_fetch_ollama_modelsFunction · 0.85

Tested by

no test coverage detected