ChatGPT tutorial: How to improve your work with ChatGPT
What is ChatGPT?
OpenAI has created a chatbot utilizing their GPT-3.5 model. This AI model has been developed to produce text that reads as if it was written by a human. When you ask the chatbot a question, it will provide a response that may consist of multiple sentences or paragraphs. This chatbot represents a new advancement in the field of AI text generation.
How to utilize ChatGPT in your workplace
You can use GPT-3 to help you with your emails by providing it with some information about what you want to say in your email, and it will generate text that you can use in your email. For example, you can give GPT-3 the topic of your email and some bullet points that you want to include, and it will generate the body of the email for you. You can then review and edit the text as needed. Most of the time ChatGPT will generate text that is very similar to what you would write yourself. You can even request changes to the text, and ChatGPT will generate new text that is more similar to what you want to say. Answering emails is a very time-consuming task, and ChatGPT can help you save time here.
You can use ChatGPT to summarize a document for you. You can give it a document and ask it to summarize it for you. It will then generate a summary of the document that you can use in your work. This is a very useful feature for people who need to summarize documents quickly. This can also help with emails as you can just simply summarize long email threads.
This also comes in handy when you are researching some topic. Just paste long articles into ChatGPT and it will summarize them for you. Additionally, you can use ChatGPT to summarize entire website and ask questions about the text. This makes it super fast to extract information like phone numbers, addresses, etc. from websites.
Here is an example of a summary of a 10 paragraph article about NASA's Program Gemini:
The Gemini program was a series of 12 two-man spacecraft launched by NASA between 1964 and 1966 to test the capabilities of astronauts and spacecraft in Earth orbit. It included several important milestones, including the first manned spacecraft to make a re-entry into Earth's atmosphere that was automatically controlled and the first docking of two spacecraft while on orbit. The program was successful and helped the US advance in the Space Race with the Soviet Union.
You can use ChatGPT to help you brainstorm ideas. You can give it a topic and ask it to generate ideas for you. It will then generate a list of ideas that you can use in your work. It's possible to ask to elaborate on certain key points and ChatGPT will talk a little more about them. This is awesome to use when you are stuck on a project or assignment and need some inspiration.
Code Snippets, Documentation, Fixing Bugs and Git
ChatGPT is especially useful for developers, data scientists, and other technical people. ChatGPT can generate code for you. You can give it a task and it will generate code that you can use in your work. This personally helped me for example when I had to write a script that would extract all text from multiple .txt files in a folder and save it in a single .txt file. I just gave ChatGPT the task and it generated the code for me.
import os # Set the directory you want to start from rootDir = 'data' # Initialize the combined text combined_text = "" # Walk through all the files in the directory for dirName, subdirList, fileList in os.walk(rootDir): for file in fileList: # Open the file with open(os.path.join(dirName, file), 'r') as f: # Read the file's content file_text = f.read() # Append the file's content to the combined text combined_text += file_text # Write the combined text to a file with open('combined_text.txt', 'w') as f: f.write(combined_text)
You can also ask ChatGPT to generate documentation for you. It will then add comments and docstrings to your code. This is very useful when you are working on a project and need to document your code, which is normally a very time-consuming task. We can go from this:
def bubble_sort(lst): swap = -1 while swap != 0: swap = 0 for i in range(len(lst)-1): if lst[i] > lst[i+1]: lst[i], lst[i+1] = lst[i+1], lst[i] swap = 1 return lst
to this documented piece of code:
def bubble_sort(lst): """Sort a list using the bubble sort algorithm. Parameters: lst (list): The list to be sorted. Returns: list: The sorted list. """ # Set swap counter to a non-zero value swap = -1 # Repeat until swap counter is zero while swap != 0: # Reset swap counter swap = 0 # Loop through the list and compare adjacent elements for i in range(len(lst)-1): if lst[i] > lst[i+1]: # Swap the elements lst[i], lst[i+1] = lst[i+1], lst[i] # Set swap counter to 1 swap = 1 return lst
It's also possible for ChatGPT to fix bugs in your code. This works best in generic code like algorithms, because ChatGPT doesn't know the context of your code. You can only give it a piece of code and ask it to fix the bugs in it. So this is more useful for beginner programmers.
It's also possible to ask ChatGPT about Git commands. Some git commands are very long and hard to remember and are often forcing you to google them first. ChatGPT can help you with that. You can ask ChatGPT to generate a git command for you and it will do so.
How do I start with ChatGPT?
There are few ways. If you know what you’re looking for and just need libraries, you can just use the ChatGPT API and just do your app. If you do want to learn more about it, you can learn more from our ChatGPT tutorials. Or if you know a problem which you want to fix and want to develop it in a group and with assistance of mentors create a working prototype in 7 days, we would recommend you to join our AI Hackathons.
Join the community of creators, builders and innovators. Be part of the change, join lablab.ai!