feat(01-01): implement LM Studio adapter with model discovery
Some checks failed
Discord Webhook / git (push) Has been cancelled

- Created LMStudioAdapter class using lmstudio-python SDK
- Added context manager get_client() for safe client handling
- Implemented list_available_models() with size estimation
- Added load_model(), unload_model(), get_model_info() methods
- Created mock_lmstudio.py for graceful fallback when lmstudio not installed
- Included error handling for LM Studio not running and model loading failures
- Implemented Pattern 1 from research: Model Client Factory
This commit is contained in:
Mai Development
2026-01-27 11:59:48 -05:00
parent de6058f109
commit f5ffb7255e
2 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
"""Mock lmstudio module for testing without dependencies."""
class Client:
"""Mock LM Studio client."""
def close(self):
pass
class llm:
"""Mock LLM interface."""
@staticmethod
def list_downloaded_models():
"""Return empty list for testing."""
return []
@staticmethod
def model(model_key):
"""Return mock model."""
return MockModel(model_key)
class MockModel:
"""Mock model for testing."""
def __init__(self, model_key):
self.model_key = model_key
self.display_name = model_key
self.context_length = 4096
def respond(self, prompt, max_tokens=100):
"""Return mock response."""
return "mock response"