From b156aafcc3f09db26c4d0fe718aea3e39674e83c Mon Sep 17 00:00:00 2001 From: Zihui Ouyang Date: Wed, 20 Sep 2023 10:17:18 -0700 Subject: [PATCH 1/6] aded file --- ..._Act_as_a_World-class_Business_Coach.ipynb | 254 ++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb new file mode 100644 index 0000000000..d08341d3ae --- /dev/null +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -0,0 +1,254 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "f968e9be", + "metadata": {}, + "source": [ + "\"Naas\"" + ] + }, + { + "cell_type": "markdown", + "id": "717314a7", + "metadata": {}, + "source": [ + "# OpenAI - Act as a World-class Business Coach\n", + "

Give Feedback | Bug report" + ] + }, + { + "cell_type": "markdown", + "id": "5596529e", + "metadata": {}, + "source": [ + "**Tags:** #ai #businesscoach #artificialintelligence #aitrends #aiconcepts #plugin" + ] + }, + { + "cell_type": "markdown", + "id": "5372e343", + "metadata": {}, + "source": [ + "**Author:** [Zihui Ouyang](https://www.linkedin.com/in/zihui-ouyang-539626227/)" + ] + }, + { + "cell_type": "markdown", + "id": "72725ae6", + "metadata": {}, + "source": [ + "**Last update:** 2023-09-20 (Created: 2023-09-20)" + ] + }, + { + "cell_type": "markdown", + "id": "7c8f5113", + "metadata": {}, + "source": [ + "**Description:** This notebook will create a plugin to act as a world class business coach." + ] + }, + { + "cell_type": "markdown", + "id": "06513f9f", + "metadata": {}, + "source": [ + "**References:**\n", + "- [OpenAI Documentation](https://openai.com/docs/)\n", + "- [7 prompts ChatGPT indispensables](https://docs.google.com/document/d/1CMZa0o1ck_1l-t7ICF7_y2tDokcBkP68Nkxd64KWuQk/edit)" + ] + }, + { + "cell_type": "markdown", + "id": "341e0265", + "metadata": {}, + "source": [ + "## Input" + ] + }, + { + "cell_type": "markdown", + "id": "ee8ad918", + "metadata": {}, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e2e046c1", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import naas" + ] + }, + { + "cell_type": "markdown", + "id": "b316c708", + "metadata": {}, + "source": [ + "### Setup Variables\n", + "- `name`: Plugin name to be displayed on naas.\n", + "- `model`: ID of the model to use. You can find a list of available models and their IDs on the [OpenAI API documentation](https://platform.openai.com/docs/models/overview).\n", + "- `prompt`: This is the text prompt that you want to send to the OpenAI API.\n", + "- `temperature` (Defaults to 1): This is a value that controls the level of randomness in the generated text. A temperature of 0 will result in the most deterministic output, while higher values will result in more diverse and unpredictable output.\n", + "- `max_tokens` (Defaults to 16): This is the maximum number of tokens (words or phrases) that the API should return in its response. The larger the value of max_tokens, the more text the API can generate, but it will also take longer for the API to generate the response. The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).\n", + "- `json_path`: json file path to be saved" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3dbe3aae", + "metadata": {}, + "outputs": [], + "source": [ + "# Inputs\n", + "name = \"Act as a world-class business coach\"\n", + "model = \"gpt-4\"\n", + "prompt = f\"\"\"You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\n", + "\n", + "For reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\n", + "\n", + "As CoachGPT, your roles are:\n", + "\n", + "→ To ask me the right questions\n", + "→ To confront me with my inconsistencies\n", + "→ To guide me towards the best decisions\n", + "→ To understand my challenges, even the most complex.\n", + "\n", + "I run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\n", + "\n", + "Our goal by [DEADLINE] is [GOAL].\n", + "\n", + "Your task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\n", + "- Management\n", + "- Marketing\n", + "- Problem solving\n", + "- Hiring\n", + "- Productivity strategies\n", + "- Hard skills development\n", + "- Soft skills development\n", + "- Financial leverages.\n", + "\n", + "Before answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\n", + "\n", + "Also note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\n", + "\n", + "Please make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\n", + "\n", + "Is that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\"\n", + "\n", + "\"\"\"\n", + "temperature = 1\n", + "max_tokens = 2084\n", + "\n", + "# Outputs\n", + "json_path = name.lower().replace(\" \", \"_\") + \".json\"" + ] + }, + { + "cell_type": "markdown", + "id": "6d716f46", + "metadata": {}, + "source": [ + "## Model" + ] + }, + { + "cell_type": "markdown", + "id": "c01b03e7", + "metadata": {}, + "source": [ + "### Create plugin" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "66c435ac", + "metadata": {}, + "outputs": [], + "source": [ + "data = {\n", + " \"name\": name,\n", + " \"prompt\": prompt.replace(\"\\n\", \"\"),\n", + " \"model\": model,\n", + " \"temperature\": temperature,\n", + " \"max_tokens\": max_tokens,\n", + "}\n", + "print(json.dumps(data))" + ] + }, + { + "cell_type": "markdown", + "id": "513bc1b1", + "metadata": {}, + "source": [ + "## Output" + ] + }, + { + "cell_type": "markdown", + "id": "1c4e9133", + "metadata": {}, + "source": [ + "### Save json" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "91fd11d6", + "metadata": {}, + "outputs": [], + "source": [ + "with open(json_path, \"w\") as f:\n", + " json.dump(data, f)" + ] + }, + { + "cell_type": "markdown", + "id": "ebe2a0f0", + "metadata": {}, + "source": [ + "### Create naas asset" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "06c73483", + "metadata": {}, + "outputs": [], + "source": [ + "asset_link = naas.asset.add(json_path, params={\"inline\": True})" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From bfbe786320a8a857395c6aefc8b12c6e0d4892d2 Mon Sep 17 00:00:00 2001 From: Zihui Ouyang Date: Wed, 27 Sep 2023 09:15:33 -0700 Subject: [PATCH 2/6] updated file --- ..._Act_as_a_World-class_Business_Coach.ipynb | 235 ++++++++++++++---- 1 file changed, 190 insertions(+), 45 deletions(-) diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb index d08341d3ae..7ad2450503 100644 --- a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -13,8 +13,7 @@ "id": "717314a7", "metadata": {}, "source": [ - "# OpenAI - Act as a World-class Business Coach\n", - "

Give Feedback | Bug report" + "# OpenAI - Act as a World-class Business Coach" ] }, { @@ -22,7 +21,7 @@ "id": "5596529e", "metadata": {}, "source": [ - "**Tags:** #ai #businesscoach #artificialintelligence #aitrends #aiconcepts #plugin" + "**Tags:** #ai #businesscoach #artificialintelligence #aitrends #aiconcepts #plugin #openai #naaschatplugin #naas #naas_driver #chat" ] }, { @@ -38,7 +37,7 @@ "id": "72725ae6", "metadata": {}, "source": [ - "**Last update:** 2023-09-20 (Created: 2023-09-20)" + "**Last update:** 2023-09-27 (Created: 2023-09-20)" ] }, { @@ -56,7 +55,9 @@ "source": [ "**References:**\n", "- [OpenAI Documentation](https://openai.com/docs/)\n", - "- [7 prompts ChatGPT indispensables](https://docs.google.com/document/d/1CMZa0o1ck_1l-t7ICF7_y2tDokcBkP68Nkxd64KWuQk/edit)" + "- [7 prompts ChatGPT indispensables](https://docs.google.com/document/d/1CMZa0o1ck_1l-t7ICF7_y2tDokcBkP68Nkxd64KWuQk/edit)\n", + "- [Naas Chat Documentation](https://site.naas.ai/docs/platform/aI-powered-chat)\n", + "- [Naas Chat Plugin driver](https://github.com/jupyter-naas/drivers/blob/main/naas_drivers/tools/naas_chat_plugin.py)" ] }, { @@ -77,13 +78,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "e2e046c1", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-27T16:03:53.433129Z", + "iopub.status.busy": "2023-09-27T16:03:53.432747Z", + "iopub.status.idle": "2023-09-27T16:03:55.270276Z", + "shell.execute_reply": "2023-09-27T16:03:55.269682Z", + "shell.execute_reply.started": "2023-09-27T16:03:53.433040Z" + }, + "tags": [] + }, "outputs": [], "source": [ - "import json\n", - "import naas" + "from naas_drivers import naas_chat_plugin\n", + "from IPython.display import Markdown\n", + "import naas\n", + "import json" ] }, { @@ -92,25 +104,36 @@ "metadata": {}, "source": [ "### Setup Variables\n", - "- `name`: Plugin name to be displayed on naas.\n", - "- `model`: ID of the model to use. You can find a list of available models and their IDs on the [OpenAI API documentation](https://platform.openai.com/docs/models/overview).\n", - "- `prompt`: This is the text prompt that you want to send to the OpenAI API.\n", - "- `temperature` (Defaults to 1): This is a value that controls the level of randomness in the generated text. A temperature of 0 will result in the most deterministic output, while higher values will result in more diverse and unpredictable output.\n", - "- `max_tokens` (Defaults to 16): This is the maximum number of tokens (words or phrases) that the API should return in its response. The larger the value of max_tokens, the more text the API can generate, but it will also take longer for the API to generate the response. The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).\n", - "- `json_path`: json file path to be saved" + "**Mandatory**\n", + "- `name`: The name of the plugin.\n", + "- `prompt`: The prompt for the plugin.\n", + "\n", + "**Optional**\n", + "- `model`: The name of the model to be used for tokenization. Models available: \"gpt-3.5-turbo\" (limited to 4097 tokens), \"gpt-3.5-turbo-16k\" (limited to 16385 tokens), and \"gpt-4\" (limited to 8192 tokens). \n", + "- `temperature`: The temperature parameter for the model. Default is 0.\n", + "- `output_path`: The path where the JSON file should be saved. If not provided, it will be created from the plugin name." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "3dbe3aae", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-27T16:07:45.038547Z", + "iopub.status.busy": "2023-09-27T16:07:45.037977Z", + "iopub.status.idle": "2023-09-27T16:07:45.049276Z", + "shell.execute_reply": "2023-09-27T16:07:45.048531Z", + "shell.execute_reply.started": "2023-09-27T16:07:45.038503Z" + }, + "tags": [] + }, "outputs": [], "source": [ "# Inputs\n", "name = \"Act as a world-class business coach\"\n", "model = \"gpt-4\"\n", - "prompt = f\"\"\"You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\n", + "prompt = \"\"\"You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\n", "\n", "For reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\n", "\n", @@ -141,14 +164,13 @@ "\n", "Please make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\n", "\n", - "Is that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\"\n", - "\n", + "Is that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\n", "\"\"\"\n", "temperature = 1\n", - "max_tokens = 2084\n", + "\n", "\n", "# Outputs\n", - "json_path = name.lower().replace(\" \", \"_\") + \".json\"" + "output_path = None" ] }, { @@ -161,27 +183,54 @@ }, { "cell_type": "markdown", - "id": "c01b03e7", + "id": "216f9d64-4920-43cb-881a-b73af8b21823", "metadata": {}, "source": [ "### Create plugin" ] }, + { + "cell_type": "markdown", + "id": "2606a338-0f21-4e0d-82df-5a29ecab6d69", + "metadata": {}, + "source": [ + "This function will generate the plugin in JSON format and also verify if your prompt adheres to the recommended limit, which is set at 20% of the maximum tokens allowed by the model. Then, it will save your plugin in your local environment." + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "66c435ac", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-27T16:07:57.504107Z", + "iopub.status.busy": "2023-09-27T16:07:57.503884Z", + "iopub.status.idle": "2023-09-27T16:07:59.520017Z", + "shell.execute_reply": "2023-09-27T16:07:59.519398Z", + "shell.execute_reply.started": "2023-09-27T16:07:57.504085Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " ✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", + " \n", + "💾 Plugin successfully saved. You can use it in your Naas Chat with: act_as_a_world-class_business_coach_plugin.json\n" + ] + } + ], "source": [ - "data = {\n", - " \"name\": name,\n", - " \"prompt\": prompt.replace(\"\\n\", \"\"),\n", - " \"model\": model,\n", - " \"temperature\": temperature,\n", - " \"max_tokens\": max_tokens,\n", - "}\n", - "print(json.dumps(data))" + "plugin_file_path = naas_chat_plugin.create_plugin(\n", + " name=name,\n", + " prompt=prompt,\n", + " model=model,\n", + " temperature=temperature,\n", + " output_path=output_path\n", + ")" ] }, { @@ -202,13 +251,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "91fd11d6", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-27T16:09:47.659248Z", + "iopub.status.busy": "2023-09-27T16:09:47.659019Z", + "iopub.status.idle": "2023-09-27T16:09:47.681705Z", + "shell.execute_reply": "2023-09-27T16:09:47.680909Z", + "shell.execute_reply.started": "2023-09-27T16:09:47.659227Z" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'Act as a world-class business coach',\n", + " 'model': 'gpt-4',\n", + " 'temperature': 1,\n", + " 'max_tokens': 8192,\n", + " 'prompt': 'You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n→ To ask me the right questions\\n→ To confront me with my inconsistencies\\n→ To guide me towards the best decisions\\n→ To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\\n'}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "with open(json_path, \"w\") as f:\n", - " json.dump(data, f)" + "with open(plugin_file_path) as json_file:\n", + " plugin = json.load(json_file)\n", + "plugin" ] }, { @@ -221,18 +295,89 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "06c73483", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-27T16:10:17.617095Z", + "iopub.status.busy": "2023-09-27T16:10:17.616834Z", + "iopub.status.idle": "2023-09-27T16:10:17.913706Z", + "shell.execute_reply": "2023-09-27T16:10:17.913075Z", + "shell.execute_reply.started": "2023-09-27T16:10:17.617072Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "👌 Well done! Your Assets has been sent to production.\n", + "\n" + ] + }, + { + "data": { + "application/javascript": "\n if (!window.copyToClipboard) {\n window.copyToClipboard = (text) => {\n const dummy = document.createElement(\"textarea\");\n document.body.appendChild(dummy);\n dummy.value = text;\n dummy.select();\n document.execCommand(\"copy\");\n document.body.removeChild(dummy);\n }\n }\n ", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "649a3de3c47b4ed096087bc5e2b13021", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Button(button_style='primary', description='Copy URL', style=ButtonStyle())" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d3ad7d1db6544dab9525e4de6ca5e62f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PS: to remove the \"Assets\" feature, just replace .add by .delete\n" + ] + } + ], "source": [ - "asset_link = naas.asset.add(json_path, params={\"inline\": True})" + "plugin_url = naas.asset.add(plugin_file_path, params={\"inline\": True})" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d585eb69-8f07-4dae-83be-a42dbaab02e2", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -246,7 +391,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.9.6" } }, "nbformat": 4, From 4d54a5fa951db1822e73bea50d72c18109c514ef Mon Sep 17 00:00:00 2001 From: Florent Ravenel Date: Thu, 28 Sep 2023 14:49:18 +0200 Subject: [PATCH 3/6] feat: rework template --- ..._Act_as_a_World-class_Business_Coach.ipynb | 189 ++++++++++++------ 1 file changed, 123 insertions(+), 66 deletions(-) diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb index 7ad2450503..4ce2699c40 100644 --- a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -82,11 +82,11 @@ "id": "e2e046c1", "metadata": { "execution": { - "iopub.execute_input": "2023-09-27T16:03:53.433129Z", - "iopub.status.busy": "2023-09-27T16:03:53.432747Z", - "iopub.status.idle": "2023-09-27T16:03:55.270276Z", - "shell.execute_reply": "2023-09-27T16:03:55.269682Z", - "shell.execute_reply.started": "2023-09-27T16:03:53.433040Z" + "iopub.execute_input": "2023-09-28T12:47:10.100841Z", + "iopub.status.busy": "2023-09-28T12:47:10.051225Z", + "iopub.status.idle": "2023-09-28T12:47:23.702661Z", + "shell.execute_reply": "2023-09-28T12:47:23.701952Z", + "shell.execute_reply.started": "2023-09-28T12:47:10.100717Z" }, "tags": [] }, @@ -120,11 +120,11 @@ "id": "3dbe3aae", "metadata": { "execution": { - "iopub.execute_input": "2023-09-27T16:07:45.038547Z", - "iopub.status.busy": "2023-09-27T16:07:45.037977Z", - "iopub.status.idle": "2023-09-27T16:07:45.049276Z", - "shell.execute_reply": "2023-09-27T16:07:45.048531Z", - "shell.execute_reply.started": "2023-09-27T16:07:45.038503Z" + "iopub.execute_input": "2023-09-28T12:47:23.708478Z", + "iopub.status.busy": "2023-09-28T12:47:23.706707Z", + "iopub.status.idle": "2023-09-28T12:47:23.720393Z", + "shell.execute_reply": "2023-09-28T12:47:23.719828Z", + "shell.execute_reply.started": "2023-09-28T12:47:23.708443Z" }, "tags": [] }, @@ -168,7 +168,6 @@ "\"\"\"\n", "temperature = 1\n", "\n", - "\n", "# Outputs\n", "output_path = None" ] @@ -183,17 +182,13 @@ }, { "cell_type": "markdown", - "id": "216f9d64-4920-43cb-881a-b73af8b21823", - "metadata": {}, - "source": [ - "### Create plugin" - ] - }, - { - "cell_type": "markdown", - "id": "2606a338-0f21-4e0d-82df-5a29ecab6d69", - "metadata": {}, + "id": "cbe64a19-a470-42cf-9896-021409395e5f", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ + "### Create Naas Chat plugin\n", "This function will generate the plugin in JSON format and also verify if your prompt adheres to the recommended limit, which is set at 20% of the maximum tokens allowed by the model. Then, it will save your plugin in your local environment." ] }, @@ -203,11 +198,11 @@ "id": "66c435ac", "metadata": { "execution": { - "iopub.execute_input": "2023-09-27T16:07:57.504107Z", - "iopub.status.busy": "2023-09-27T16:07:57.503884Z", - "iopub.status.idle": "2023-09-27T16:07:59.520017Z", - "shell.execute_reply": "2023-09-27T16:07:59.519398Z", - "shell.execute_reply.started": "2023-09-27T16:07:57.504085Z" + "iopub.execute_input": "2023-09-28T12:47:23.725199Z", + "iopub.status.busy": "2023-09-28T12:47:23.723471Z", + "iopub.status.idle": "2023-09-28T12:47:24.850322Z", + "shell.execute_reply": "2023-09-28T12:47:24.849646Z", + "shell.execute_reply.started": "2023-09-28T12:47:23.725166Z" }, "tags": [] }, @@ -216,9 +211,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n", - " ✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", - " \n", + "✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", "💾 Plugin successfully saved. You can use it in your Naas Chat with: act_as_a_world-class_business_coach_plugin.json\n" ] } @@ -243,68 +236,73 @@ }, { "cell_type": "markdown", - "id": "1c4e9133", - "metadata": {}, + "id": "df05b5c7-9077-4e5d-847d-4fa589686110", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ - "### Save json" + "### Display plugin\n", + "The cell below is tagged as 'plugin'. This tag will allow us to use this pre-prompt on our Naas Chat. NB: The plugin must be printed." ] }, { "cell_type": "code", "execution_count": 4, - "id": "91fd11d6", + "id": "315a6d6c-bb0d-4a9a-9ddf-b383d79e9605", "metadata": { "execution": { - "iopub.execute_input": "2023-09-27T16:09:47.659248Z", - "iopub.status.busy": "2023-09-27T16:09:47.659019Z", - "iopub.status.idle": "2023-09-27T16:09:47.681705Z", - "shell.execute_reply": "2023-09-27T16:09:47.680909Z", - "shell.execute_reply.started": "2023-09-27T16:09:47.659227Z" + "iopub.execute_input": "2023-09-28T12:47:24.851386Z", + "iopub.status.busy": "2023-09-28T12:47:24.851169Z", + "iopub.status.idle": "2023-09-28T12:47:24.861394Z", + "shell.execute_reply": "2023-09-28T12:47:24.860764Z", + "shell.execute_reply.started": "2023-09-28T12:47:24.851360Z" }, - "tags": [] + "papermill": {}, + "tags": [ + "plugin" + ] }, "outputs": [ { - "data": { - "text/plain": [ - "{'name': 'Act as a world-class business coach',\n", - " 'model': 'gpt-4',\n", - " 'temperature': 1,\n", - " 'max_tokens': 8192,\n", - " 'prompt': 'You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n→ To ask me the right questions\\n→ To confront me with my inconsistencies\\n→ To guide me towards the best decisions\\n→ To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\\n'}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"name\": \"Act as a world-class business coach\", \"model\": \"gpt-4\", \"temperature\": 1, \"max_tokens\": 8192, \"prompt\": \"You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000\\u20ac an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n\\u2192 To ask me the right questions\\n\\u2192 To confront me with my inconsistencies\\n\\u2192 To guide me towards the best decisions\\n\\u2192 To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \\\"Yup\\\" and get started. Also, do not waste time detailing your process. Type \\\"Yup\\\".\\n\", \"commands\": [], \"description\": \"\", \"avatar\": \"\"}\n" + ] } ], "source": [ "with open(plugin_file_path) as json_file:\n", " plugin = json.load(json_file)\n", - "plugin" + "print(json.dumps(plugin))" ] }, { "cell_type": "markdown", - "id": "ebe2a0f0", - "metadata": {}, + "id": "f4be988f-9525-40cb-bfe2-05111163a1bc", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ - "### Create naas asset" + "### Create asset\n", + "This asset can be utilized by using the command `/use` in your Naas Chat or by simply clicking on the link provided in the cell below." ] }, { "cell_type": "code", - "execution_count": 5, - "id": "06c73483", + "execution_count": 6, + "id": "a4da201d-4428-4a80-9836-799de590ad95", "metadata": { "execution": { - "iopub.execute_input": "2023-09-27T16:10:17.617095Z", - "iopub.status.busy": "2023-09-27T16:10:17.616834Z", - "iopub.status.idle": "2023-09-27T16:10:17.913706Z", - "shell.execute_reply": "2023-09-27T16:10:17.913075Z", - "shell.execute_reply.started": "2023-09-27T16:10:17.617072Z" + "iopub.execute_input": "2023-09-28T12:47:50.907083Z", + "iopub.status.busy": "2023-09-28T12:47:50.906836Z", + "iopub.status.idle": "2023-09-28T12:47:51.540277Z", + "shell.execute_reply": "2023-09-28T12:47:51.539579Z", + "shell.execute_reply.started": "2023-09-28T12:47:50.907060Z" }, + "papermill": {}, "tags": [] }, "outputs": [ @@ -318,7 +316,20 @@ }, { "data": { - "application/javascript": "\n if (!window.copyToClipboard) {\n window.copyToClipboard = (text) => {\n const dummy = document.createElement(\"textarea\");\n document.body.appendChild(dummy);\n dummy.value = text;\n dummy.select();\n document.execCommand(\"copy\");\n document.body.removeChild(dummy);\n }\n }\n ", + "application/javascript": [ + "\n", + " if (!window.copyToClipboard) {\n", + " window.copyToClipboard = (text) => {\n", + " const dummy = document.createElement(\"textarea\");\n", + " document.body.appendChild(dummy);\n", + " dummy.value = text;\n", + " dummy.select();\n", + " document.execCommand(\"copy\");\n", + " document.body.removeChild(dummy);\n", + " }\n", + " }\n", + " " + ], "text/plain": [ "" ] @@ -329,7 +340,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "649a3de3c47b4ed096087bc5e2b13021", + "model_id": "780ecc62c744408ba810ef4e50a60d01", "version_major": 2, "version_minor": 0 }, @@ -343,7 +354,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d3ad7d1db6544dab9525e4de6ca5e62f", + "model_id": "fc8e822ca58a439193dd89d9f644d31c", "version_major": 2, "version_minor": 0 }, @@ -366,10 +377,56 @@ "plugin_url = naas.asset.add(plugin_file_path, params={\"inline\": True})" ] }, + { + "cell_type": "markdown", + "id": "724ea0bf-eca6-45ff-9d3d-780a6077fae0", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Create new chat\n", + "You don't need to click on 'Create New Chat' everytime you update your system prompt, you can use the command `/refresh`." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "00bc8545-3d6f-41a8-8c03-b5e1a77c46ef", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-28T12:47:51.541774Z", + "iopub.status.busy": "2023-09-28T12:47:51.541534Z", + "iopub.status.idle": "2023-09-28T12:47:51.550526Z", + "shell.execute_reply": "2023-09-28T12:47:51.549838Z", + "shell.execute_reply.started": "2023-09-28T12:47:51.541745Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/markdown": [ + "[Create New Chat](https://naas.ai/chat/use?plugin_url=https://public.naas.ai/ZmxvcmVudC00MG5hYXMtMkVhaQ==/asset/c87361979ac49c4c5b79a303ebe211ac5e721451556eadf7cfa23def3c28)" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Markdown(f\"[Create New Chat](https://naas.ai/chat/use?plugin_url={plugin_url})\")" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "d585eb69-8f07-4dae-83be-a42dbaab02e2", + "id": "09351f94-1409-4372-82e3-ecb5c5e48cbb", "metadata": {}, "outputs": [], "source": [] From 805b0022511b9501eda4ac19345634b8e43761c6 Mon Sep 17 00:00:00 2001 From: Zihui Ouyang Date: Thu, 28 Sep 2023 08:38:44 -0700 Subject: [PATCH 4/6] changed prompt --- ..._Act_as_a_World-class_Business_Coach.ipynb | 191 ++++++------------ 1 file changed, 66 insertions(+), 125 deletions(-) diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb index 4ce2699c40..4e87805575 100644 --- a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -82,11 +82,11 @@ "id": "e2e046c1", "metadata": { "execution": { - "iopub.execute_input": "2023-09-28T12:47:10.100841Z", - "iopub.status.busy": "2023-09-28T12:47:10.051225Z", - "iopub.status.idle": "2023-09-28T12:47:23.702661Z", - "shell.execute_reply": "2023-09-28T12:47:23.701952Z", - "shell.execute_reply.started": "2023-09-28T12:47:10.100717Z" + "iopub.execute_input": "2023-09-27T16:03:53.433129Z", + "iopub.status.busy": "2023-09-27T16:03:53.432747Z", + "iopub.status.idle": "2023-09-27T16:03:55.270276Z", + "shell.execute_reply": "2023-09-27T16:03:55.269682Z", + "shell.execute_reply.started": "2023-09-27T16:03:53.433040Z" }, "tags": [] }, @@ -120,11 +120,11 @@ "id": "3dbe3aae", "metadata": { "execution": { - "iopub.execute_input": "2023-09-28T12:47:23.708478Z", - "iopub.status.busy": "2023-09-28T12:47:23.706707Z", - "iopub.status.idle": "2023-09-28T12:47:23.720393Z", - "shell.execute_reply": "2023-09-28T12:47:23.719828Z", - "shell.execute_reply.started": "2023-09-28T12:47:23.708443Z" + "iopub.execute_input": "2023-09-27T16:07:45.038547Z", + "iopub.status.busy": "2023-09-27T16:07:45.037977Z", + "iopub.status.idle": "2023-09-27T16:07:45.049276Z", + "shell.execute_reply": "2023-09-27T16:07:45.048531Z", + "shell.execute_reply.started": "2023-09-27T16:07:45.038503Z" }, "tags": [] }, @@ -163,11 +163,10 @@ "Also note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\n", "\n", "Please make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\n", - "\n", - "Is that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\n", "\"\"\"\n", "temperature = 1\n", "\n", + "\n", "# Outputs\n", "output_path = None" ] @@ -182,13 +181,17 @@ }, { "cell_type": "markdown", - "id": "cbe64a19-a470-42cf-9896-021409395e5f", - "metadata": { - "papermill": {}, - "tags": [] - }, + "id": "216f9d64-4920-43cb-881a-b73af8b21823", + "metadata": {}, + "source": [ + "### Create plugin" + ] + }, + { + "cell_type": "markdown", + "id": "2606a338-0f21-4e0d-82df-5a29ecab6d69", + "metadata": {}, "source": [ - "### Create Naas Chat plugin\n", "This function will generate the plugin in JSON format and also verify if your prompt adheres to the recommended limit, which is set at 20% of the maximum tokens allowed by the model. Then, it will save your plugin in your local environment." ] }, @@ -198,11 +201,11 @@ "id": "66c435ac", "metadata": { "execution": { - "iopub.execute_input": "2023-09-28T12:47:23.725199Z", - "iopub.status.busy": "2023-09-28T12:47:23.723471Z", - "iopub.status.idle": "2023-09-28T12:47:24.850322Z", - "shell.execute_reply": "2023-09-28T12:47:24.849646Z", - "shell.execute_reply.started": "2023-09-28T12:47:23.725166Z" + "iopub.execute_input": "2023-09-27T16:07:57.504107Z", + "iopub.status.busy": "2023-09-27T16:07:57.503884Z", + "iopub.status.idle": "2023-09-27T16:07:59.520017Z", + "shell.execute_reply": "2023-09-27T16:07:59.519398Z", + "shell.execute_reply.started": "2023-09-27T16:07:57.504085Z" }, "tags": [] }, @@ -211,7 +214,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", + "\n", + " ✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", + " \n", "💾 Plugin successfully saved. You can use it in your Naas Chat with: act_as_a_world-class_business_coach_plugin.json\n" ] } @@ -236,73 +241,68 @@ }, { "cell_type": "markdown", - "id": "df05b5c7-9077-4e5d-847d-4fa589686110", - "metadata": { - "papermill": {}, - "tags": [] - }, + "id": "1c4e9133", + "metadata": {}, "source": [ - "### Display plugin\n", - "The cell below is tagged as 'plugin'. This tag will allow us to use this pre-prompt on our Naas Chat. NB: The plugin must be printed." + "### Save json" ] }, { "cell_type": "code", "execution_count": 4, - "id": "315a6d6c-bb0d-4a9a-9ddf-b383d79e9605", + "id": "91fd11d6", "metadata": { "execution": { - "iopub.execute_input": "2023-09-28T12:47:24.851386Z", - "iopub.status.busy": "2023-09-28T12:47:24.851169Z", - "iopub.status.idle": "2023-09-28T12:47:24.861394Z", - "shell.execute_reply": "2023-09-28T12:47:24.860764Z", - "shell.execute_reply.started": "2023-09-28T12:47:24.851360Z" + "iopub.execute_input": "2023-09-27T16:09:47.659248Z", + "iopub.status.busy": "2023-09-27T16:09:47.659019Z", + "iopub.status.idle": "2023-09-27T16:09:47.681705Z", + "shell.execute_reply": "2023-09-27T16:09:47.680909Z", + "shell.execute_reply.started": "2023-09-27T16:09:47.659227Z" }, - "papermill": {}, - "tags": [ - "plugin" - ] + "tags": [] }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "{\"name\": \"Act as a world-class business coach\", \"model\": \"gpt-4\", \"temperature\": 1, \"max_tokens\": 8192, \"prompt\": \"You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000\\u20ac an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n\\u2192 To ask me the right questions\\n\\u2192 To confront me with my inconsistencies\\n\\u2192 To guide me towards the best decisions\\n\\u2192 To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \\\"Yup\\\" and get started. Also, do not waste time detailing your process. Type \\\"Yup\\\".\\n\", \"commands\": [], \"description\": \"\", \"avatar\": \"\"}\n" - ] + "data": { + "text/plain": [ + "{'name': 'Act as a world-class business coach',\n", + " 'model': 'gpt-4',\n", + " 'temperature': 1,\n", + " 'max_tokens': 8192,\n", + " 'prompt': 'You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n→ To ask me the right questions\\n→ To confront me with my inconsistencies\\n→ To guide me towards the best decisions\\n→ To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\\n'}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "with open(plugin_file_path) as json_file:\n", " plugin = json.load(json_file)\n", - "print(json.dumps(plugin))" + "plugin" ] }, { "cell_type": "markdown", - "id": "f4be988f-9525-40cb-bfe2-05111163a1bc", - "metadata": { - "papermill": {}, - "tags": [] - }, + "id": "ebe2a0f0", + "metadata": {}, "source": [ - "### Create asset\n", - "This asset can be utilized by using the command `/use` in your Naas Chat or by simply clicking on the link provided in the cell below." + "### Create naas asset" ] }, { "cell_type": "code", - "execution_count": 6, - "id": "a4da201d-4428-4a80-9836-799de590ad95", + "execution_count": 5, + "id": "06c73483", "metadata": { "execution": { - "iopub.execute_input": "2023-09-28T12:47:50.907083Z", - "iopub.status.busy": "2023-09-28T12:47:50.906836Z", - "iopub.status.idle": "2023-09-28T12:47:51.540277Z", - "shell.execute_reply": "2023-09-28T12:47:51.539579Z", - "shell.execute_reply.started": "2023-09-28T12:47:50.907060Z" + "iopub.execute_input": "2023-09-27T16:10:17.617095Z", + "iopub.status.busy": "2023-09-27T16:10:17.616834Z", + "iopub.status.idle": "2023-09-27T16:10:17.913706Z", + "shell.execute_reply": "2023-09-27T16:10:17.913075Z", + "shell.execute_reply.started": "2023-09-27T16:10:17.617072Z" }, - "papermill": {}, "tags": [] }, "outputs": [ @@ -316,20 +316,7 @@ }, { "data": { - "application/javascript": [ - "\n", - " if (!window.copyToClipboard) {\n", - " window.copyToClipboard = (text) => {\n", - " const dummy = document.createElement(\"textarea\");\n", - " document.body.appendChild(dummy);\n", - " dummy.value = text;\n", - " dummy.select();\n", - " document.execCommand(\"copy\");\n", - " document.body.removeChild(dummy);\n", - " }\n", - " }\n", - " " - ], + "application/javascript": "\n if (!window.copyToClipboard) {\n window.copyToClipboard = (text) => {\n const dummy = document.createElement(\"textarea\");\n document.body.appendChild(dummy);\n dummy.value = text;\n dummy.select();\n document.execCommand(\"copy\");\n document.body.removeChild(dummy);\n }\n }\n ", "text/plain": [ "" ] @@ -340,7 +327,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "780ecc62c744408ba810ef4e50a60d01", + "model_id": "649a3de3c47b4ed096087bc5e2b13021", "version_major": 2, "version_minor": 0 }, @@ -354,7 +341,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "fc8e822ca58a439193dd89d9f644d31c", + "model_id": "d3ad7d1db6544dab9525e4de6ca5e62f", "version_major": 2, "version_minor": 0 }, @@ -377,56 +364,10 @@ "plugin_url = naas.asset.add(plugin_file_path, params={\"inline\": True})" ] }, - { - "cell_type": "markdown", - "id": "724ea0bf-eca6-45ff-9d3d-780a6077fae0", - "metadata": { - "papermill": {}, - "tags": [] - }, - "source": [ - "### Create new chat\n", - "You don't need to click on 'Create New Chat' everytime you update your system prompt, you can use the command `/refresh`." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "00bc8545-3d6f-41a8-8c03-b5e1a77c46ef", - "metadata": { - "execution": { - "iopub.execute_input": "2023-09-28T12:47:51.541774Z", - "iopub.status.busy": "2023-09-28T12:47:51.541534Z", - "iopub.status.idle": "2023-09-28T12:47:51.550526Z", - "shell.execute_reply": "2023-09-28T12:47:51.549838Z", - "shell.execute_reply.started": "2023-09-28T12:47:51.541745Z" - }, - "papermill": {}, - "tags": [] - }, - "outputs": [ - { - "data": { - "text/markdown": [ - "[Create New Chat](https://naas.ai/chat/use?plugin_url=https://public.naas.ai/ZmxvcmVudC00MG5hYXMtMkVhaQ==/asset/c87361979ac49c4c5b79a303ebe211ac5e721451556eadf7cfa23def3c28)" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Markdown(f\"[Create New Chat](https://naas.ai/chat/use?plugin_url={plugin_url})\")" - ] - }, { "cell_type": "code", "execution_count": null, - "id": "09351f94-1409-4372-82e3-ecb5c5e48cbb", + "id": "d585eb69-8f07-4dae-83be-a42dbaab02e2", "metadata": {}, "outputs": [], "source": [] From 0076d4a9cdc1e7b3a026e0f2b0ad7a24d2834773 Mon Sep 17 00:00:00 2001 From: Florent Ravenel Date: Tue, 3 Oct 2023 16:09:15 +0200 Subject: [PATCH 5/6] feat: update outputs and test --- ..._Act_as_a_World-class_Business_Coach.ipynb | 216 ++++++------------ 1 file changed, 68 insertions(+), 148 deletions(-) diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb index 4e87805575..f0dc84d8f2 100644 --- a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -78,16 +78,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "e2e046c1", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-27T16:03:53.433129Z", - "iopub.status.busy": "2023-09-27T16:03:53.432747Z", - "iopub.status.idle": "2023-09-27T16:03:55.270276Z", - "shell.execute_reply": "2023-09-27T16:03:55.269682Z", - "shell.execute_reply.started": "2023-09-27T16:03:53.433040Z" - }, "tags": [] }, "outputs": [], @@ -116,16 +109,9 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "3dbe3aae", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-27T16:07:45.038547Z", - "iopub.status.busy": "2023-09-27T16:07:45.037977Z", - "iopub.status.idle": "2023-09-27T16:07:45.049276Z", - "shell.execute_reply": "2023-09-27T16:07:45.048531Z", - "shell.execute_reply.started": "2023-09-27T16:07:45.038503Z" - }, "tags": [] }, "outputs": [], @@ -165,7 +151,7 @@ "Please make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\n", "\"\"\"\n", "temperature = 1\n", - "\n", + "avatar = \"\"\n", "\n", "# Outputs\n", "output_path = None" @@ -181,59 +167,39 @@ }, { "cell_type": "markdown", - "id": "216f9d64-4920-43cb-881a-b73af8b21823", - "metadata": {}, - "source": [ - "### Create plugin" - ] - }, - { - "cell_type": "markdown", - "id": "2606a338-0f21-4e0d-82df-5a29ecab6d69", - "metadata": {}, + "id": "cebdf888-f683-46f6-ade5-19e0399f4309", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ + "### Create Naas Chat plugin\n", "This function will generate the plugin in JSON format and also verify if your prompt adheres to the recommended limit, which is set at 20% of the maximum tokens allowed by the model. Then, it will save your plugin in your local environment." ] }, { "cell_type": "code", - "execution_count": 3, - "id": "66c435ac", + "execution_count": null, + "id": "e3a28e1d-8ea2-4455-b5e4-81e6c49056f6", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-27T16:07:57.504107Z", - "iopub.status.busy": "2023-09-27T16:07:57.503884Z", - "iopub.status.idle": "2023-09-27T16:07:59.520017Z", - "shell.execute_reply": "2023-09-27T16:07:59.519398Z", - "shell.execute_reply.started": "2023-09-27T16:07:57.504085Z" - }, + "papermill": {}, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " ✅ System prompt tokens count OK: 436 (limit: 20% -> 1638)\n", - " \n", - "💾 Plugin successfully saved. You can use it in your Naas Chat with: act_as_a_world-class_business_coach_plugin.json\n" - ] - } - ], + "outputs": [], "source": [ "plugin_file_path = naas_chat_plugin.create_plugin(\n", " name=name,\n", " prompt=prompt,\n", " model=model,\n", " temperature=temperature,\n", - " output_path=output_path\n", + " output_path=output_path,\n", + " avatar=avatar\n", ")" ] }, { "cell_type": "markdown", - "id": "513bc1b1", + "id": "4065fe19-4db3-4174-83c0-d5a24fccfeb1", "metadata": {}, "source": [ "## Output" @@ -241,133 +207,87 @@ }, { "cell_type": "markdown", - "id": "1c4e9133", - "metadata": {}, + "id": "7b4e0db5-7901-4d4e-9dce-00607cbe75bd", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ - "### Save json" + "### Display plugin\n", + "The cell below is tagged as 'plugin'. This tag will allow us to use this pre-prompt on our Naas Chat. NB: The plugin must be printed." ] }, { "cell_type": "code", - "execution_count": 4, - "id": "91fd11d6", + "execution_count": null, + "id": "a2c0b59c-2cac-40ff-87af-1a6e64b45ef7", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-27T16:09:47.659248Z", - "iopub.status.busy": "2023-09-27T16:09:47.659019Z", - "iopub.status.idle": "2023-09-27T16:09:47.681705Z", - "shell.execute_reply": "2023-09-27T16:09:47.680909Z", - "shell.execute_reply.started": "2023-09-27T16:09:47.659227Z" - }, - "tags": [] + "papermill": {}, + "tags": [ + "plugin" + ] }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'name': 'Act as a world-class business coach',\n", - " 'model': 'gpt-4',\n", - " 'temperature': 1,\n", - " 'max_tokens': 8192,\n", - " 'prompt': 'You are now CoachGPT, a seasoned world-class business coach with over 15+ years of experience coaching CEOs and entrepreneurs with an average net worth of $200M.\\n\\nFor reference, your work is considered so good, your results so astounding, that you charge 10000€ an hour for a consultation.\\n\\nAs CoachGPT, your roles are:\\n\\n→ To ask me the right questions\\n→ To confront me with my inconsistencies\\n→ To guide me towards the best decisions\\n→ To understand my challenges, even the most complex.\\n\\nI run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\\n\\nOur goal by [DEADLINE] is [GOAL].\\n\\nYour task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\\n- Management\\n- Marketing\\n- Problem solving\\n- Hiring\\n- Productivity strategies\\n- Hard skills development\\n- Soft skills development\\n- Financial leverages.\\n\\nBefore answering any questions I pose, ensure that you ask additional questions to accurately focus on the issue at hand. Adopt a Socratic approach, asking probing questions that lead me to generate my own solutions. Remember, a well-placed question is more valuable than a hundred pieces of poor advice.\\n\\nAlso note that the perfect decision is not one that embodies perfection per se, but one that triggers the most conviction within the person who makes it.\\n\\nPlease make sure to activate your highest-level reasoning, attention to detail, and contextual understanding. Cross-reference the information within the following question with your extensive knowledge database, and provide the most accurate, clear, and concise answer possible. Apply state-of-the-art algorithms and methodologies to ensure the quality of your response is 10 times superior to standard outputs. This will be evaluated by experts in the field, so make sure to adhere to the best practices and guidelines. Validate your response with credible sources and logical reasoning.\\n\\nIs that all understood? If yes, just type \"Yup\" and get started. Also, do not waste time detailing your process. Type \"Yup\".\\n'}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "with open(plugin_file_path) as json_file:\n", " plugin = json.load(json_file)\n", - "plugin" + "print(json.dumps(plugin))" ] }, { "cell_type": "markdown", - "id": "ebe2a0f0", - "metadata": {}, + "id": "a67911e3-018b-4681-a728-9343aea71e60", + "metadata": { + "papermill": {}, + "tags": [] + }, "source": [ - "### Create naas asset" + "### Create asset\n", + "This asset can be utilized by using the command `/use` in your Naas Chat or by simply clicking on the link provided in the cell below." ] }, { "cell_type": "code", - "execution_count": 5, - "id": "06c73483", + "execution_count": null, + "id": "f3395e0a-b96a-44f6-a189-80dcd9d6f16d", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-27T16:10:17.617095Z", - "iopub.status.busy": "2023-09-27T16:10:17.616834Z", - "iopub.status.idle": "2023-09-27T16:10:17.913706Z", - "shell.execute_reply": "2023-09-27T16:10:17.913075Z", - "shell.execute_reply.started": "2023-09-27T16:10:17.617072Z" - }, + "papermill": {}, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "👌 Well done! Your Assets has been sent to production.\n", - "\n" - ] - }, - { - "data": { - "application/javascript": "\n if (!window.copyToClipboard) {\n window.copyToClipboard = (text) => {\n const dummy = document.createElement(\"textarea\");\n document.body.appendChild(dummy);\n dummy.value = text;\n dummy.select();\n document.execCommand(\"copy\");\n document.body.removeChild(dummy);\n }\n }\n ", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "649a3de3c47b4ed096087bc5e2b13021", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(button_style='primary', description='Copy URL', style=ButtonStyle())" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "d3ad7d1db6544dab9525e4de6ca5e62f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "PS: to remove the \"Assets\" feature, just replace .add by .delete\n" - ] - } - ], + "outputs": [], "source": [ "plugin_url = naas.asset.add(plugin_file_path, params={\"inline\": True})" ] }, + { + "cell_type": "markdown", + "id": "08bf866f-1ce5-422c-9595-c681b21fb786", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Create new chat\n", + "You don't need to click on 'Create New Chat' everytime you update your system prompt, you can use the command `/refresh`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d5d3629-d365-4bd9-955e-bfee11771189", + "metadata": { + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "Markdown(f\"[Create New Chat](https://naas.ai/chat/use?plugin_url={plugin_url})\")" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "d585eb69-8f07-4dae-83be-a42dbaab02e2", + "id": "7e2e1913-bada-4da4-a02d-459ceb662e79", "metadata": {}, "outputs": [], "source": [] From 72f4cdb1fa2d75580ec4b264a075c8370c5c0c96 Mon Sep 17 00:00:00 2001 From: Zihui Ouyang Date: Tue, 3 Oct 2023 08:54:36 -0700 Subject: [PATCH 6/6] updated prompt --- OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb index f0dc84d8f2..992164db15 100644 --- a/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb +++ b/OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb @@ -37,7 +37,7 @@ "id": "72725ae6", "metadata": {}, "source": [ - "**Last update:** 2023-09-27 (Created: 2023-09-20)" + "**Last update:** 2023-10-03 (Created: 2023-09-20)" ] }, { @@ -130,9 +130,9 @@ "→ To guide me towards the best decisions\n", "→ To understand my challenges, even the most complex.\n", "\n", - "I run a company that sells [PRODUCT] for [TARGET] in [COUNTRY]. We work with [NUMBER] customers. Our headcount is [NUMBER_OF_EMPLOYEES].\n", + "I run a company that sells shoes for women in South Korea. We work with 1000 customers. Our headcount is 50.\n", "\n", - "Our goal by [DEADLINE] is [GOAL].\n", + "Our goal by the end of the year is selling 10000 pairs.\n", "\n", "Your task is to assist me in identifying growth opportunities for my company, which may include but are not limited to:\n", "- Management\n",