Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of BACKEND_TYPE #539

Merged
merged 9 commits into from
Nov 30, 2023
3 changes: 0 additions & 3 deletions memgpt/cli/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ def configure_llm_endpoint(config: MemGPTConfig):
if config.model_endpoint_type in backend_options:
# set from previous config
default_model_endpoint_type = config.model_endpoint_type
if os.getenv("BACKEND_TYPE") and os.getenv("BACKEND_TYPE") in backend_options:
# set form env variable (ok if none)
default_model_endpoint_type = os.getenv("BACKEND_TYPE")
model_endpoint_type = questionary.select(
"Select LLM backend (select 'openai' if you have an OpenAI compatible proxy):",
backend_options,
Expand Down
7 changes: 1 addition & 6 deletions memgpt/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,9 @@ def embedding_model():
return embed_model
else:
# default to hugging face model running local
# warning: this is a terrible model
sarahwooders marked this conversation as resolved.
Show resolved Hide resolved
from llama_index.embeddings import HuggingFaceEmbedding

os.environ["TOKENIZERS_PARALLELISM"] = "False"
model = "BAAI/bge-small-en-v1.5"
return HuggingFaceEmbedding(model_name=model)

# TODO: add back if we decide to support custom embedding endpoints
# else:
# # use env variable OPENAI_API_BASE
# model = OpenAIEmbedding()
# return model
4 changes: 1 addition & 3 deletions memgpt/local_llm/chat_completion_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
from memgpt.prompts.gpt_summarize import SYSTEM as SUMMARIZE_SYSTEM_MESSAGE
from memgpt.errors import LocalLLMConnectionError, LocalLLMError

endpoint = os.getenv("OPENAI_API_BASE")
endpoint_type = os.getenv("BACKEND_TYPE") # default None == ChatCompletion
DEBUG = False
# DEBUG = True

Expand Down Expand Up @@ -103,7 +101,7 @@ def get_chat_completion(
result = get_vllm_completion(endpoint, model, prompt, context_window, user)
else:
raise LocalLLMError(
f"BACKEND_TYPE is not set, please set variable depending on your backend (webui, lmstudio, llamacpp, koboldcpp)"
f"Invalid endpoint type {endpoint_type}, please set variable depending on your backend (webui, lmstudio, llamacpp, koboldcpp)"
)
except requests.exceptions.ConnectionError as e:
raise LocalLLMConnectionError(f"Unable to connect to endpoint {endpoint}")
Expand Down
4 changes: 0 additions & 4 deletions memgpt/openai_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

from memgpt.local_llm.chat_completion_proxy import get_chat_completion

HOST = os.getenv("OPENAI_API_BASE")
HOST_TYPE = os.getenv("BACKEND_TYPE") # default None == ChatCompletion
R = TypeVar("R")


def is_context_overflow_error(exception):
from memgpt.utils import printd
Expand Down
Loading