Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: patch vllm/local endpoint model GET bug (#1179)
Charles Packeracbdd4c0e56b
diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.pyindex 0412c6387..bbdaa4317 100644--- a/memgpt/cli/cli_config.py+++ b/memgpt/cli/cli_config.py@@ -224,7 +224,7 @@ def get_model_options(else:# Attempt to do OpenAI endpoint style model fetching# TODO support local auth- fetched_model_options_response = openai_get_model_list(url=model_endpoint, api_key=None)+ fetched_model_options_response = openai_get_model_list(url=model_endpoint, api_key=None, fix_url=True)model_options = [obj["id"] for obj in fetched_model_options_response["data"]]# NOTE no filtering of local model optionsdiff --git a/memgpt/llm_api_tools.py b/memgpt/llm_api_tools.pyindex d5a53aa82..dbfe81dce 100644--- a/memgpt/llm_api_tools.py+++ b/memgpt/llm_api_tools.py@@ -2,7 +2,7 @@ import randomimport timeimport requestsimport time-from typing import Union+from typing import Union, Optionalimport urllibfrom memgpt.credentials import MemGPTCredentials@@ -81,10 +81,17 @@ def clean_azure_endpoint(raw_endpoint_name):return endpoint_address-def openai_get_model_list(url: str, api_key: Union[str, None]) -> dict:+def openai_get_model_list(url: str, api_key: Union[str, None], fix_url: Optional[bool] = False) -> dict:"""https://platform.openai.com/docs/api-reference/models/list"""from memgpt.utils import printd+ # In some cases we may want to double-check the URL and do basic correction, eg:+ # In MemGPT config the address for vLLM is w/o a /v1 suffix for simplicity+ # However if we're treating the server as an OpenAI proxy we want the /v1 suffix on our model hit+ if fix_url:+ if not url.endswith("/v1"):+ url = smart_urljoin(url, "v1")+url = smart_urljoin(url, "models")headers = {"Content-Type": "application/json"}