Skip to content

feat: AI cluster naming with LiteLLM multi-provider support#34

Merged
aGallea merged 6 commits into
masterfrom
feat/ai-cluster-naming
Mar 31, 2026
Merged

feat: AI cluster naming with LiteLLM multi-provider support#34
aGallea merged 6 commits into
masterfrom
feat/ai-cluster-naming

Conversation

@aGallea

@aGallea aGallea commented Mar 30, 2026

Copy link
Copy Markdown
Owner

Summary

Replace the old GPT-specific cluster naming with a provider-agnostic AI naming system powered by LiteLLM (100+ LLM providers).

  • LiteLLM integration: Replaced openai dependency with litellm for universal LLM access (OpenAI, Anthropic, Gemini, Ollama, etc.)
  • Settings page: New /settings route for configuring AI provider, model, API key, base URL, and temperature. Settings stored in browser localStorage; API key sent per-request (never persisted server-side)
  • On-demand top-level naming: "Name with AI" button in the cluster legend calls /api/ai/name-clusters and saves results as annotations
  • Automatic sub-cluster naming: Sub-clusters are automatically named via AI when computed, with parent cluster name as context in the prompt
  • Backend endpoints: Three new API routes (/api/ai/name-clusters, /api/ai/name-sub-clusters, /api/ai/test-connection) with full test coverage

Changes

Backend (Python)

  • Replace openai with litellm in pyproject.toml
  • Remove GPT fields from Settings, PlotRequest, and scatter plot code
  • New ai_naming.py module with get_cluster_name(), get_sub_cluster_name(), test_connection()
  • New routes/ai.py with three endpoints and sample-based item extraction
  • Add AI Pydantic models to models.py
  • 9 tests for ai_naming, 12 tests for AI routes (265 total, all passing, 97%+ coverage)

Frontend (TypeScript/React)

  • New SettingsPage.tsx with full AI configuration form and connection test
  • New api/ai.ts with localStorage management and API client functions
  • "Name with AI" button in ClusterLegend.tsx for top-level clusters
  • Auto-naming integration in ClusterDetailDrawer.tsx for sub-clusters
  • plotStore.ts additions: isNamingClusters, isNamingSubClusters, updateSubClusterNames
  • Removed all GPT-specific UI from PlotControls.tsx
  • Updated types in types/index.ts

Verification

  • TypeScript: npx tsc --noEmit clean
  • Backend: 265 tests passing, mypy strict clean on all 21 source files
  • Pre-commit hooks: All passing

@github-actions

github-actions Bot commented Mar 30, 2026

Copy link
Copy Markdown

Tests Report 📄

Tests Succees ✅

JUnit Details

Total Tests Failures Errors Skipped Time ⏳
265 0 0 0 64.09s

Coverage Details (100% >= 90%) ✅

Diff Cover Details
FileCovered LinesMissing Lines
embedding_cluster/ai_naming.py111/111100%
embedding_cluster/scatter_plot.py4/4100%
embedding_cluster/server/app.py2/2100%
embedding_cluster/server/models.py36/36100%
embedding_cluster/server/routes/ai.py159/16099%98
Total312/313100%

@aGallea aGallea merged commit 6f818f4 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