Ändrat namn på metoder, *models > *endpoints

This commit is contained in:
Joakim Persson
2024-08-02 23:05:49 +02:00
parent a72a46d777
commit 3659308675
+11 -11
View File
@@ -27,8 +27,8 @@ class GlobalState:
cls._instance.llm = "phi3:mini" # Default LLM for queries. TODO: Check with ollama server that it actually exists
# cls._instance.backend_api_ep = "http://localhost:5005/api/chat" # Default backend API endpoint
# Try making things more aligned with the outline of the yaml file
cls._instance.backend = dict() # Holds info on which server the clients connect to
cls._instance.models = [] # A list that holds info on which models are available for use (server url, model name, provider et cetera)
cls._instance.backend = dict() # A dictionary that holds info on which server the clients connect to
cls._instance.endpoints = [] # A list that holds info on which endpoints are available for use (server url, model name, provider et cetera)
# logging - already done in __new__, perhaps change layout later
return cls._instance
@@ -82,13 +82,13 @@ class GlobalState:
"""Getter for backend API endpoint"""
return self.backend["url"]+self.backend["api"]
def set_models(self, models=None):
"""Set the list of models."""
if models is not None:
if not isinstance(models, list):
raise ValueError("Models must be a list, even if there is just one model")
self.models = models
def set_endpoints(self, endpoints=None):
"""Set the list of endpoints."""
if endpoints is not None:
if not isinstance(endpoints, list):
raise ValueError("Endpoints must be a list, even if there is just one model")
self.endpoints = endpoints
def get_models(self):
"""Return the list of models"""
return self.models
def get_endpoints(self):
"""Return the list of endpoints"""
return self.endpoints