diff --git a/.gitignore b/.gitignore index 4b64bc3..151b0bf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules .tmp npm-debug.log +*.env +*.venv \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 2369810..f231b45 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,5 +20,9 @@ "workbench.activityBar.visible": true, "workbench.colorTheme": "Visual Studio Dark", "workbench.fontAliasing": "antialiased", - "workbench.statusBar.visible": true + "workbench.statusBar.visible": true, + "cSpell.words": [ + "dotenv", + "openai" + ] } diff --git a/NOTICE b/NOTICE index 547595f..6e2b44a 100644 --- a/NOTICE +++ b/NOTICE @@ -1,12 +1,9 @@ -Copyright 2022 LinkedIn Corporation +Copyright 2023 LinkedIn Corporation All Rights Reserved. Licensed under the LinkedIn Learning Exercise File License (the "License"). See LICENSE in the project root for license information. -ATTRIBUTIONS: -[PLEASE PROVIDE ATTRIBUTIONS OR DELETE THIS AND THE ABOVE LINE “ATTRIBUTIONS”] - Please note, this project may automatically load third party code from external repositories (for example, NPM modules, Composer packages, or other dependencies). If so, such third party code may be subject to other license terms than as set diff --git a/README.md b/README.md index 422e093..e1e4ee8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ -# COURSENAME -This is the repository for the LinkedIn Learning course `course-name`. The full course is available from [LinkedIn Learning][lil-course-url]. +# Building Apps with AI Tools: ChatGPT, Semantic Kernel, and Langchain +This is the repository for the LinkedIn Learning course Building Apps with AI Tools: ChatGPT, Semantic Kernel, and Langchain. The full course is available from [LinkedIn Learning][lil-course-url]. + +![Building Apps with AI Tools: ChatGPT, Semantic Kernel, and Langchain][lil-thumbnail-url] + +New tools powered by artificial intelligence are changing the way we think about apps. And if you’re a developer looking to integrate your workflow, it’s time to supercharge your existing skills. In this course, instructor Denys Linkov offers an overview of how to build apps and integrate exciting, new open-source tools such as ChatGPT, Semantic Kernel, and LangChain. + +Learn how to connect to the ChatGPT API to start building hands-on applications with code. Denys shows you the basics of app development with Semantic Kernel, from formatting to chain-of-thought reasoning, prompting, and OpenAI Whisper for text to speech. By the end of this course, you’ll also get a chance to try out your new skills building document search with LangChain and testing ChatGPT apps. + -![course-name-alt-text][lil-thumbnail-url] -_See the readme file in the main branch for updated instructions and information._ ## Instructions This repository has branches for each of the videos in the course. You can use the branch pop up menu in github to switch to a specific branch and take a look at the course at that stage, or you can add `/tree/BRANCH_NAME` to the URL to go to the branch you want to access. @@ -23,14 +28,20 @@ To resolve this issue: Commit changes using this command: git commit -m "some message" ## Installing -1. To use these exercise files, you must have the following installed: - - [list of requirements for course] +1. To use these exercise files, you must have the following installed: Python 2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree. -3. [Course-specific instructions] +3. All python dependencies are included in each branch + + +### Instructor +Denys Linkov + +Machine Learning Lead at Voiceflow -[0]: # (Replace these placeholder URLs with actual course URLs) + -[lil-course-url]: https://www.linkedin.com/learning/ -[lil-thumbnail-url]: http:// +Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/denys-linkov). +[lil-course-url]: https://www.linkedin.com/learning/building-apps-with-ai-tools-chatgpt-semantic-kernel-and-langchain?dApp=59033956&leis=LAA +[lil-thumbnail-url]: https://media.licdn.com/dms/image/D560DAQENsHoqO_7Y1Q/learning-public-crop_675_1200/0/1694035139061?e=2147483647&v=beta&t=cCnp-C_2NN9JnQM_fHZlVyjfMrGzfgpiGXv5i4Y_5mM diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..48b686e --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,2 @@ +openai==0.27.8 +python-dotenv==1.0.0 \ No newline at end of file diff --git a/src/rude_customer_detector.py b/src/rude_customer_detector.py new file mode 100644 index 0000000..1aa2cd6 --- /dev/null +++ b/src/rude_customer_detector.py @@ -0,0 +1,32 @@ +import os +import openai +from dotenv import load_dotenv +load_dotenv() +openai.api_key = os.getenv('OPENAI_API_KEY') + +# test case 1 'you're the worst human i've talked to' -> RUDE +# test case 2 'hey how's your day going' +# test case 3 'I like pizza. What do you like?' +# test case 4 'I bite my thumb at you!' +# test case 5 'I think this product doesnt work!' -> RUDE +print("\n\nBot: Hey how's it going?") +while True: + user_input = input("") + if user_input == "exit" or user_input == "quit": + break + response = openai.ChatCompletion.create( + model="gpt-4", + messages=[ + {"role": "system", "content": "You are a pizza loving person. If someone says something rude print exactly 'RUDE', otherwise respond"}, + {"role": "user", "content": user_input} + ], + temperature=0.7, + max_tokens=150, + ) + + response_message = response["choices"][0]["message"] + response_content = response_message["content"] + if response_content == "RUDE": + print("I don't talk to rude people goodbye") + break + print("Bot:" + response_content)