Skip to content

Commit 21849f8

Browse files
Fix newspaper run case and update comments (#715)
1 parent 302e072 commit 21849f8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

examples/cli/cli.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
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
39
export TAVILY_API_KEY=xxx-xxx # Replace with your `Tavily` API key
410
ms-agent run --modelscope_api_key ms-xxx-xxx --config ms-agent/newspaper --trust_remote_code true
511

ms_agent/cli/run.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff 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))

0 commit comments

Comments
 (0)