Skip to content

Commit aedae57

Browse files
ok Merge branch 'main' of github.com:modelscope/ms-agent into release/1.1
2 parents c5ed6f7 + 6c863ce commit aedae57

File tree

5 files changed

+40
-27
lines changed

5 files changed

+40
-27
lines changed

conf.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

ms_agent/tools/search_engine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from ms_agent.tools.search.serpapi import SerpApiSearch
88

99

10-
def get_search_config():
11-
config = load_base_config('conf.yaml')
10+
def get_search_config(config_file: str):
11+
config = load_base_config(config_file)
1212
search_config = config.get('SEARCH_ENGINE', {})
1313
return search_config
1414

@@ -75,14 +75,14 @@ def replace_env_vars(value: str) -> str:
7575
return value
7676

7777

78-
def get_web_search_tool():
78+
def get_web_search_tool(config_file: str):
7979
"""
8080
Get the web search tool based on the configuration.
8181
8282
Returns:
8383
SearchEngine: An instance of the SearchEngine class configured with the API key.
8484
"""
85-
search_config = get_search_config()
85+
search_config = get_search_config(config_file=config_file)
8686

8787
if search_config.get('engine', '') == SearchEngineType.EXA.value:
8888
return ExaSearch(

projects/deep_research/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ SEARCH_ENGINE:
7373
#### Python Example
7474
7575
```python
76-
7776
from ms_agent.llm.openai import OpenAIChat
7877
from ms_agent.tools.search.search_base import SearchEngine
7978
from ms_agent.tools.search_engine import get_web_search_tool
@@ -97,20 +96,27 @@ def run_workflow(user_prompt: str, task_dir: str, reuse: bool,
9796

9897
if __name__ == '__main__':
9998

100-
query: str = 'Survey of the Deep Research on the AI Agent within the recent 3 month, including the latest research papers, open-source projects, and industry applications.' # noqa
99+
query: str = 'Survey of the AI Agent within the recent 3 month, including the latest research papers, open-source projects, and industry applications.' # noqa
101100
task_workdir: str = '/path/to/your_task_dir'
102101
reuse: bool = False
103102

104103
# Get chat client OpenAI compatible api
104+
# Free API Inference Calls - Every registered ModelScope user receives a set number of free API inference calls daily, refer to https://modelscope.cn/docs/model-service/API-Inference/intro for details. # noqa
105+
"""
106+
* `api_key` (str), your API key, replace `xxx-xxx` with your actual key. Alternatively, you can use ModelScope API key, refer to https://modelscope.cn/my/myaccesstoken # noqa
107+
* `base_url`: (str), the base URL for API requests, `https://api-inference.modelscope.cn/v1/` for ModelScope API-Inference
108+
* `model`: (str), the model ID for inference, `Qwen/Qwen3-235B-A22B-Instruct-2507` can be recommended for document research tasks.
109+
"""
105110
chat_client = OpenAIChat(
106-
api_key='sk-xxx',
107-
base_url='https://your_base_url',
108-
model='gemini-2.5-pro',
111+
api_key='xxx-xxx',
112+
base_url='https://api-inference.modelscope.cn/v1/',
113+
model='Qwen/Qwen3-235B-A22B-Instruct-2507',
109114
)
110115

111116
# Get web-search engine client
112117
# For the ExaSearch, you can get your API key from https://exa.ai
113-
search_engine = get_web_search_tool()
118+
# Please specify your config file path, the default is `conf.yaml` in the current directory.
119+
search_engine = get_web_search_tool(config_file='conf.yaml')
114120

115121
run_workflow(
116122
user_prompt=query,

projects/deep_research/conf.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Search Engine, Supported values: EXA, SERPAPI, ARXIV
2+
#SEARCH_ENGINE:
3+
# engine: exa
4+
# exa_api_key: $EXA_API_KEY
5+
6+
#SEARCH_ENGINE:
7+
# engine: serpapi
8+
# serpapi_api_key: $SERPAPI_API_KEY
9+
# provider: google
10+
11+
SEARCH_ENGINE:
12+
engine: arxiv

projects/deep_research/run.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,27 @@ def run_workflow(user_prompt: str, task_dir: str, reuse: bool,
2323

2424
if __name__ == '__main__':
2525

26-
query: str = 'Survey of the Deep Research on the AI Agent within the recent 3 month, including the latest research papers, open-source projects, and industry applications.' # noqa
26+
query: str = 'Survey of the AI Agent within the recent 3 month, including the latest research papers, open-source projects, and industry applications.' # noqa
2727
task_workdir: str = '/path/to/your_task_dir'
2828
reuse: bool = False
2929

3030
# Get chat client OpenAI compatible api
31+
# Free API Inference Calls - Every registered ModelScope user receives a set number of free API inference calls daily, refer to https://modelscope.cn/docs/model-service/API-Inference/intro for details. # noqa
32+
"""
33+
* `api_key` (str), your API key, replace `xxx-xxx` with your actual key. Alternatively, you can use ModelScope API key, refer to https://modelscope.cn/my/myaccesstoken # noqa
34+
* `base_url`: (str), the base URL for API requests, `https://api-inference.modelscope.cn/v1/` for ModelScope API-Inference
35+
* `model`: (str), the model ID for inference, `Qwen/Qwen3-235B-A22B-Instruct-2507` can be recommended for document research tasks.
36+
"""
3137
chat_client = OpenAIChat(
32-
api_key='sk-xxx',
33-
base_url='https://your_base_url',
34-
model='gemini-2.5-pro',
38+
api_key='xxx-xxx',
39+
base_url='https://api-inference.modelscope.cn/v1/',
40+
model='Qwen/Qwen3-235B-A22B-Instruct-2507',
3541
)
3642

3743
# Get web-search engine client
3844
# For the ExaSearch, you can get your API key from https://exa.ai
39-
search_engine = get_web_search_tool()
45+
# Please specify your config file path, the default is `conf.yaml` in the current directory.
46+
search_engine = get_web_search_tool(config_file='conf.yaml')
4047

4148
run_workflow(
4249
user_prompt=query,

0 commit comments

Comments
 (0)