modelscope / modelscope-agent

ModelScope-Agent: An agent framework connecting models in ModelScope with the world
https://modelscope-agent.readthedocs.io/en/latest/
Apache License 2.0
2.71k stars 309 forks source link

[framework] Refactor Non-Core Requirements to Runtime/On-Demand Dependencies #477

Open dahaipeng opened 5 months ago

dahaipeng commented 5 months ago

Initial Checks

Description

This issue addresses the need to refactor requirements that are not core to the project. These requirements, such as langchain, ollama, and vllm, etc ,should be included in the setup environment but managed as runtime/on-demand dependencies. This approach will streamline the core functionality while allowing additional features to be included as needed without bloating the main project dependencies.

Use case

No response

dahaipeng commented 4 months ago

In this PR , we: Remove Non-Core Packages: Remove vllm, ollma, and zhipuai from the requirements.txt file. These packages are not essential for the core functionality of the project and can be installed optionally by users who need them. Dynamic Import within Class Initialization: Move the import statements for vllm, ollma, and zhipuai into the relevant class constructors (init methods). This ensures that these packages are only imported when necessary, reducing the base dependencies and potential for conflicts. We use a try-except block in the class initialization to catch the ImportError and provide a clear message to the users.