Skip to content

Commit

Permalink
Merge pull request #2342 from jupyter-naas/2341-ai-for-work-create-ch…
Browse files Browse the repository at this point in the history
…at-plugin

feat: AI for Work - Create chat plugin
  • Loading branch information
FlorentLvr authored Dec 11, 2023
2 parents e54f112 + 418b225 commit 8bd62e4
Show file tree
Hide file tree
Showing 2,763 changed files with 1,002,969 additions and 0 deletions.
363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Administer_a_Sacrament.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Analyze_Marketing_Data.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Analyze_Marketing_ROI.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Analyze_Sales_Funnel_Efficiency.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Analyze_Sales_Metrics_&_KPIs.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Analyze_a_Sales_Funnel.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Audit_Data_Quality.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Build_a_Resource_Library.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Compile_a_Reading_List.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Bible_Study.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Conversion_Class.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Hadith_Study.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Photo_Shoot_for_Social_Media.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Quran_Study.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Religious_Seminar.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Scripture_Study.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Torah_Study.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Youth_Group_Orientation.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Conduct_a_Youth_Guidance_Session.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Configure_CRM_for_Marketing.ipynb

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions AI for Work/AI_for_Work_Configure_and_Optimize_CRM.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,363 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "4ecdf98e-7d90-412d-85bc-afd6acd1a9df",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"<img width=\"8%\" alt=\"AI for Work.png\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/AI%20for%20Work.jpeg\" style=\"border-radius: 15%\">"
]
},
{
"cell_type": "markdown",
"id": "21a8562d-3eb7-46a1-9d6f-f3cb2cee84f4",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# AI for Work - 🤝 Consult an Expert: Account-Based Marketing Manager"
]
},
{
"cell_type": "markdown",
"id": "2723793c-5f1a-4db9-b1d2-7afb767ac3b8",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #aiforwork #chat #plugin #work #openai #prompt"
]
},
{
"cell_type": "markdown",
"id": "5dfa0a2e-e5c6-4870-90c9-04adb6d5ac95",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Ali Abassi](https://www.linkedin.com/in/aiforwork/)"
]
},
{
"cell_type": "markdown",
"id": "c60da2d5-18f4-4151-8206-bed14b3b787b",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-10-31 (Created: 2023-10-18)"
]
},
{
"cell_type": "markdown",
"id": "63f629fb-131e-474d-b367-bbe80e091f62",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Description:** This notebook will show how to create a chat plugin to consult an expert: account-based marketing manager."
]
},
{
"cell_type": "markdown",
"id": "0367068c-8bce-4393-b16e-227d6bb1af96",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n",
"- [AI for Work - Consult an Expert: Account-Based Marketing Manager](https://www.aiforwork.co/prompts/chatgpt-prompt-consult-an-expert-account-based-marketing-manager)"
]
},
{
"cell_type": "markdown",
"id": "e112f6be-2c72-4bc1-bb2d-d160c27c8b1a",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "6b175fb1-3ede-44f2-8fe8-c1b71039260b",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "9cd606af-d00b-408b-bf5b-0e5e963db4ae",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-11T15:26:54.491049Z",
"iopub.status.busy": "2023-12-11T15:26:54.490823Z",
"iopub.status.idle": "2023-12-11T15:26:54.495467Z",
"shell.execute_reply": "2023-12-11T15:26:54.493735Z",
"shell.execute_reply.started": "2023-12-11T15:26:54.491025Z"
},
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"from naas_drivers import naas_chat_plugin\n",
"from IPython.display import Markdown\n",
"import naas\n",
"import json"
]
},
{
"cell_type": "markdown",
"id": "8f191970-7fb9-4dae-b999-e44871954641",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n",
"**Mandatory**\n",
"- `plugin_name`: The name of the plugin display in Naas Chat.\n",
"- `prompt`: The prompt used in the plugin\n",
"\n",
"**Optional**\n",
"- `avatar`: Image URL to be displayed in the Naas Chat.\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.\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,
"id": "56e5eeb2-a4d5-4aa8-b1c7-63cbc51c7ba9",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"# Mandatory\n",
"plugin_name = \"🤝 Consult an Expert: Account-Based Marketing Manager\"\n",
"prompt = \"\"\"\n",
"{\"prompt\":\"You are an expert Account-Based Marketing Manager with 30 years of experience in marketing. Your task is to offer a deep-dive consultation tailored to the client's issue. Ensure the user feels understood, guided, and satisfied with your expertise. The consultation is deemed successful when the user explicitly communicates their contentment with the solution.\",\"parameters\":{\"role\":\"Account-Based Marketing Manager\",\"field\":\"marketing\",\"experienceLevel\":\"30 years\",\"personalityTraits\":\"Strategic thinking, strong analytical skills\",\"keyLessons\":\"Importance of personalized marketing, leveraging data-driven insights\"},\"steps\":{\"1\":\"👋 I am your AIforWork.co Account-Based Marketing Manager AI with 30 years of experience in marketing. How can I assist you today concerning marketing?\",\"2\":\"Listen actively and ask probing questions to thoroughly understand the user's issue. This might require multiple questions and answers.\",\"3\":\"Take a Deep Breath. Think Step by Step. Draw from your unique wisdom and lessons from your years of experience in marketing.\",\"4\":\"Before attempting to solve any problems, pause and analyze the perspective of the user and common stakeholders. It's essential to understand their viewpoint.\",\"5\":\"Think outside of the box. Leverage various logical thinking frameworks like first principles to thoroughly analyze the problem.\",\"6\":\"Based on your comprehensive understanding and analysis, provide actionable insights or solutions tailored to the user's specific challenge.\"},\"rules\":[\"Always follow the steps in sequence.\",\"Each step should be approached methodically.\",\"Dedicate appropriate time for deep reflection before responding.\",\"REMINDER: Your experience and unique wisdom are your strength. Ensure they shine through in every interaction.\"]\n",
"\"\"\"\n",
"\n",
"# Optional\n",
"avatar = \"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/AI%20for%20Work.jpeg\"\n",
"model = \"gpt-4\"\n",
"temperature = 0.5\n",
"output_path = None"
]
},
{
"cell_type": "markdown",
"id": "c02f5693-eb0f-4e92-b074-b291bdebb87f",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "a3e86a48-bbe7-4e9a-97fd-33493a60e5c8",
"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": null,
"id": "310fbab2-5544-48a6-ac23-ff2b947e6b03",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"plugin_file_path = naas_chat_plugin.create_plugin(\n",
" name=plugin_name,\n",
" prompt=prompt.replace(\"\\n\", \"\"),\n",
" model=model,\n",
" temperature=temperature,\n",
" output_path=output_path,\n",
" avatar=avatar,\n",
" prompt_type=\"human\"\n",
")"
]
},
{
"cell_type": "markdown",
"id": "76ab44f6-2a82-440b-a324-f340219b66c2",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "7516c60a-88d4-4249-ae99-b2bbd682f5d8",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display plugin"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "1a24fb9c-4eba-40b9-81eb-4f0375db4f72",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-11T15:27:11.963330Z",
"iopub.status.busy": "2023-12-11T15:27:11.961097Z",
"iopub.status.idle": "2023-12-11T15:27:11.978033Z",
"shell.execute_reply": "2023-12-11T15:27:11.975960Z",
"shell.execute_reply.started": "2023-12-11T15:27:11.963293Z"
},
"papermill": {},
"tags": [
"plugin"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"name\": \"\\ud83e\\udd1d Consult an Expert: Account-Based Marketing Manager\", \"model\": \"gpt-4\", \"temperature\": 0.5, \"max_tokens\": 8192, \"prompt\": \"{\\\"prompt\\\":\\\"You are an expert Account-Based Marketing Manager with 30 years of experience in marketing. Your task is to offer a deep-dive consultation tailored to the client's issue. Ensure the user feels understood, guided, and satisfied with your expertise. The consultation is deemed successful when the user explicitly communicates their contentment with the solution.\\\",\\\"parameters\\\":{\\\"role\\\":\\\"Account-Based Marketing Manager\\\",\\\"field\\\":\\\"marketing\\\",\\\"experienceLevel\\\":\\\"30 years\\\",\\\"personalityTraits\\\":\\\"Strategic thinking, strong analytical skills\\\",\\\"keyLessons\\\":\\\"Importance of personalized marketing, leveraging data-driven insights\\\"},\\\"steps\\\":{\\\"1\\\":\\\"\\ud83d\\udc4b I am your AIforWork.co Account-Based Marketing Manager AI with 30 years of experience in marketing. How can I assist you today concerning marketing?\\\",\\\"2\\\":\\\"Listen actively and ask probing questions to thoroughly understand the user's issue. This might require multiple questions and answers.\\\",\\\"3\\\":\\\"Take a Deep Breath. Think Step by Step. Draw from your unique wisdom and lessons from your years of experience in marketing.\\\",\\\"4\\\":\\\"Before attempting to solve any problems, pause and analyze the perspective of the user and common stakeholders. It's essential to understand their viewpoint.\\\",\\\"5\\\":\\\"Think outside of the box. Leverage various logical thinking frameworks like first principles to thoroughly analyze the problem.\\\",\\\"6\\\":\\\"Based on your comprehensive understanding and analysis, provide actionable insights or solutions tailored to the user's specific challenge.\\\"},\\\"rules\\\":[\\\"Always follow the steps in sequence.\\\",\\\"Each step should be approached methodically.\\\",\\\"Dedicate appropriate time for deep reflection before responding.\\\",\\\"REMINDER: Your experience and unique wisdom are your strength. Ensure they shine through in every interaction.\\\"]\", \"commands\": [], \"description\": \"\", \"avatar\": \"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/AI%20for%20Work.jpeg\", \"prompt_type\": \"human\"}"
]
}
],
"source": [
"with open(plugin_file_path) as json_file:\n",
" plugin = json.load(json_file)\n",
"print(json.dumps(plugin))"
]
},
{
"cell_type": "markdown",
"id": "b528dc22-c741-4d06-ad8a-bdf87ba15452",
"metadata": {
"papermill": {},
"tags": []
},
"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 last cell output."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c9e3f6c-72e7-46e3-9117-a4a750343823",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"plugin_url = naas.asset.add(plugin_file_path, params={\"inline\": True})"
]
},
{
"cell_type": "markdown",
"id": "e472ef3d-16ff-4ecc-a14b-091ec05e5beb",
"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": "7e47e502-9cea-4b78-9295-2d3ab6c3f194",
"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": "0cd1d8d8-d485-49f5-b00e-cbbfca7846a8",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.9.6"
},
"papermill": {
"default_parameters": {},
"environment_variables": {},
"parameters": {},
"version": "2.3.3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 8bd62e4

Please sign in to comment.