feat: add Ollama, Azure OpenAI, and generic OpenAI-compatible providers#179
feat: add Ollama, Azure OpenAI, and generic OpenAI-compatible providers#179mimran-khan wants to merge 1 commit into
Conversation
Ollama provider enables free local/offline LLM scanning via Ollama's OpenAI-compatible API at localhost:11434. No API key required. Azure OpenAI provider supports enterprise deployments using AzureChatOpenAI with deployment-based routing and api-version handling. Generic OpenAI-compatible provider serves Groq, Together AI, Mistral, DeepInfra, and other endpoints with dedicated env vars (SKILLSPECTOR_COMPAT_API_KEY/BASE_URL) and a bundled multi-provider model registry. Each provider ships its own model_registry.yaml for accurate token budgeting. Closes NVIDIA#173, closes NVIDIA#174, closes NVIDIA#175
rng1995
left a comment
There was a problem hiding this comment.
[Automated SkillSpector Review]
Approved.
Three providers (Ollama, Azure OpenAI, generic OpenAI-compatible) following the established provider pattern. Credential resolution fails closed (Azure and the generic provider return None unless both env vars are set; Ollama supplies the required placeholder key), the Azure key is wrapped in SecretStr, and each ships a bundled model_registry.yaml. 35 tests cover credentials (positive/negative), chat-model creation, metadata, selection, and the updated error message.
Security: the configurable base URLs (OLLAMA_BASE_URL, SKILLSPECTOR_COMPAT_BASE_URL, AZURE_OPENAI_ENDPOINT) are operator-set env vars — the same trust surface as the existing OPENAI_BASE_URL — so no new attacker-controlled SSRF vector from scanned content. Non-blocking: could validate that the base URL is a well-formed http(s) URL to fail earlier on misconfiguration.
Summary
Add three new LLM providers to expand SkillSpector beyond cloud-only OpenAI/Anthropic/NVIDIA endpoints:
SKILLSPECTOR_PROVIDER=ollama) — free local/offline scanning via Ollama's OpenAI-compatible API. No API key required. Supports remote instances viaOLLAMA_BASE_URL.SKILLSPECTOR_PROVIDER=azure_openai) — enterprise Azure-hosted deployments usingAzureChatOpenAIwith deployment-based routing,api-versionhandling, and dedicated env vars (AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_API_KEY,AZURE_OPENAI_DEPLOYMENT).SKILLSPECTOR_PROVIDER=openai_compatible) — Groq, Together AI, Mistral, DeepInfra, Fireworks, and any OpenAI-compatible endpoint viaSKILLSPECTOR_COMPAT_API_KEY+SKILLSPECTOR_COMPAT_BASE_URL.Each provider ships its own
model_registry.yamlfor accurate token budgeting.Changes
src/skillspector/providers/ollama/— provider, model registry,__init__src/skillspector/providers/azure_openai/— provider, model registry,__init__src/skillspector/providers/openai_compatible/— provider, model registry,__init__src/skillspector/providers/__init__.py— register new providers in selector, update error message to mentionollamatests/unit/test_new_providers.py— 35 tests covering credentials, chat model creation, metadata, selection, and error messagesCloses #173, closes #174, closes #175
Test plan
pytest tests/unit/test_new_providers.py -v)OLLAMA_BASE_URLAZURE_OPENAI_API_KEYandAZURE_OPENAI_ENDPOINTAZURE_OPENAI_DEPLOYMENTunset2024-06-01SKILLSPECTOR_COMPAT_API_KEYandSKILLSPECTOR_COMPAT_BASE_URL