xlang-ai / OpenAgents

[COLM 2024] OpenAgents: An Open Platform for Language Agents in the Wild
https://arxiv.org/abs/2310.10634
Apache License 2.0
4.02k stars 447 forks source link

python3.11 supported #24

Closed shanmu-raoyunfei closed 1 year ago

shanmu-raoyunfei commented 1 year ago

The running background reported an error, the initial interpretation is compatible with Python3.11, the error is as follows:

flask run -p 8000 Traceback (most recent call last): File "/opt/homebrew/bin/flask", line 8, in sys.exit(main()) ^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 1063, in main cli.main() File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func return ctx.invoke(f, obj, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 911, in run_command raise e from None File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 897, in run_command app = info.load_app() ^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 308, in load_app app = locate_app(import_name, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 218, in locate_app import(module_name) File "/Users/raoyunfei/OpenAgents/backend/init.py", line 4, in from backend.api import ( File "/Users/raoyunfei/OpenAgents/backend/api/chat_copilot.py", line 5, in from backend.api.file import _get_file_path_from_node File "/Users/raoyunfei/OpenAgents/backend/api/file.py", line 8, in from backend.main import ( File "/Users/raoyunfei/OpenAgents/backend/main.py", line 6, in from backend.kernel_publisher import start_kernel_publisher File "/Users/raoyunfei/OpenAgents/backend/kernel_publisher.py", line 4, in from backend.utils.utils import logger File "/Users/raoyunfei/OpenAgents/backend/utils/utils.py", line 14, in from real_agents.adapters.data_model import ( File "/Users/raoyunfei/OpenAgents/real_agents/adapters/data_model/init__.py", line 2, in from real_agents.adapters.data_model.database import DatabaseDataModel File "/Users/raoyunfei/OpenAgents/real_agents/adapters/data_model/database.py", line 10, in from real_agents.adapters.data_model.table import TableDataModel File "/Users/raoyunfei/OpenAgents/real_agents/adapters/data_model/table.py", line 9, in from real_agents.adapters.data_model.templates.skg_templates.table_templates import serialize_df File "/Users/raoyunfei/OpenAgents/real_agents/adapters/data_model/templates/skg_templates/table_templates.py", line 10, in from real_agents.adapters.schema import SQLDatabase File "/Users/raoyunfei/OpenAgents/real_agents/adapters/schema.py", line 2, in from langchain import SQLDatabase File "/opt/homebrew/lib/python3.11/site-packages/langchain/init.py", line 6, in from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "/opt/homebrew/lib/python3.11/site-packages/langchain/agents/init.py", line 2, in from langchain.agents.agent import ( File "/opt/homebrew/lib/python3.11/site-packages/langchain/agents/agent.py", line 16, in from langchain.agents.tools import InvalidTool File "/opt/homebrew/lib/python3.11/site-packages/langchain/agents/tools.py", line 8, in from langchain.tools.base import BaseTool, Tool, tool File "/opt/homebrew/lib/python3.11/site-packages/langchain/tools/init.py", line 26, in from langchain.tools.openapi.utils.api_models import APIOperation File "/opt/homebrew/lib/python3.11/site-packages/langchain/tools/openapi/utils/api_models.py", line 6, in from openapi_schema_pydantic import MediaType, Parameter, Reference, RequestBody, Schema File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/init.py", line 3, in from .v3 import File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/init.py", line 1, in from .v3_1_0 import File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/init.py", line 9, in from .open_api import OpenAPI File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/open_api.py", line 5, in from .components import Components File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/components.py", line 7, in from .header import Header File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/header.py", line 3, in from .parameter import Parameter File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/parameter.py", line 6, in from .media_type import MediaType File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/media_type.py", line 8, in from .schema import Schema File "/opt/homebrew/lib/python3.11/site-packages/openapi_schema_pydantic/v3/v3_1_0/schema.py", line 10, in class Schema(BaseModel): File "/opt/homebrew/lib/python3.11/site-packages/pydantic/main.py", line 292, in new cls.signature = ClassAttribute('signature', generate_model_signature(cls.init, fields, config)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/pydantic/utils.py", line 258, in generate_model_signature merged_params[param_name] = Parameter( ^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 2725, in init raise ValueError('{!r} is not a valid parameter name'.format(name)) ValueError: 'not' is not a valid parameter name

BlankCheng commented 1 year ago

Hi, thanks for your feedback. I've searched for pydantic + python 3.11 and it seems it's a common conflict. I found a solution https://github.com/freqtrade/freqtrade/issues/7541 here, can you try it and tell us if that can work? Thank you!

shanmu-raoyunfei commented 1 year ago

resolved,thks