File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 11
22# To run the ms-agent chat with mcp tools, let's take the newspaper example as an instance:
3+
4+ # # Step1: Installation
5+ # pip install ms-agent -U
6+ # pip install -U llama-index-core llama-index-embeddings-huggingface llama-index-llms-openai llama-index-llms-replicate
7+
8+ # # Step2: Configuration & Run
39export TAVILY_API_KEY=xxx-xxx # Replace with your `Tavily` API key
410ms-agent run --modelscope_api_key ms-xxx-xxx --config ms-agent/newspaper --trust_remote_code true
511
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ def define_args(parsers: argparse.ArgumentParser):
3232 parser .add_argument (
3333 '--query' ,
3434 required = False ,
35- nargs = '+' ,
35+ type = str ,
3636 help =
37- 'The query or prompt to send to the LLM. Multiple words can be provided as a single query string .'
37+ 'The query or prompt to send to the LLM. If not set, will enter an interactive mode .'
3838 )
3939 parser .add_argument (
4040 '--config' ,
@@ -113,7 +113,15 @@ def execute(self):
113113 mcp_server_file = self .args .mcp_server_file ,
114114 load_cache = self .args .load_cache ,
115115 task = self .args .query )
116+
116117 query = self .args .query
118+ input_msg : str = "Please input instruction or 'Ctrl+C' to exit:"
117119 if not query :
118- query = input ('>>>' )
119- asyncio .run (engine .run (' ' .join (query )))
120+ print (input_msg , flush = True )
121+ while True :
122+ query = input ('>>> ' ).strip ()
123+ if query :
124+ break
125+ print (input_msg , flush = True )
126+
127+ asyncio .run (engine .run (query ))
You can’t perform that action at this time.
0 commit comments