Skip to content

feat(ai): add Ollama provider integration with parallel LLM calls#35

Merged
aGallea merged 2 commits into
masterfrom
feat/ollama-provider-integration
Mar 31, 2026
Merged

feat(ai): add Ollama provider integration with parallel LLM calls#35
aGallea merged 2 commits into
masterfrom
feat/ollama-provider-integration

Conversation

@aGallea

@aGallea aGallea commented Mar 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace free-text provider input with a closed dropdown (OpenAI, Google, Anthropic, Ollama)
  • When Ollama is selected, fetch available models from local instance via POST /api/ai/ollama/models and display as selectable dropdown
  • Skip API key requirement for Ollama across frontend (Settings, ClusterLegend, ClusterDetailDrawer) and backend (litellm calls)
  • Normalize base URL by stripping /v1 suffix for Ollama models since litellm's ollama/ provider uses the native API, not the OpenAI-compatible endpoint
  • Parallelize cluster naming LLM calls using asyncio.gather + thread pool executor for significantly faster naming (N clusters in ~1 call duration instead of N x call duration)

Changed Files

Backend:

  • ai_naming.py — Add _normalize_base_url(), conditionally pass api_key to litellm
  • server/models.py — Add OllamaModelsRequest, OllamaModel, OllamaModelsResponse
  • server/routes/ai.py — Add Ollama models endpoint, parallelize name_clusters and name_sub_clusters

Frontend:

  • api/ai.ts — Add AI_PROVIDERS constant, AiProvider type, fetchOllamaModels()
  • pages/SettingsPage.tsx — Provider dropdown, Ollama model dropdown, conditional API key
  • components/plot/ClusterLegend.tsx — Allow naming without API key for Ollama
  • components/plot/ClusterDetailDrawer.tsx — Allow sub-cluster naming without API key for Ollama
  • types/index.ts — Add OllamaModel, OllamaModelsResponse types

Test Plan

  • All 265 tests pass
  • mypy + ruff clean
  • Pre-commit hooks pass
  • Manual E2E: Select Ollama -> models load -> Name with AI works without API key

- Add provider dropdown (OpenAI, Google, Anthropic, Ollama) replacing free-text input
- Fetch and display available Ollama models via POST /api/ai/ollama/models endpoint
- Skip API key requirement for Ollama in frontend and backend (litellm)
- Normalize base URL by stripping /v1 suffix for Ollama native API compatibility
- Parallelize cluster naming LLM calls with asyncio.gather for faster responses
@github-actions

github-actions Bot commented Mar 31, 2026

Copy link
Copy Markdown

Tests Report 📄

Tests Succees ✅

JUnit Details

Total Tests Failures Errors Skipped Time ⏳
281 0 0 0 71.83s

Coverage Details (100% >= 90%) ✅

Diff Cover Details
FileCovered LinesMissing Lines
embedding_cluster/ai_naming.py19/19100%
embedding_cluster/server/models.py15/15100%
embedding_cluster/server/routes/ai.py86/86100%
Total120/120100%

@aGallea aGallea merged commit dab125a into master Mar 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant