From 53874409b133b0db6d5f52a4078b65b2bfc5722c Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Tue, 26 Sep 2023 11:47:26 -0700 Subject: [PATCH] fix: rename --- chat/display_widgets.py | 3 --- knowledge_base/widgets.yaml | 2 +- tools/__init__.py | 2 +- tools/{index_generate_code.py => generate_js_code.py} | 2 +- tools/index_widget.py | 6 +++--- 5 files changed, 6 insertions(+), 9 deletions(-) rename tools/{index_generate_code.py => generate_js_code.py} (98%) diff --git a/chat/display_widgets.py b/chat/display_widgets.py index f0210a4..2d7fb05 100644 --- a/chat/display_widgets.py +++ b/chat/display_widgets.py @@ -201,9 +201,6 @@ def _widgetize_inner(command: str, params: str, depth: int = 0) -> str: elif command == 'withdraw-vault': items = params.split(",") lines.append(f"Withdraw vault action for token: {items[0]}, amount: {items[1]}.") - elif command == 'generate-code': - items = params.split(",") - lines.append(f"supply the user with valid javascript code to run and perform their desired action.") else: # assert 0, f'unrecognized command: {command}({params})' lines.append(f"An unrecognized command: {command}({params})") diff --git a/knowledge_base/widgets.yaml b/knowledge_base/widgets.yaml index a1724da..05f2f02 100644 --- a/knowledge_base/widgets.yaml +++ b/knowledge_base/widgets.yaml @@ -855,7 +855,7 @@ - vault type: object return_value_description: '' -- _name_: display_generate_code +- _name_: generate_js_code description: generate code for the user; this widget should always be chosen for anything relating to code parameters: properties: diff --git a/tools/__init__.py b/tools/__init__.py index 819929b..94b9191 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -7,4 +7,4 @@ from . import index_api_tool from . import app_usage_guide from . import index_link_suggestion -from . import index_generate_code \ No newline at end of file +from . import generate_js_code \ No newline at end of file diff --git a/tools/index_generate_code.py b/tools/generate_js_code.py similarity index 98% rename from tools/index_generate_code.py rename to tools/generate_js_code.py index 17289dc..66ff415 100644 --- a/tools/index_generate_code.py +++ b/tools/generate_js_code.py @@ -22,7 +22,7 @@ @registry.register_class -class IndexGenerateCodeTool(BaseTool): +class GenerateJSCodeTool(BaseTool): """Tool for generating code to perform a user request.""" _chain: LLMChain diff --git a/tools/index_widget.py b/tools/index_widget.py index 505827f..ad0e5de 100644 --- a/tools/index_widget.py +++ b/tools/index_widget.py @@ -393,11 +393,11 @@ def fn(token_handler): return fn @error_wrap -def generate_code(query: str) -> Callable: +def generate_js_code(query: str) -> Callable: def fn(token_handler): tool = dict( - name="IndexGenerateCodeTool", - type="tools.index_generate_code.IndexGenerateCodeTool", + name="GenerateJSCodeTool", + type="tools.generate_js_code.GenerateJSCodeTool", _streaming=True, ) tool = streaming.get_streaming_tools([tool], token_handler)[0]