From 688f24db214e1c94c40f84dbdd17ebe4d8ca6a98 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Mon, 23 Oct 2023 16:34:44 +0000 Subject: [PATCH] api_base -> base_url --- OAI_CONFIG_LIST_sample | 4 +-- autogen/oai/completion.py | 6 ++--- autogen/oai/openai_utils.py | 26 +++++++++---------- notebook/agentchat_MathChat.ipynb | 4 +-- notebook/agentchat_RetrieveChat.ipynb | 4 +-- ...at_auto_feedback_from_code_execution.ipynb | 4 +-- notebook/agentchat_chess.ipynb | 6 ++--- notebook/agentchat_groupchat.ipynb | 4 +-- notebook/agentchat_groupchat_RAG.ipynb | 3 +-- notebook/agentchat_groupchat_research.ipynb | 4 +-- notebook/agentchat_groupchat_vis.ipynb | 4 +-- notebook/agentchat_human_feedback.ipynb | 8 +++--- notebook/agentchat_planning.ipynb | 4 +-- notebook/agentchat_stream.ipynb | 8 +++--- notebook/agentchat_teachability.ipynb | 4 +-- notebook/agentchat_teaching.ipynb | 4 +-- notebook/agentchat_two_users.ipynb | 4 +-- notebook/agentchat_web_info.ipynb | 4 +-- notebook/oai_chatgpt_gpt4.ipynb | 4 +-- notebook/oai_completion.ipynb | 8 +++--- notebook/oai_openai_utils.ipynb | 8 +++--- setup.py | 2 +- test/oai/test_utils.py | 2 +- website/blog/2023-07-14-Local-LLMs/index.mdx | 8 +++--- website/docs/FAQ.md | 4 +-- website/docs/Use-Cases/enhanced_inference.md | 6 ++--- 26 files changed, 73 insertions(+), 74 deletions(-) diff --git a/OAI_CONFIG_LIST_sample b/OAI_CONFIG_LIST_sample index 01608aeeef8e..c30719211183 100644 --- a/OAI_CONFIG_LIST_sample +++ b/OAI_CONFIG_LIST_sample @@ -7,14 +7,14 @@ { "model": "gpt-4", "api_key": "", - "api_base": "", + "base_url": "", "api_type": "azure", "api_version": "2023-07-01-preview" }, { "model": "gpt-3.5-turbo", "api_key": "", - "api_base": "", + "base_url": "", "api_type": "azure", "api_version": "2023-07-01-preview" } diff --git a/autogen/oai/completion.py b/autogen/oai/completion.py index a720ccc24466..a23352b982fb 100644 --- a/autogen/oai/completion.py +++ b/autogen/oai/completion.py @@ -735,18 +735,18 @@ def create( "model": "gpt-4", "api_key": os.environ.get("AZURE_OPENAI_API_KEY"), "api_type": "azure", - "api_base": os.environ.get("AZURE_OPENAI_API_BASE"), + "base_url": os.environ.get("AZURE_OPENAI_API_BASE"), "api_version": "2023-03-15-preview", }, { "model": "gpt-3.5-turbo", "api_key": os.environ.get("OPENAI_API_KEY"), "api_type": "open_ai", - "api_base": "https://api.openai.com/v1", + "base_url": "https://api.openai.com/v1", }, { "model": "llama-7B", - "api_base": "http://127.0.0.1:8080", + "base_url": "http://127.0.0.1:8080", "api_type": "open_ai", } ], diff --git a/autogen/oai/openai_utils.py b/autogen/oai/openai_utils.py index cbae458c59ca..61dd330169c7 100644 --- a/autogen/oai/openai_utils.py +++ b/autogen/oai/openai_utils.py @@ -7,7 +7,7 @@ from dotenv import find_dotenv, load_dotenv -NON_CACHE_KEY = ["api_key", "api_base", "api_type", "api_version"] +NON_CACHE_KEY = ["api_key", "base_url", "api_type", "api_version"] def get_key(config): @@ -33,13 +33,13 @@ def get_key(config): def get_config_list( - api_keys: List, api_bases: Optional[List] = None, api_type: Optional[str] = None, api_version: Optional[str] = None + api_keys: List, base_urls: Optional[List] = None, api_type: Optional[str] = None, api_version: Optional[str] = None ) -> List[Dict]: """Get a list of configs for openai api calls. Args: api_keys (list): The api keys for openai api calls. - api_bases (list, optional): The api bases for openai api calls. + base_urls (list, optional): The api bases for openai api calls. api_type (str, optional): The api type for openai api calls. api_version (str, optional): The api version for openai api calls. """ @@ -48,8 +48,8 @@ def get_config_list( if not api_key.strip(): continue config = {"api_key": api_key} - if api_bases: - config["api_base"] = api_bases[i] + if base_urls: + config["base_url"] = base_urls[i] if api_type: config["api_type"] = api_type if api_version: @@ -109,7 +109,7 @@ def config_list_openai_aoai( # Assuming Azure OpenAI api keys in os.environ["AZURE_OPENAI_API_KEY"], in separated lines api_keys=os.environ.get("AZURE_OPENAI_API_KEY", "").split("\n"), # Assuming Azure OpenAI api bases in os.environ["AZURE_OPENAI_API_BASE"], in separated lines - api_bases=os.environ.get("AZURE_OPENAI_API_BASE", "").split("\n"), + base_urls=os.environ.get("AZURE_OPENAI_API_BASE", "").split("\n"), api_type="azure", api_version="2023-07-01-preview", # change if necessary ) @@ -121,7 +121,7 @@ def config_list_openai_aoai( # Assuming OpenAI API_KEY in os.environ["OPENAI_API_KEY"] api_keys=os.environ.get("OPENAI_API_KEY", "").split("\n"), # "api_type": "open_ai", - # "api_base": "https://api.openai.com/v1", + # "base_url": "https://api.openai.com/v1", ) if exclude != "openai" else [] @@ -248,7 +248,7 @@ def config_list_from_json( def get_config( - api_key: str, api_base: Optional[str] = None, api_type: Optional[str] = None, api_version: Optional[str] = None + api_key: str, base_url: Optional[str] = None, api_type: Optional[str] = None, api_version: Optional[str] = None ) -> Dict: """ Construct a configuration dictionary with the provided API configurations. @@ -261,12 +261,12 @@ def get_config( "api_key_env_var": "ANOTHER_API_KEY", "api_type": "aoai", "api_version": "v2", - "api_base": "https://api.someotherapi.com" + "base_url": "https://api.someotherapi.com" } } Args: api_key (str): The API key used for authenticating API requests. - api_base (str, optional): The base URL of the API. Defaults to None. + base_url (str, optional): The base URL of the API. Defaults to None. api_type (str, optional): The type or kind of API. Defaults to None. api_version (str, optional): The API version. Defaults to None. @@ -274,8 +274,8 @@ def get_config( Dict: A dictionary containing the API configurations. """ config = {"api_key": api_key} - if api_base: - config["api_base"] = api_base + if base_url: + config["base_url"] = base_url if api_type: config["api_type"] = api_type if api_version: @@ -302,7 +302,7 @@ def config_list_from_dotenv( If a string is provided as configuration, it is considered as an environment variable name storing the API key. If a dict is provided, it should contain at least 'api_key_env_var' key, - and optionally other API configurations like 'api_base', 'api_type', and 'api_version'. + and optionally other API configurations like 'base_url', 'api_type', and 'api_version'. Defaults to a basic map with 'gpt-4' and 'gpt-3.5-turbo' mapped to 'OPENAI_API_KEY'. filter_dict (dict, optional): A dictionary containing the models to be loaded. Containing a 'model' key mapped to a set of model names to be loaded. diff --git a/notebook/agentchat_MathChat.ipynb b/notebook/agentchat_MathChat.ipynb index 9dd90fb0635e..9245252ae0c5 100644 --- a/notebook/agentchat_MathChat.ipynb +++ b/notebook/agentchat_MathChat.ipynb @@ -91,14 +91,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_RetrieveChat.ipynb b/notebook/agentchat_RetrieveChat.ipynb index bfdb43b9d509..a0a8ff5d8e4c 100644 --- a/notebook/agentchat_RetrieveChat.ipynb +++ b/notebook/agentchat_RetrieveChat.ipynb @@ -117,14 +117,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_auto_feedback_from_code_execution.ipynb b/notebook/agentchat_auto_feedback_from_code_execution.ipynb index 564c7e2c8db8..f3c027855bb5 100644 --- a/notebook/agentchat_auto_feedback_from_code_execution.ipynb +++ b/notebook/agentchat_auto_feedback_from_code_execution.ipynb @@ -91,14 +91,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_chess.ipynb b/notebook/agentchat_chess.ipynb index a06265d21bf9..68ab8063fe5c 100644 --- a/notebook/agentchat_chess.ipynb +++ b/notebook/agentchat_chess.ipynb @@ -105,14 +105,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", @@ -1010,7 +1010,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.17" + "version": "3.11.4" }, "orig_nbformat": 4 }, diff --git a/notebook/agentchat_groupchat.ipynb b/notebook/agentchat_groupchat.ipynb index ac3a74fca595..22e9067f384c 100644 --- a/notebook/agentchat_groupchat.ipynb +++ b/notebook/agentchat_groupchat.ipynb @@ -93,14 +93,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_groupchat_RAG.ipynb b/notebook/agentchat_groupchat_RAG.ipynb index fd12cbe8c9b6..654469dcc3ab 100644 --- a/notebook/agentchat_groupchat_RAG.ipynb +++ b/notebook/agentchat_groupchat_RAG.ipynb @@ -88,9 +88,8 @@ " \"api_key\": \"\",\n", " }, # OpenAI API endpoint for gpt-4\n", " {\n", - " \"engine\": \"gpt-35-turbo-0631\", \n", " \"model\": \"gpt-35-turbo-0631\", # 0631 or newer is needed to use functions\n", - " \"api_base\": \"\", \n", + " \"base_url\": \"\", \n", " \"api_type\": \"azure\", \n", " \"api_version\": \"2023-07-01-preview\", # 2023-07-01-preview or newer is needed to use functions\n", " \"api_key\": \"\"\n", diff --git a/notebook/agentchat_groupchat_research.ipynb b/notebook/agentchat_groupchat_research.ipynb index 9d9c2c3dc3f6..d7b562e3d743 100644 --- a/notebook/agentchat_groupchat_research.ipynb +++ b/notebook/agentchat_groupchat_research.ipynb @@ -79,14 +79,14 @@ " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k-0314',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_groupchat_vis.ipynb b/notebook/agentchat_groupchat_vis.ipynb index c780a588a6bb..b4f492aa1748 100644 --- a/notebook/agentchat_groupchat_vis.ipynb +++ b/notebook/agentchat_groupchat_vis.ipynb @@ -91,14 +91,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_human_feedback.ipynb b/notebook/agentchat_human_feedback.ipynb index 0119fb48f472..ae5c0ea07b27 100644 --- a/notebook/agentchat_human_feedback.ipynb +++ b/notebook/agentchat_human_feedback.ipynb @@ -86,14 +86,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-4\n", " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # another Azure OpenAI API endpoint for gpt-4\n", @@ -104,14 +104,14 @@ " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-3.5-turbo\n", " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # another Azure OpenAI API endpoint for gpt-3.5-turbo\n", diff --git a/notebook/agentchat_planning.ipynb b/notebook/agentchat_planning.ipynb index b0fa24425b3d..042fb7c6dfd4 100644 --- a/notebook/agentchat_planning.ipynb +++ b/notebook/agentchat_planning.ipynb @@ -95,14 +95,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-07-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-4\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-07-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-4-32k\n", diff --git a/notebook/agentchat_stream.ipynb b/notebook/agentchat_stream.ipynb index cfce4de54f9d..3851df9d7d58 100644 --- a/notebook/agentchat_stream.ipynb +++ b/notebook/agentchat_stream.ipynb @@ -86,14 +86,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-4\n", " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # another Azure OpenAI API endpoint for gpt-4\n", @@ -104,14 +104,14 @@ " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # Azure OpenAI API endpoint for gpt-3.5-turbo\n", " {\n", " 'model': 'gpt-3.5-turbo',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # another Azure OpenAI API endpoint for gpt-3.5-turbo\n", diff --git a/notebook/agentchat_teachability.ipynb b/notebook/agentchat_teachability.ipynb index 54f73fbcb833..10f836e0871b 100644 --- a/notebook/agentchat_teachability.ipynb +++ b/notebook/agentchat_teachability.ipynb @@ -95,14 +95,14 @@ " {\n", " 'model': 'gpt-4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/agentchat_teaching.ipynb b/notebook/agentchat_teaching.ipynb index 0910aefa3e1a..f7301676e44e 100644 --- a/notebook/agentchat_teaching.ipynb +++ b/notebook/agentchat_teaching.ipynb @@ -58,14 +58,14 @@ " {\n", " \"model\": \"gpt-4\",\n", " \"api_key\": \"\",\n", - " \"api_base\": \"\",\n", + " \"base_url\": \"\",\n", " \"api_type\": \"azure\",\n", " \"api_version\": \"2023-06-01-preview\"\n", " },\n", " {\n", " \"model\": \"gpt-4-32k\",\n", " \"api_key\": \"\",\n", - " \"api_base\": \"\",\n", + " \"base_url\": \"\",\n", " \"api_type\": \"azure\",\n", " \"api_version\": \"2023-06-01-preview\"\n", " }\n", diff --git a/notebook/agentchat_two_users.ipynb b/notebook/agentchat_two_users.ipynb index 22cb38db8ef0..ff0d08d16cc2 100644 --- a/notebook/agentchat_two_users.ipynb +++ b/notebook/agentchat_two_users.ipynb @@ -68,14 +68,14 @@ " {\n", " \"model\": \"gpt-4\",\n", " \"api_key\": \"\",\n", - " \"api_base\": \"\",\n", + " \"base_url\": \"\",\n", " \"api_type\": \"azure\",\n", " \"api_version\": \"2023-07-01-preview\"\n", " },\n", " {\n", " \"model\": \"gpt-4-32k\",\n", " \"api_key\": \"\",\n", - " \"api_base\": \"\",\n", + " \"base_url\": \"\",\n", " \"api_type\": \"azure\",\n", " \"api_version\": \"2023-07-01-preview\"\n", " }\n", diff --git a/notebook/agentchat_web_info.ipynb b/notebook/agentchat_web_info.ipynb index 6f202b19d2e7..9229365a40d1 100644 --- a/notebook/agentchat_web_info.ipynb +++ b/notebook/agentchat_web_info.ipynb @@ -102,14 +102,14 @@ " {\n", " 'model': 'gpt4',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", " {\n", " 'model': 'gpt-4-32k-0314',\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " },\n", diff --git a/notebook/oai_chatgpt_gpt4.ipynb b/notebook/oai_chatgpt_gpt4.ipynb index 9f273db8b5cd..ba787af4cdb2 100644 --- a/notebook/oai_chatgpt_gpt4.ipynb +++ b/notebook/oai_chatgpt_gpt4.ipynb @@ -124,13 +124,13 @@ " {'api_key': ''}, # only if OpenAI API key is found\n", " {\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # only if the at least one Azure OpenAI API key is found\n", " {\n", " 'api_key': '',\n", - " 'api_base': '',\n", + " 'base_url': '',\n", " 'api_type': 'azure',\n", " 'api_version': '2023-06-01-preview',\n", " }, # only if the second Azure OpenAI API key is found\n", diff --git a/notebook/oai_completion.ipynb b/notebook/oai_completion.ipynb index 1d93140a561d..f25db693fb81 100644 --- a/notebook/oai_completion.ipynb +++ b/notebook/oai_completion.ipynb @@ -91,13 +91,13 @@ "# }, # OpenAI API endpoint for gpt-4\n", "# {\n", "# 'api_key': '',\n", - "# 'api_base': '',\n", + "# 'base_url': '',\n", "# 'api_type': 'azure',\n", "# 'api_version': '2023-03-15-preview',\n", "# }, # Azure OpenAI API endpoint for gpt-4\n", "# {\n", "# 'api_key': '',\n", - "# 'api_base': '',\n", + "# 'base_url': '',\n", "# 'api_type': 'azure',\n", "# 'api_version': '2023-03-15-preview',\n", "# }, # another Azure OpenAI API endpoint for gpt-4\n", @@ -125,14 +125,14 @@ "# {\n", "# 'model': 'gpt-3.5-turbo',\n", "# 'api_key': '',\n", - "# 'api_base': '',\n", + "# 'base_url': '',\n", "# 'api_type': 'azure',\n", "# 'api_version': '2023-06-01-preview',\n", "# }, # Azure OpenAI API endpoint for gpt-3.5-turbo\n", "# {\n", "# 'model': 'gpt-35-turbo-v0301',\n", "# 'api_key': '',\n", - "# 'api_base': '',\n", + "# 'base_url': '',\n", "# 'api_type': 'azure',\n", "# 'api_version': '2023-06-01-preview',\n", "# }, # another Azure OpenAI API endpoint for gpt-3.5-turbo with deployment name gpt-35-turbo-v0301\n", diff --git a/notebook/oai_openai_utils.ipynb b/notebook/oai_openai_utils.ipynb index 6179c21dfa6d..94cdcbb736f8 100644 --- a/notebook/oai_openai_utils.ipynb +++ b/notebook/oai_openai_utils.ipynb @@ -88,13 +88,13 @@ "outputs": [], "source": [ "api_keys = [\"YOUR_OPENAI_API_KEY\"]\n", - "api_bases = None # You can specify API base URLs if needed. eg: localhost:8000\n", + "base_urls = None # You can specify API base URLs if needed. eg: localhost:8000\n", "api_type = \"openai\" # Type of API, e.g., \"openai\" or \"aoai\".\n", "api_version = None # Specify API version if needed.\n", "\n", "config_list = autogen.get_config_list(\n", " api_keys,\n", - " api_bases=api_bases,\n", + " base_urls=base_urls,\n", " api_type=api_type,\n", " api_version=api_version\n", ")\n", @@ -454,7 +454,7 @@ "text/plain": [ "[{'api_key': 'sk-*********************', 'model': 'gpt-4'},\n", " {'api_key': '1234567890234567890',\n", - " 'api_base': 'https://api.someotherapi.com',\n", + " 'base_url': 'https://api.someotherapi.com',\n", " 'api_type': 'aoai',\n", " 'api_version': 'v2',\n", " 'model': 'gpt-3.5-turbo'}]" @@ -474,7 +474,7 @@ " \"api_key_env_var\": \"ANOTHER_API_KEY\",\n", " \"api_type\": \"aoai\",\n", " \"api_version\": \"v2\",\n", - " \"api_base\": \"https://api.someotherapi.com\"\n", + " \"base_url\": \"https://api.someotherapi.com\"\n", " }\n", " },\n", " filter_dict={\n", diff --git a/setup.py b/setup.py index b5f846984aea..d47e2dca3628 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ __version__ = version["__version__"] install_requires = [ - "openai<1", + "openai>=1", "diskcache", "termcolor", "flaml", diff --git a/test/oai/test_utils.py b/test/oai/test_utils.py index 8813ff0d7ae7..04a8596fb547 100644 --- a/test/oai/test_utils.py +++ b/test/oai/test_utils.py @@ -24,7 +24,7 @@ "api_key_env_var": "ANOTHER_API_KEY", "api_type": "aoai", "api_version": "v2", - "api_base": "https://api.someotherapi.com", + "base_url": "https://api.someotherapi.com", }, } diff --git a/website/blog/2023-07-14-Local-LLMs/index.mdx b/website/blog/2023-07-14-Local-LLMs/index.mdx index 136e05e453f1..e7ff8066d5c6 100644 --- a/website/blog/2023-07-14-Local-LLMs/index.mdx +++ b/website/blog/2023-07-14-Local-LLMs/index.mdx @@ -77,7 +77,7 @@ response = oai.Completion.create( config_list=[ { "model": "chatglm2-6b", - "api_base": "http://localhost:8000/v1", + "base_url": "http://localhost:8000/v1", "api_type": "open_ai", "api_key": "NULL", # just a placeholder } @@ -91,7 +91,7 @@ response = oai.ChatCompletion.create( config_list=[ { "model": "chatglm2-6b", - "api_base": "http://localhost:8000/v1", + "base_url": "http://localhost:8000/v1", "api_type": "open_ai", "api_key": "NULL", } @@ -125,13 +125,13 @@ response = oai.ChatCompletion.create( config_list=[ { "model": "chatglm2-6b", - "api_base": "http://localhost:8000/v1", + "base_url": "http://localhost:8000/v1", "api_type": "open_ai", "api_key": "NULL", }, { "model": "vicuna-7b-v1.3", - "api_base": "http://localhost:8000/v1", + "base_url": "http://localhost:8000/v1", "api_type": "open_ai", "api_key": "NULL", } diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index ccf214c13365..cf0ce6ace168 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -36,14 +36,14 @@ The `OAI_CONFIG_LIST` var or file content looks like the following: { "model": "gpt-4", "api_key": "", - "api_base": "", + "base_url": "", "api_type": "azure", "api_version": "2023-07-01-preview" }, { "model": "gpt-3.5-turbo", "api_key": "", - "api_base": "", + "base_url": "", "api_type": "azure", "api_version": "2023-07-01-preview" } diff --git a/website/docs/Use-Cases/enhanced_inference.md b/website/docs/Use-Cases/enhanced_inference.md index 8b5dd5c694ed..a7b1a17a725c 100644 --- a/website/docs/Use-Cases/enhanced_inference.md +++ b/website/docs/Use-Cases/enhanced_inference.md @@ -138,19 +138,19 @@ response = autogen.Completion.create( "model": "gpt-4", "api_key": os.environ.get("AZURE_OPENAI_API_KEY"), "api_type": "azure", - "api_base": os.environ.get("AZURE_OPENAI_API_BASE"), + "base_url": os.environ.get("AZURE_OPENAI_API_BASE"), "api_version": "2023-07-01-preview", }, { "model": "gpt-3.5-turbo", "api_key": os.environ.get("OPENAI_API_KEY"), "api_type": "open_ai", - "api_base": "https://api.openai.com/v1", + "base_url": "https://api.openai.com/v1", "api_version": None, }, { "model": "llama-7B", - "api_base": "http://127.0.0.1:8080", + "base_url": "http://127.0.0.1:8080", "api_type": "open_ai", "api_version": None, }