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
35 lines
769 B
Python
35 lines
769 B
Python
"""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"
|