From a0928ae590d83103d091396388b30d308bf84172 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 4 Apr 2024 18:47:31 -0400 Subject: [PATCH] Updating MakeFile and fixing monologue memory parameter issue (#692) * Updating memory for monologue agent to fix base_url being used with OpenAIEmbedding by accident, added default text-embedding-ada-002 to monologue agent memory for OpenAIEmbeddings, added more enviroment variable configurations to setup-config in make file * adding indent --- Makefile | 15 +++++++++++++++ agenthub/monologue_agent/utils/memory.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b2942f34c..958ee8bdac 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,21 @@ setup-config: @read -p "Enter your LLM API key: " llm_api_key; \ echo "LLM_API_KEY=\"$$llm_api_key\"" >> $(CONFIG_FILE).tmp + @echo "Enter your LLM Embedding Model\nChoices are openai, azureopenai, llama2 or leave blank to default to 'BAAI/bge-small-en-v1.5' via huggingface"; \ + read -p "> " llm_embedding_model; \ + echo "LLM_EMBEDDING_MODEL=\"$$llm_embedding_model\"" >> $(CONFIG_FILE).tmp; \ + if [ "$$llm_embedding_model" = "llama2" ]; then \ + read -p "Enter the local model URL: " llm_base_url; \ + echo "LLM_BASE_URL=\"$$llm_base_url\"" >> $(CONFIG_FILE).tmp; \ + elif [ "$$llm_embedding_model" = "azureopenai" ]; then \ + read -p "Enter the Azure endpoint URL: " llm_base_url; \ + echo "LLM_BASE_URL=\"$$llm_base_url\"" >> $(CONFIG_FILE).tmp; \ + read -p "Enter the Azure LLM Deployment Name: " llm_deployment_name; \ + echo "LLM_DEPLOYMENT_NAME=\"$$llm_deployment_name\"" >> $(CONFIG_FILE).tmp; \ + read -p "Enter the Azure API Version: " llm_api_version; \ + echo "LLM_API_VERSION=\"$$llm_api_version\"" >> $(CONFIG_FILE).tmp; \ + fi + @read -p "Enter your workspace directory [default: $(DEFAULT_WORKSPACE_DIR)]: " workspace_dir; \ workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \ echo "WORKSPACE_DIR=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp diff --git a/agenthub/monologue_agent/utils/memory.py b/agenthub/monologue_agent/utils/memory.py index e2c2f28f58..50e76946d4 100644 --- a/agenthub/monologue_agent/utils/memory.py +++ b/agenthub/monologue_agent/utils/memory.py @@ -21,7 +21,7 @@ if embedding_strategy == "llama2": elif embedding_strategy == "openai": from llama_index.embeddings.openai import OpenAIEmbedding embed_model = OpenAIEmbedding( - base_url=config.get_or_error("LLM_BASE_URL"), + model="text-embedding-ada-002" ) elif embedding_strategy == "azureopenai": from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding # Need to instruct to set these env variables in documentation