-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
2,373 additions
and
1,120 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"hash": "5ce34d344b5301714789bde7fc69ad92", | ||
"result": { | ||
"engine": "jupyter", | ||
"markdown": "---\ntitle: \"Projects: Large Language Models\"\nformat: \n revealjs:\n theme: default\n chalkboard: true\n footer: \"Sprint: LLM, 2024\"\n logo: ../../assets/logo.svg\n---\n\n# How to develop an app with a language model\n\n## What do I have to keep in mind?\n\n## What can go wrong? \n\n## What do I need?\n\n\n# Project ideas\n\n## Question-Answering Chatbot \nBuild a chatbot that can answer questions posed by users on a specific topic provided in form of documents. Users input their questions, the chatbot retrieves relevant information from a pre-defined set of documents, and uses the information to answer the question.\n\n## Document tagging / classification \nUse GPT and its tools (e.g., function calls) and/or embeddings to classify documents or assign tags to them. Example: Sort bug reports or complaints into categories depending on the problem.\n\n## Clustering of text-based entities \nCreate a small tool that can cluster text-based entities based on embeddings, for example, groups of texts or keywords. Example: Structure a folder of text files based on their content.\n\n## Text-based RPG Game\nDevelop a text-based role-playing game where players interact with characters and navigate through a story generated by GPT. Players make choices that influence the direction of the narrative.\n\n## Sentiment Analysis Tool\nBuild an app that analyzes the sentiment of text inputs (e.g., social media posts, customer reviews) using GPT. Users can input text, and the app provides insights into the overall sentiment expressed in the text.\n\n## Text Summarization Tool \nCreate an application that summarizes long blocks of text into shorter, concise summaries. Users can input articles, essays, or documents, and the tool generates a summarized version.\n\n## Language Translation Tool \nBuild a simple translation app that utilizes GPT to translate text between different languages. Users can input text in one language, and the app outputs the translated text in the desired language. Has to include some nice tweaks.\n\n## Personalized Recipe Generator \nDevelop an app that generates personalized recipes based on user preferences and dietary restrictions. Users input their preferred ingredients and dietary needs, and the app generates custom recipes using GPT.\n\n## Lyrics Generator \nCreate a lyrics generation tool that generates lyrics based on user input such as themes, music style, emotions, or keywords. Users can explore different poetic styles and themes generated by GPT.\n\n# How to build you app\n\n## Tools \n\n- You can use everything in the Jupyterlab (put `pip list` in a terminal to see all Python packages)\n- If there are specific packages you need, we can organize them\n- You can simply build your application in a Jupyter notebook!\n- Or: Use **Dash**!\n\n\n## Dash \nPut the following files into your home in the Jupyterlab: \n\n`my_layout.py`\n\n::: {#8de0cf53 .cell execution_count=1}\n``` {.python .cell-code}\nfrom dash import html\nfrom dash import dcc\n\n\nlayout = html.Div([\n html.H1(\"Yeay, my app!\"),\n html.Div([\n html.Label(\"Enter your text:\"),\n dcc.Input(id='input-text', type='text', value=''),\n html.Button('Submit', id='submit-btn', n_clicks=0),\n ]),\n html.Div(id='output-container-button')\n])\n```\n:::\n\n\n--- \n\n`my_callbacks.py`\n\n::: {#bafd904a .cell execution_count=2}\n``` {.python .cell-code}\nfrom dash.dependencies import (\n Input, \n Output\n)\nfrom dash import html\n\n\ndef register_callbacks(app):\n @app.callback(\n Output('output-container-button', 'children'),\n [Input('submit-btn', 'n_clicks')],\n [Input('input-text', 'value')]\n )\n def update_output(n_clicks, input_value):\n if n_clicks > 0:\n return html.Div([\n html.Label(\"You entered:\"),\n html.P(input_value)\n ])\n else:\n return ''\n\n```\n:::\n\n\n--- \n\nNow you can run your own app in the Jupyterlab here: \n\n![MyApp Launcher](../../assets/my_app.png)\n\n", | ||
"supporting": [ | ||
"projects_files" | ||
], | ||
"filters": [], | ||
"includes": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"hash": "633cc26588919f4ac288bf0fa8d4c236", | ||
"result": { | ||
"engine": "jupyter", | ||
"markdown": "---\ntitle: \"The OpenAI API\"\nformat: \n revealjs:\n theme: default\n chalkboard: true\n footer: \"Sprint: LLM, 2024\"\n logo: ../../assets/logo.svg\n fig-align: center\n---\n\n## Let's get started \n\nThe great thing about APIs is that we can start right away without too much preparation! \n\nIn this sprint, we will use the OpenAI API for completions and embeddings.\n\nResource: [OpenAI API docs](https://platform.openai.com/docs/introduction){.external}\n\n## Authentication\n\nTypically, it's as simple as this:\n\n::: {#7c51b865 .cell execution_count=1}\n``` {.python .cell-code}\n# setting up the client in Python\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\")\n)\n```\n:::\n\n\n## Authentication for the seminar\nFor the sprint, we have hosted some models in Azure. \n\n::: {#1a2b7eb7 .cell execution_count=2}\n``` {.python .cell-code}\nimport os\nfrom llm_utils.client import get_openai_client, OpenAIModels\n\nprint(f\"GPT3: {OpenAIModels.GPT_3.value}\")\nprint(f\"GPT4: {OpenAIModels.GPT_4.value}\")\nprint(f\"Embedding model: {OpenAIModels.EMBED.value}\")\n\nMODEL = OpenAIModels.GPT_4.value\n\nclient = get_openai_client(\n model=MODEL,\n config_path=os.environ.get(\"CONFIG_PATH\")\n)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nGPT3: gpt3\nGPT4: gpt4\nEmbedding model: embed\n```\n:::\n:::\n\n\n## Creating a completion\n\n::: {#f926b01f .cell execution_count=3}\n``` {.python .cell-code}\nchat_completion = client.chat.completions.create(\n messages=[\n {\n \"role\": \"user\",\n \"content\": \"How old is the earth?\",\n }\n ],\n model=MODEL \n)\n\n# check out the type of the response\n\nprint(f\"Response: {type(chat_completion)}\") # a ChatCompletion object\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nResponse: <class 'openai.types.chat.chat_completion.ChatCompletion'>\n```\n:::\n:::\n\n\n## Retrieving the response \n\n::: {#20e3f8f6 .cell execution_count=4}\n``` {.python .cell-code}\n# print the message we want\nprint(f\"\\nResponse message: {chat_completion.choices[0].message.content}\")\n\n# check the tokens used \nprint(f\"\\nTotal tokens used: {chat_completion.usage.total_tokens}\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n\nResponse message: The Earth is approximately 4.54 billion years old.\n\nTotal tokens used: 25\n```\n:::\n:::\n\n\n", | ||
"supporting": [ | ||
"openai_api_files" | ||
], | ||
"filters": [], | ||
"includes": {} | ||
} | ||
} |
Oops, something went wrong.