From bb6a85c8a342a8cb825caf72cb205af2690f2113 Mon Sep 17 00:00:00 2001 From: Jason Schleifer Date: Sat, 3 Aug 2024 20:19:15 -0700 Subject: [PATCH] removed unused functions --- nodes/utilities.py | 58 ---------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/nodes/utilities.py b/nodes/utilities.py index 7685c4d..9be3dd9 100644 --- a/nodes/utilities.py +++ b/nodes/utilities.py @@ -50,64 +50,6 @@ def get_models(engine, base_url, port) -> list[str]: return [] -def get_lmstudio_models(port="1234") -> list[str]: - url = f"http://127.0.0.1:{port}/v1/models" - - try: - # Make the GET request - response = requests.get(url) - - # Check if the request was successful - if response.status_code != 200: - raise Exception(f"Failed to fetch models: {response.status_code}") - - # Parse the JSON response - models_info = response.json() - - # Extract the model names - models = [model["id"] for model in models_info["data"]] - - return models - except ( - requests.exceptions.ConnectionError, - requests.exceptions.HTTPError, - requests.exceptions.RequestException, - KeyError, - ): - # Return an empty list if there is any error - return [] - - -def get_ollama_models() -> list[str]: - # URL to fetch the local models - url = "http://127.0.0.1:11434/api/tags" - - try: - # Make the GET request - response = requests.get(url) - - # Check if the request was successful - if response.status_code != 200: - raise Exception(f"Failed to fetch models: {response.status_code}") - - # Parse the JSON response - models_info = response.json() - - # Extract the model names - # models = [model["name"].split(":")[0] for model in models_info["models"]] - models = [model["name"] for model in models_info["models"]] - - return models - except ( - requests.exceptions.ConnectionError, - requests.exceptions.HTTPError, - requests.exceptions.RequestException, - KeyError, - ): - # Return an empty list if there is any error - return [] - - def get_prompt_text(string_prompt, input_string): template = Template(string_prompt) return template.render(input_string=input_string)