clean up code
This commit is contained in:
@@ -6,12 +6,21 @@ from typing import Dict, Optional, List
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class LLMClient:
|
||||
def __init__(self, endpoint: str = 'http://localhost:11434', model: str = 'llama3', use_local: bool = True):
|
||||
def __init__(self, endpoint: str = 'http://localhost:11434', model: str = 'llama3', use_local: bool = True, lm_studio_host: str = None):
|
||||
self.endpoint = endpoint
|
||||
self.model = model
|
||||
self.use_local = use_local
|
||||
self.lm_studio_endpoint = 'http://192.168.1.74:1234'
|
||||
self.lm_studio_model = 'openai/gpt-oss-20b'
|
||||
|
||||
self.lm_studio_endpoints = {
|
||||
'plato': {'url': 'http://192.168.1.74:1234', 'model': 'openai/gpt-oss-20b'},
|
||||
'postgres': {'url': 'http://192.168.1.159:1234', 'model': 'mistralai/devstral-small-2507'},
|
||||
'local': {'url': 'http://localhost:11434', 'model': 'llama3'}
|
||||
}
|
||||
|
||||
self.lm_studio_host = lm_studio_host or 'postgres'
|
||||
studio_config = self.lm_studio_endpoints.get(self.lm_studio_host, self.lm_studio_endpoints['postgres'])
|
||||
self.lm_studio_endpoint = studio_config['url']
|
||||
self.lm_studio_model = studio_config['model']
|
||||
|
||||
def summarize(self, text: str, max_length: int = 200) -> Dict:
|
||||
prompt = f"Summarize this concisely in under {max_length} characters:\n\n{text[:3000]}"
|
||||
|
||||
Reference in New Issue
Block a user