feat(llm, ui): Add native keyless Local LLM model support (Ollama, vLLM, LM Studio, LocalAI) and Office UI Settings - #30
Open
AhmadHassan-BTed wants to merge 8 commits into
Open
Conversation
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.
Overview
This PR adds support for using local/self-hosted LLM providers with OpenOPC without requiring a remote API key.
Supported local providers include Ollama, vLLM, LM Studio, LocalAI, Llama.cpp, and TGI. It also adds an LLM settings modal to the Office UI so the provider, model, API base, and API key can be configured directly from the UI.
The existing cloud providers are still supported.
Changes
1. Local LLM provider support
Updated
opc/llm/provider.pyto handle local/self-hosted providers.has_credentials()now considers supported local providers valid without requiring an API key.Added automatic
api_basedefaults for local providers when no endpoint is configured:ollama/→http://localhost:11434vllm/→http://localhost:8000/v1localai/→http://localhost:8080/v1lmstudio/→http://localhost:1234/v1Added the
api_key = "local"fallback for keyless OpenAI-compatible local endpoints. This prevents the underlying client from failing because of a missing API key/header.Updated
get_capabilities()to expose local provider information, includingis_localand the provider family.2. Office UI LLM settings
Added
LLMModelSettingsModal.tsxand integrated it intoApp.tsx.The Office UI now has an LLM settings button in the top navigation header.
The provider selector includes:
The settings UI also handles local and cloud providers differently:
Local provider endpoints are pre-filled with their default
api_base.API keys are optional for local providers.
API keys remain required for providers that need them.
A local-mode indicator is shown when a keyless local provider is selected.
Added quick-select model options for commonly used local models, including:
ollama/llama3.3vllm/meta-llama-3.1-8b-instructlmstudio/deepseek-r1-distill-qwen-14b3. LLM configuration schema
Updated
opc/core/config.pyand extendedLLMConfigwith:This allows the configuration to keep track of the selected provider and whether it is running in local mode.
4. Tests
Added:
The new tests cover the local provider handling and keyless configuration behavior.
Also verified the existing LLM and CLI-related tests.
5. Documentation
Added:
and updated:
to document the local model setup and supported providers.
Verification
Ran the backend test suite with:
Result:
115/115 tests passed
Ran the TypeScript check in the Office UI frontend:
Result:
0 errors
Also rebuilt the Office UI production bundle:
The Vite production build completed successfully and updated:
Upstream sync
Before pushing the final changes, I fetched and merged the latest
upstream/mainchanges.The merge introduced a conflict in the frontend bundle, which was resolved and rebuilt.
The merged changes were committed and pushed to
origin/main.I also removed the
openopc-shadow-adapterdirectory reference from the core git index and pushed that fix.The branch is now up to date with
upstream/mainand has no remaining merge conflicts.