From e4fe1fff9795a9e3593581cd06bdead263d15756 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 11 Jun 2024 10:54:11 -0700 Subject: [PATCH] feat: tool __user__ email --- backend/main.py | 1 + src/lib/components/workspace/Tools/CodeEditor.svelte | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index 88fda3ff6..74fc4aa5d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -230,6 +230,7 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u **result["parameters"], "__user__": { "id": user.id, + "email": user.email, "name": user.name, "role": user.role, }, diff --git a/src/lib/components/workspace/Tools/CodeEditor.svelte b/src/lib/components/workspace/Tools/CodeEditor.svelte index 24a098c63..a8796b39b 100644 --- a/src/lib/components/workspace/Tools/CodeEditor.svelte +++ b/src/lib/components/workspace/Tools/CodeEditor.svelte @@ -20,9 +20,9 @@ class Tools: # Use Sphinx-style docstrings to document your tools, they will be used for generating tools specifications # Please refer to function_calling_filter_pipeline.py file from pipelines project for an example - def get_user_name_and_id(self, __user__: dict = {}) -> str: + def get_user_name_and_email_and_id(self, __user__: dict = {}) -> str: """ - Get the user name and ID from the user object. + Get the user name, Email and ID from the user object. """ # Do not include :param for __user__ in the docstring as it should not be shown in the tool's documentation @@ -35,6 +35,8 @@ class Tools: result += f"User: {__user__['name']}" if "id" in __user__: result += f" (ID: {__user__['id']})" + if "email" in __user__: + result += f" (Email: {__user__['email']})" if result == "": result = "User: Unknown"