feat: add lmstudio provider to setup wizard#77
Open
rakaarwaky wants to merge 1 commit into
Open
Conversation
LM Studio is a popular local LLM server (port 1234, OpenAI-compatible). It was previously only reachable via the 'Custom' provider, which has a history of producing malformed base_url values (e.g. 'http://localhost:1234/api/v1/') that double the /v1 segment and break LLMClient's request URL construction. This commit adds 'lmstudio' as a first-class entry in PROVIDER_DEFAULTS with the canonical base_url 'http://localhost:1234/v1', so the setup wizard (both CLI 'evonic setup' and the /api/setup web flow) surfaces it alongside ollama and llama.cpp. A regression test (unit_tests/test_setup_lmstudio_provider.py) pins the entry's shape and runs a live connection probe against a real LM Studio server, skipping gracefully when none is reachable so CI stays green in environments without LM Studio installed. No schema migration, no API changes, additive only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LM Studio is a popular local LLM server that runs an OpenAI-compatible API on
http://localhost:1234/v1. It was previously only reachable through the wizard's Custom provider, which has a documented history of producing malformedbase_urlvalues — typicallyhttp://127.0.0.1:1234/api/v1/— that double the/v1segment.backend.llm_client.LLMClientconstructs the request URL as{base_url}/v1/models(line 292), so a base URL ending in/api/v1/resolves to the non-existent…/api/v1/v1/modelsand the connection silently fails (the wizard'stest_connectionmasks this because it usesrstrip("/")rather thanrstrip("/v1"), so it still sees a 200 on a slightly-wrong path).This PR adds
lmstudioas a first-class entry inPROVIDER_DEFAULTSwith the canonical base URLhttp://localhost:1234/v1, so the setup wizard (both theevonic setupCLI and the/api/setupweb flow) surfaces it next toollamaandllama.cpp.Changes
backend/setup.py— addlmstudioentry toPROVIDER_DEFAULTS:type: localbase_url: http://localhost:1234/v1api_key_required: False(LM Studio's local server is unauthenticated by default)label: "LM Studio",description: "Local · no API key needed"placeholder_model: "lmstudio"(LM Studio has no fixed placeholder name; the wizard fetches the real list via/v1/modelson first save)unit_tests/test_setup_lmstudio_provider.py— new regression test that:test_connection()probe againstlocalhost:1234and skips gracefully if no LM Studio server is reachable, so CI stays green in environments without one installed.Testing
/home/raka/.evonic/venv/bin/python -m unittest unit_tests.test_setup_lmstudio_provider -v→ 6/6 pass (5 shape pins + 1 live probe against the running LM Studio on this host).mainby creating a model withbase_url: http://127.0.0.1:1234/api/v1/; confirmed that after the fix, users selecting the newLM Studioentry land on the correct…/v1path.Scope
2 files, 8 LOC of production code + a 175-LOC regression test. No schema migration, no API changes, additive only — the
Customprovider is untouched for users who still want to point at non-default LM Studio ports or remote instances.Notes for reviewer
/api/v1/path in the first place. A separate hardening — makingtest_connectionuserstrip("/v1")so it fails loudly on malformed URLs — is intentionally out of scope for this PR; happy to follow up if useful.placeholder_modelis"lmstudio"rather than a real LM Studio model name (e.g.qwen2.5-7b-instruct) because LM Studio's model identifiers are user-chosen and the wizard fetches the real list on save.