From 45a9fc67ec160f519670ed7d8a9abce301a94b8f Mon Sep 17 00:00:00 2001 From: denyslinkov Date: Sun, 23 Jul 2023 19:21:26 -0400 Subject: [PATCH 1/7] first one --- src/sentiment_classifier.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/sentiment_classifier.py diff --git a/src/sentiment_classifier.py b/src/sentiment_classifier.py new file mode 100644 index 0000000..fe11838 --- /dev/null +++ b/src/sentiment_classifier.py @@ -0,0 +1,19 @@ +import os + +import openai +from dotenv import load_dotenv +load_dotenv() +openai.api_key = os.getenv('OPENAI_API_KEY') + +response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are french."}, + {"role": "user", "content": "Say 'Hello world'"} + ], + temperature=0.7, + max_tokens=150, +) + +response_message = response["choices"][0]["message"] +print(response_message) \ No newline at end of file From 5fe6dcea904596623706d781f506270fa315ed5d Mon Sep 17 00:00:00 2001 From: Diophontine <12723001+Diophontine@users.noreply.github.com> Date: Mon, 24 Jul 2023 17:41:57 +0000 Subject: [PATCH 2/7] Small changes --- .gitignore | 2 ++ src/requirements.txt | 2 ++ src/sentiment_classifier.py | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 src/requirements.txt 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/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/sentiment_classifier.py b/src/sentiment_classifier.py index fe11838..28be927 100644 --- a/src/sentiment_classifier.py +++ b/src/sentiment_classifier.py @@ -8,12 +8,12 @@ response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ - {"role": "system", "content": "You are french."}, - {"role": "user", "content": "Say 'Hello world'"} + {"role": "system", "content": ""}, + {"role": "user", "content": ""} ], temperature=0.7, max_tokens=150, ) response_message = response["choices"][0]["message"] -print(response_message) \ No newline at end of file +print(response_message) From 34e0930f3f18b457cdf272182498beaf5f1890a2 Mon Sep 17 00:00:00 2001 From: Diophontine <12723001+Diophontine@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:13:24 +0000 Subject: [PATCH 3/7] Added 02_04 --- src/rude_customer_detector.py | 34 ++++++++++++++++++++++++++++++++++ src/sentiment_classifier.py | 19 ------------------- 2 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 src/rude_customer_detector.py delete mode 100644 src/sentiment_classifier.py diff --git a/src/rude_customer_detector.py b/src/rude_customer_detector.py new file mode 100644 index 0000000..7bae9f4 --- /dev/null +++ b/src/rude_customer_detector.py @@ -0,0 +1,34 @@ +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, + ) + if user_input == "exit" or user_input == "quit": + break + 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) diff --git a/src/sentiment_classifier.py b/src/sentiment_classifier.py deleted file mode 100644 index 28be927..0000000 --- a/src/sentiment_classifier.py +++ /dev/null @@ -1,19 +0,0 @@ -import os - -import openai -from dotenv import load_dotenv -load_dotenv() -openai.api_key = os.getenv('OPENAI_API_KEY') - -response = openai.ChatCompletion.create( - model="gpt-3.5-turbo", - messages=[ - {"role": "system", "content": ""}, - {"role": "user", "content": ""} - ], - temperature=0.7, - max_tokens=150, -) - -response_message = response["choices"][0]["message"] -print(response_message) From 5239293ecdc4622ac8359f4079273db577ca625e Mon Sep 17 00:00:00 2001 From: Diophontine <12723001+Diophontine@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:23:32 +0000 Subject: [PATCH 4/7] Fix typo --- src/rude_customer_detector.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rude_customer_detector.py b/src/rude_customer_detector.py index 7bae9f4..1aa2cd6 100644 --- a/src/rude_customer_detector.py +++ b/src/rude_customer_detector.py @@ -1,5 +1,4 @@ import os - import openai from dotenv import load_dotenv load_dotenv() @@ -24,8 +23,7 @@ temperature=0.7, max_tokens=150, ) - if user_input == "exit" or user_input == "quit": - break + response_message = response["choices"][0]["message"] response_content = response_message["content"] if response_content == "RUDE": From 44a3fe03d6d1fbc6c3af98461598f0db2e42b97f Mon Sep 17 00:00:00 2001 From: Diophontine <12723001+Diophontine@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:33:50 +0000 Subject: [PATCH 5/7] Create outline --- src/rude_customer_detector.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/rude_customer_detector.py b/src/rude_customer_detector.py index 1aa2cd6..b7bdd35 100644 --- a/src/rude_customer_detector.py +++ b/src/rude_customer_detector.py @@ -3,30 +3,12 @@ from dotenv import load_dotenv load_dotenv() openai.api_key = os.getenv('OPENAI_API_KEY') +# Challenge: Turning Away Rude Customers +# Build a GPT-4 python app that talks with a user. +# End the conversation if they're being rude # 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) From 1179cf24d9af976e371bd29ad6fc482f87d8389b Mon Sep 17 00:00:00 2001 From: smoser-LiL Date: Sat, 9 Sep 2023 00:59:14 +0000 Subject: [PATCH 6/7] Moving files using main --- NOTICE | 5 +---- README.md | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) 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 From d2bc8bee4deddf09e9c7cc7cc70881547af627d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tolga=20Ba=C5=9Fkan?= Date: Sun, 31 Mar 2024 15:25:39 +0300 Subject: [PATCH 7/7] Deneme --- .vscode/settings.json | 6 +++++- src/rude_customer_detector.py | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) 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/src/rude_customer_detector.py b/src/rude_customer_detector.py index b7bdd35..1aa2cd6 100644 --- a/src/rude_customer_detector.py +++ b/src/rude_customer_detector.py @@ -3,12 +3,30 @@ from dotenv import load_dotenv load_dotenv() openai.api_key = os.getenv('OPENAI_API_KEY') -# Challenge: Turning Away Rude Customers -# Build a GPT-4 python app that talks with a user. -# End the conversation if they're being rude # 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)