Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

chore: general_function_schema, general_tool_choice -> GENERAL_FUNCTION_SCHEMA, GENERAL_TOOL_CHOICE

刘棒棒7a5c66b01edc
diff --git a/metagpt/provider/constant.py b/metagpt/provider/constant.py
index f9b84fc60..db67847a8 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
-general_function_schema = {
+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 @@ general_function_schema = {
# tool_choice value for general_function_schema
# https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice
-general_tool_choice = {"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 af7810b62..34e5693f8 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 general_function_schema, general_tool_choice
+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 (
@@ -248,8 +248,8 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):
"""
if "tools" not in kwargs:
configs = {
- "tools": [{"type": "function", "function": general_function_schema}],
- "tool_choice": general_tool_choice,
+ "tools": [{"type": "function", "function": GENERAL_FUNCTION_SCHEMA}],
+ "tool_choice": GENERAL_TOOL_CHOICE,
}
kwargs.update(configs)