From 66f647276e8775478321cd19bddb5f7cce9000d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=A3=92=E6=A3=92?= Date: Tue, 21 Nov 2023 11:19:43 +0800 Subject: [PATCH] Revert "chore: change name." This reverts commit daf29c41afba445bd507d75e6549e0f8fb14ecc5. --- metagpt/provider/constant.py | 4 ++-- metagpt/provider/openai_api.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/metagpt/provider/constant.py b/metagpt/provider/constant.py index f228e7c30..f9b84fc60 100644 --- a/metagpt/provider/constant.py +++ b/metagpt/provider/constant.py @@ -1,6 +1,6 @@ # function in tools, https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools # Reference: https://github.com/KillianLucas/open-interpreter/blob/v0.1.14/interpreter/llm/setup_openai_coding_llm.py -GENRAL_FUNCTION_SCHEMA_4_ASK_CODE = { +general_function_schema = { "name": "execute", "description": "Executes code on the user's machine, **in the users local environment**, and returns the output", "parameters": { @@ -27,4 +27,4 @@ GENRAL_FUNCTION_SCHEMA_4_ASK_CODE = { # tool_choice value for general_function_schema # https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice -GENRAL_TOOL_CHOICE_4_ASK_CODE = {"type": "function", "function": {"name": "execute"}} +general_tool_choice = {"type": "function", "function": {"name": "execute"}} diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py index f950c0d67..8f8d45d73 100644 --- a/metagpt/provider/openai_api.py +++ b/metagpt/provider/openai_api.py @@ -21,7 +21,7 @@ from tenacity import ( from metagpt.config import CONFIG from metagpt.logs import logger from metagpt.provider.base_gpt_api import BaseGPTAPI -from metagpt.provider.constant import GENRAL_FUNCTION_SCHEMA_4_ASK_CODE, GENRAL_TOOL_CHOICE_4_ASK_CODE +from metagpt.provider.constant import general_function_schema, general_tool_choice from metagpt.schema import Message from metagpt.utils.singleton import Singleton from metagpt.utils.token_counter import ( @@ -245,8 +245,8 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter): def _func_configs(self, messages: list[dict], **kwargs) -> dict: if "tools" not in kwargs: configs = { - "tools": [{"type": "function", "function": GENRAL_FUNCTION_SCHEMA_4_ASK_CODE}], - "tool_choice": GENRAL_TOOL_CHOICE_4_ASK_CODE, + "tools": [{"type": "function", "function": general_function_schema}], + "tool_choice": general_tool_choice, } kwargs.update(configs)