HarperFast / HarperFast/harper

Auto-detect Ollama on localhost for zero-config local embedding dev

Open
#782 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Problem
A developer running harper-pro locally who wants to use `scope.models.embed()` currently has to:
1. Install ollama
2. Start it
3. Pull a model
4. Edit `harperdb-config.yaml` to set `models.embedding.defaultBackend: ollama` and `defaultHost: localhost:11434`
5. Restart harper

Step 4 is pure config friction — for the overwhelmingly common case (ollama on localhost:11434), it's mechanical and the user has no real choice to make.

## Proposal
If no embedding backend is explicitly configured, probe `http://localhost:11434/api/tags` once at startup. If it responds, auto-configure ollama as the default embedding backend and log:

```
Model backends: detected Ollama at localhost:11434 (models: nomic-embed-text, mxbai-embed-large)
using as default embedding backend. Override with hm.models.embedding.defaultBackend.
```

If the probe fails, leave embed unconfigured (current behaviour).

## Why this is the right place to put it
- Harper-Fabric hosts always have explicit `MODELS_EMBEDDING_DEFAULT_BACKEND` set by host-manager, so prod is unaffected.
- The probe is one `fetch()` at boot, behind a 500ms timeout — no hot-path cost.
- The behaviour matches what `harper dev` already does for other "find a reasonable default" cases.

## Out of scope
- Auto-pulling models that aren't already present (separate issue)
- Detecting vLLM / OpenAI / etc — those have credentials/config that aren't auto-discoverable

## Related
- PR #779 (Phase 1 model analytics emission)
- Local-embedding dev-story exploration (host-manager session)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.