fix #4792
This commit is contained in:
parent
32699a82a6
commit
6b48308ef9
|
@ -16,6 +16,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
from threading import Thread
|
||||
from typing import TYPE_CHECKING, Any, AsyncGenerator, Dict, Generator, List, Optional, Sequence
|
||||
|
||||
|
@ -115,10 +116,8 @@ class ChatModel:
|
|||
|
||||
|
||||
def run_chat() -> None:
|
||||
if os.name != "nt":
|
||||
try:
|
||||
import platform
|
||||
|
||||
if platform.system() != "Windows":
|
||||
import readline # noqa: F401
|
||||
except ImportError:
|
||||
print("Install `readline` for a better experience.")
|
||||
|
|
|
@ -25,9 +25,9 @@ DEFAULT_TOOL_PROMPT = (
|
|||
"You have access to the following tools:\n{tool_text}"
|
||||
"Use the following format if using a tool:\n"
|
||||
"```\n"
|
||||
"Action: tool name (one of [{tool_names}]).\n"
|
||||
"Action: tool name (one of [{tool_names}])\n"
|
||||
"Action Input: the input to the tool, in a JSON format representing the kwargs "
|
||||
"""(e.g. ```{{"input": "hello world", "num_beams": 5}}```).\n"""
|
||||
"""(e.g. ```{{"input": "hello world", "num_beams": 5}}```)\n"""
|
||||
"```\n"
|
||||
)
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ def gen_cmd(args: Dict[str, Any]) -> str:
|
|||
cmd_text = "`\n".join(cmd_lines)
|
||||
else:
|
||||
cmd_text = "\\\n".join(cmd_lines)
|
||||
|
||||
cmd_text = "```bash\n{}\n```".format(cmd_text)
|
||||
return cmd_text
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@ def test_default_tool_formatter():
|
|||
" - bar (number): bar_desc\n\n"
|
||||
"Use the following format if using a tool:\n"
|
||||
"```\n"
|
||||
"Action: tool name (one of [test_tool]).\n"
|
||||
"Action: tool name (one of [test_tool])\n"
|
||||
"Action Input: the input to the tool, in a JSON format representing the kwargs "
|
||||
"""(e.g. ```{"input": "hello world", "num_beams": 5}```).\n"""
|
||||
"""(e.g. ```{"input": "hello world", "num_beams": 5}```)\n"""
|
||||
"```\n"
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue