Skip to content

Commit

Permalink
feat: rework template
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Sep 28, 2023
1 parent 5f414ef commit 4d54a5f
Showing 1 changed file with 123 additions and 66 deletions.
189 changes: 123 additions & 66 deletions OpenAI/OpenAI_Act_as_a_World-class_Business_Coach.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
},
Expand Down Expand Up @@ -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": []
},
Expand Down Expand Up @@ -168,7 +168,6 @@
"\"\"\"\n",
"temperature = 1\n",
"\n",
"\n",
"# Outputs\n",
"output_path = None"
]
Expand All @@ -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."
]
},
Expand All @@ -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": []
},
Expand All @@ -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"
]
}
Expand All @@ -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": [
Expand All @@ -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": [
"<IPython.core.display.Javascript object>"
]
Expand All @@ -329,7 +340,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "649a3de3c47b4ed096087bc5e2b13021",
"model_id": "780ecc62c744408ba810ef4e50a60d01",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -343,7 +354,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d3ad7d1db6544dab9525e4de6ca5e62f",
"model_id": "fc8e822ca58a439193dd89d9f644d31c",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -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": [
"<IPython.core.display.Markdown object>"
]
},
"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": []
Expand Down

0 comments on commit 4d54a5f

Please sign in to comment.