Skip to content

Commit

Permalink
fix: python prompt for CodeInput format detail
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu007 committed Aug 22, 2024
1 parent 3a94afa commit 60f0e40
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/codeinterpreterapi/tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@ def get_tools_python(cls, ci_params: CodeInterpreterParams) -> None:
tools = [
StructuredTool(
name="python",
description="Input a string of code to a ipython interpreter.\n"
"Write the entire code in a single string.\n"
"This string can be really long.\n"
"Do not start your code with a line break.\n"
"For example, do 'import numpy', not '\\nimport numpy'."
"Variables are preserved between runs. "
+ (
("You can use all default python packages " f"specifically also these: {settings.CUSTOM_PACKAGES}")
if settings.CUSTOM_PACKAGES
else ""
), # TODO: or include this in the system message
description="IPythonインタプリタにコードを入力します。\n"
"コードは文字列として一つにまとめて入力してください。\n"
"この文字列は非常に長くても構いません。\n"
"コードは改行で始めないでください。\n"
"例えば、'import numpy'のように入力します。\n"
"'\\nimport numpy'のようにはしないでください。\n"
"また、必ず'filename'を指定してください。この値はファイル名として使用されます。\n"
"入力フォーマットは次の通りです:\n"
"{ 'filename': 'your_filename.py', 'code': 'your_code_here' }\n"
"変数は実行間で保持されます。\n"
"デフォルトのPythonパッケージに加えて、次のカスタムパッケージも使用できます: "
f"{settings.CUSTOM_PACKAGES}"
if settings.CUSTOM_PACKAGES
else "",
func=tools_instance._run_handler,
coroutine=tools_instance._arun_handler,
args_schema=CodeInput, # type: ignore
Expand Down

0 comments on commit 60f0e40

Please sign in to comment.