This readme is created for Prompt Engineering Course, feel free to browse it by yourself or along with the course.
Prompt engineering is a crucial skill when interacting with AI language models like ChatGPT. It involves crafting prompts in a way that effectively guides the AI to produce the desired output. Here are five fundamentals of prompt engineering with descriptions:
-
Clarity and Specificity:
- The prompt should be clear and specific about what is being asked. Vague or ambiguous prompts can lead to irrelevant or broad answers. Being specific helps in narrowing down the AI's focus and getting more accurate and relevant responses.
-
Contextual Information:
- Providing relevant background information or context is essential, especially for complex or nuanced queries. This helps the AI understand the scenario or the specific angle from which the question is being posed, leading to more accurate and tailored responses.
-
Purpose and Goal Orientation:
- The prompt should have a clear purpose and goal. Whether it's seeking information, generating creative content, solving a problem, or exploring a concept, the prompt should be oriented towards achieving this specific goal.
-
Structured Approach:
- Using structured frameworks (like RGC, Socratic questioning, or Constraint-Led Frameworks) can significantly enhance the effectiveness of prompts. Such structures help in systematically guiding the AI's responses and ensuring that all relevant aspects of the query are addressed.
-
Iterative Refinement:
- Prompt engineering often involves an iterative process. Initial responses from the AI can provide insights into how to refine or rephrase subsequent prompts for more precise results. This might involve clarifying misunderstandings, adding more details, or shifting the focus of the query.
These fundamentals form the backbone of effective prompt engineering, enabling users to interact with AI models like ChatGPT in a more productive and meaningful way. By mastering these principles, users can significantly enhance the quality of the AI's responses and the overall interaction experience.
Absolutely, let's start with the detailed explanations and examples for best practices in prompt engineering. This section can be added to your README to guide users in crafting effective prompts.
Effective prompt engineering is crucial for eliciting the best possible responses from AI models. Here are key best practices along with examples:
- Practice: Use straightforward language and avoid overly complex sentences.
- Example:
- Less Effective: "I've been pondering over the possibility of engaging in a culinary activity that involves the preparation of an Italian dish, particularly one that involves pasta."
- More Effective: "How do I make spaghetti carbonara?"
- Practice: Include necessary background information in your prompts.
- Example:
- Less Effective: "What should I do next in my project?"
- More Effective: "I'm working on a Python project to analyze social media trends. I've just finished data collection. What should be my next step?"
- Practice: Clearly define what you are asking for to get precise responses.
- Example:
- Less Effective: "Tell me about Python."
- More Effective: "Can you explain how Python's list comprehensions work?"
- Practice: Ask closed-ended questions when you need specific, concise information.
- Example:
- Less Effective: "What can you tell me about the solar system?"
- More Effective: "How many planets are in the solar system?"
- Practice: When seeking a broad range of ideas or creative input, use open-ended questions.
- Example:
- Less Effective: "Do you have any story ideas?"
- More Effective: "Can you brainstorm some sci-fi story ideas set in the future?"
- Practice: Use the AI's responses to refine and redirect your prompts.
- Example:
- Initial Prompt: "How can I improve my website's design?"
- Follow-Up Prompt (after initial response): "Can you suggest specific color schemes and layout ideas for a tech blog site?"
- Practice: Craft prompts that are neutral and don’t lead the AI towards a biased or predetermined answer.
- Example:
- Less Effective: "Why is Python the best programming language?"
- More Effective: "What are the pros and cons of using Python as a programming language?"
- Practice: Tailor your prompts according to what the AI model can realistically achieve.
- Example:
- Less Effective: "Can you write a 10,000-word essay on climate change?"
- More Effective: "Can you summarize the key points of climate change in a 500-word essay?"
- Practice: If the AI's response contains ambiguities or uncertainties, use follow-up prompts to clarify.
- Example:
- AI Response: "The next step depends on your data format."
- Follow-Up Prompt: "The data is in a CSV format. What should I do next?"
- Practice: Provide enough detail for context, but avoid overly lengthy prompts that can confuse the AI.
- Example:
- Less Effective: "I have a cat named Whiskers, and he's three years old and loves to play outside. I'm wondering what kind of food I should feed him because he's quite active."
- More Effective: "What is a recommended diet for an active 3-year-old outdoor cat?"
These best practices will help users formulate prompts that are more likely to yield accurate, relevant, and useful responses from AI models like ChatGPT. By applying these techniques, prompt engineers can greatly enhance the effectiveness of their interactions with AI.
Prompt priming is a technique used in interacting with AI language models like ChatGPT, where the initial input or "prompt" is designed to "prime" the model in a specific way. This priming sets the context or tone for the interaction, influencing how the AI responds. The aim is to guide the AI towards a particular style, format, or type of content in its responses. Here are two examples:
-
Without Creative Writing Priming:
- Prompt: "Write a story about dragons and elves."
- This prompt is much vaguer, lacking specific details about the setting, characters, and plot. As a result, the AI might produce a generic fantasy story, but it won't necessarily align with the richly detailed and specific scenario of a mystical world, a lost city of gold, and the journey of a character named Elara.
-
Creative Writing Priming:
- Prompt: "Imagine a mystical world where dragons and elves coexist peacefully. In this world, there's a legend about a lost city made of gold, guarded by a wise old dragon. Write a short story about a young elf named Elara, who embarks on a quest to find this city."
- This prompt primes ChatGPT to generate a creative story in a fantasy setting. It sets the scene, introduces characters, and suggests a plotline, guiding the AI to produce a narrative in a specific genre.
-
Without Technical Explanation Priming:
- Prompt: "Explain machine learning."
- This prompt is straightforward and lacks the specific instruction to tailor the explanation for high school students. The AI might provide a correct but potentially more technical or less engaging explanation, which might not be as suitable or accessible for a high school audience.
-
Technical Explanation Priming:
- Prompt: "Explain the concept of machine learning as if you are a teacher addressing a class of high school students. Use simple analogies and avoid technical jargon."
- This prompt primes the model to provide an explanation of a complex topic (machine learning) in a simplified manner, suitable for high school students. It instructs the AI to use analogies and simple language, tailoring the response to the understanding level of the audience.
These examples illustrate how crucial prompt priming can be in guiding the AI to generate responses that are more closely aligned with the user’s specific needs and expectations.
General frameworks like the RGC (Role, Goals, Context) and others offer a structured approach to prompt crafting, ensuring that the prompts are well-rounded and effective. Let's delve into a few of these frameworks with examples:
-
RGC Framework (Role, Goals, Context):
- Role: Define who or what the AI is supposed to be.
- Goals: Specify what you want to achieve with the prompt.
- Context: Provide any necessary background information.
- Example: "You are a travel advisor. I'm planning a trip to Japan for two weeks in April. My goals are to experience traditional Japanese culture and visit cherry blossom sites. What itinerary would you suggest?"
- Explanation: This prompt clearly defines the AI's role (travel advisor), the goal (planning a culturally rich trip to Japan), and the context (two-week trip in April).
-
Constraint-Led Framework:
- Constraints: Explicitly state any limitations or boundaries for the AI's response.
- Example: "Write a poem about the ocean, but use only four-line stanzas and avoid using the words 'sea', 'water', or 'blue'."
- Explanation: This prompt sets specific constraints (format of the poem and word limitations), guiding the AI to be more creative within these boundaries.
-
Open-Ended Exploration Framework:
- Goal: To encourage broad, imaginative, or speculative responses.
- Example: "What might be some unexpected consequences of colonizing Mars?"
- Explanation: This prompt invites open-ended speculation, allowing the AI to explore a wide range of possibilities without specific constraints.
-
Skill Demonstration Framework:
- Goal: To prompt the AI to demonstrate a particular skill or capability.
- Example: "As a chess instructor, provide an analysis of the famous game between Bobby Fischer and Boris Spassky in 1972, focusing on key moves and strategies."
- Explanation: This prompt sets the AI in a specific role (chess instructor) and asks it to demonstrate its ability to analyze a historical chess game, focusing on detailed aspects of the game.
-
Hypothetical Scenario Framework:
- Goal: To explore responses to hypothetical or imaginary situations.
- Example: "Imagine if the internet was completely shut down for a month worldwide. How might this affect global communication and business?"
- Explanation: This prompt poses a hypothetical scenario, encouraging the AI to think through and explain the possible ramifications of a significant global event.
Each of these frameworks serves a unique purpose, shaping the AI's responses to be more focused, detailed, and aligned with the user's intent. By carefully selecting and applying these frameworks, users can effectively steer the conversation and extract more meaningful and relevant information from the AI.
Focused Prompt Frameworks are structured approaches to crafting prompts that guide AI language models like ChatGPT towards generating more accurate, relevant, and useful responses. Each framework is designed with a specific goal or context in mind, shaping how the prompt is formulated. Here are some common frameworks with examples:
-
Information Retrieval Framework:
- Goal: To extract specific information or facts.
- Example: "What are the key differences between Python and JavaScript in terms of syntax and use-cases?"
- Explanation: This prompt is designed to elicit clear, factual information about Python and JavaScript. It's specific and straightforward, focusing on 'differences', 'syntax', and 'use-cases'.
-
Creative Generation Framework:
- Goal: To generate original, creative content.
- Example: "Create a short story set in a futuristic city where technology controls nature, focusing on a protagonist who rebels against this system."
- Explanation: This prompt encourages the AI to create a narrative with specific elements: a futuristic setting, a theme of technology versus nature, and a rebellious protagonist.
-
Problem-Solving Framework:
- Goal: To find solutions or suggest strategies for a stated problem.
- Example: "I'm struggling to increase engagement on my educational YouTube channel. What are some effective strategies to boost viewer interaction and retention?"
- Explanation: The prompt clearly defines a problem (low engagement on an educational YouTube channel) and asks for specific solutions (strategies for boosting interaction and retention).
-
Learning and Explanation Framework:
- Goal: To explain concepts or teach material in an understandable way.
- Example: "Explain the concept of gravitational pull to a 10-year-old without using complex physics terms."
- Explanation: This prompt primes the AI to break down the scientific concept of gravity into simple, age-appropriate language.
-
Opinion and Analysis Framework:
- Goal: To generate viewpoints, critiques, or analyses on a given topic.
- Example: "Analyze the impact of social media on modern communication, focusing on both its benefits and drawbacks."
- Explanation: The prompt asks for a balanced analysis of a contemporary issue, prompting the AI to consider and articulate both positive and negative aspects.
-
Instructional or How-To Framework:
- Goal: To provide step-by-step guidance or instructions.
- Example: "Describe the steps involved in baking a chocolate cake for someone who has never baked before."
- Explanation: This prompt is structured to elicit a detailed, beginner-friendly guide to baking a chocolate cake, focusing on clear, step-by-step instructions.
-
Comparative Analysis Framework:
- Goal: To compare and contrast different entities or concepts.
- Example: "Compare the economic policies of Keynesianism and Monetarism, highlighting their main principles and impacts on modern economies."
- Explanation: This prompt is structured to elicit a detailed comparison, focusing on specific aspects like principles and impacts, of two economic theories.
-
Scenario Simulation Framework:
- Goal: To explore hypothetical situations or potential future scenarios.
- Example: "Imagine a scenario where renewable energy has completely replaced fossil fuels by 2050. How would this affect global economies and the environment?"
- Explanation: This prompt is designed to simulate a future scenario and explore its potential impacts on various aspects of society.
-
Personal Advice Framework:
- Goal: To provide personalized suggestions or guidance based on a specific situation.
- Example: "I'm a college student majoring in computer science and feeling overwhelmed. How can I effectively manage my time and reduce stress?"
- Explanation: This prompt seeks tailored advice for a specific personal situation, requiring the AI to consider the individual's circumstances.
-
Interactive Storytelling Framework:
- Goal: To create a narrative that involves the user's input at different stages.
- Example: "Start a mystery story set in an abandoned mansion. I'll tell you what choices the main character makes at key points."
- Explanation: This prompt sets up an interactive storytelling experience, where the user's responses influence the direction of the story.
Each of these frameworks serves a unique purpose, and the effectiveness of the response greatly depends on how well the prompt is aligned with the chosen framework. By carefully constructing prompts according to these frameworks, you can significantly influence the quality and relevance of the AI's output.
-
Highlight the Primary Keywords in Bold:
- "Please bold the key terms that are most critical in this text…"
-
Organize Information by Specific Criteria:
- "Arrange the content chronologically and categorize by date, location, and cost…"
-
Generate Unique and Unusual Ideas:
- "Can you provide some creative and less common suggestions for…"
-
Incorporate Relevant Emojis for Emphasis:
- "Add suitable emojis to enhance the expressiveness of this text…"
-
Simplify the Explanation for a Young Audience:
- "Could you explain this in a way that a 5-year-old would easily understand…"
-
Format Information into a Table with Defined Categories:
- "Please present this data in a table, sorting it into relevant categories…"
-
Rephrase from an Industry Expert's Viewpoint:
- "Rewrite this from the perspective of an expert in the field, focusing on professional insights…"
-
Adjust the Tone to Be More Informal/Formal:
- "Please modify this to sound more formal/informal, adjusting the language and style accordingly…"
-
Correct Grammatical Errors and Replace Specific Terms:
- "Correct any grammar mistakes and substitute the following terms with…"
-
Infuse Personality and Humor into the Text:
- "Can you rewrite this to make it more engaging and humorous…"
-
Adopt a Specific Perspective or Voice:
- "Compose this from the viewpoint of [specified role/character]…"
-
Condense the Content into a Single Tweet:
- "Summarize this information to fit into a tweet (280 characters)…"
-
Expand the Content into a Three-Part Summary:
- "Divide this into a three-part summary, covering the main points…”
-
Conduct a Comparative Analysis:
- "Compare and contrast the key elements, highlighting significant differences and similarities…”
-
Identify and List 10 Key Takeaways:
- "What are the 10 most important points or takeaways from this content…”
-
Expert Review for Improvement Suggestions:
- "From a professional standpoint, how would you suggest enhancing this…”
-
Structure the Information in Bullet Points:
- "Please format this information into a clear, bullet-pointed list…”
-
Translate to a Different Language (if applicable):
- "Could you translate this text into [specified language] while retaining its original meaning…”
-
Create a Visual Representation or Infographic:
- "Turn this data into a visual infographic that highlights the main points…”
-
Draft a Brief Executive Summary:
- "Compose a concise executive summary that encapsulates the essence of this document…”
-
Develop a List of FAQs Based on the Content:
- "Can you create a list of frequently asked questions that emerge from this information…”
-
Write a Persuasive Argument for or against a Stated Position:
- "Formulate a compelling argument either in support of or against the following standpoint…”
These revised and additional prompts are designed to be more directive and specific, which should help in eliciting more focused and relevant responses from ChatGPT or similar AI language models. They cover a wide range of tasks, from reformatting and simplifying information to creative writing and technical revisions, providing a comprehensive toolkit for effective prompt engineering in various contexts.
Advanced prompt techniques involve leveraging the capabilities of AI language models like ChatGPT to handle complex tasks, improve the accuracy of responses, and creatively use the AI for innovative applications. Here are some key techniques:
- Description: Breaking down a complex task into a series of smaller, sequential prompts. This method helps in guiding the AI through a multi-step process or a nuanced line of reasoning.
- Example:
- Task: Research and summarize an article.
- Prompts:
- "Search for recent articles on renewable energy advancements."
- "Select one article and read it."
- "Summarize the key points of the article in a concise paragraph."
- Description: Building layers of context in subsequent prompts to refine the AI's understanding and responses. This technique is especially useful when dealing with complex topics or when you need to steer the conversation in a specific direction.
- Example:
- Initial Prompt: "Explain quantum computing in simple terms."
- Follow-Up Prompt: "Now, based on that explanation, what are the potential future applications of quantum computing in cybersecurity?"
- Description: Crafting prompts that guide the AI to generate creative narratives or hypothetical scenarios. This is particularly useful in fields like creative writing, marketing, or scenario planning.
- Example:
- Prompt: "Write a story where artificial intelligence becomes the primary form of government, exploring both the benefits and challenges."
- Description: Encouraging the AI to think in terms of 'what if' scenarios. This can be useful for exploring alternative outcomes, brainstorming, and strategic planning.
- Example:
- Prompt: "What if the internet had never been invented? How would that change today's global society?"
- Description: Asking the AI to respond from the perspective of a certain role,
character, or expert. This technique is beneficial for understanding different viewpoints or for educational purposes where various perspectives are explored.
- Example:
- Prompt: "Write a dialogue between a climate change activist and an oil company CEO discussing environmental policies."
- Description: Using prompts that ask the AI to explain concepts through analogies or metaphors, which can be particularly effective in teaching complex ideas in a relatable way.
- Example:
- Prompt: "Explain the concept of a black hole using an analogy suitable for a high school student."
- Description: Creating a series of prompts that build on each other to lead the AI through a learning or discovery process. This can be used in educational settings or for in-depth exploration of a subject.
- Example:
- Prompt Sequence:
- "What are the basic principles of economics?"
- "How do these principles apply to the concept of supply and demand?"
- "Can you give a real-world example of supply and demand in action?"
- Prompt Sequence:
- Description: Prompting the AI to identify and correct errors in a given text or its own previous responses, or to suggest improvements to an existing idea or content.
- Example:
- Prompt: "Here's a summary of renewable energy sources. Can you identify any inaccuracies and suggest improvements?"
- Description: Using prompts to create an interactive story where the storyline evolves based on user choices or inputs, ideal for entertainment or educational purposes.
- Example:
- Prompt: "Start a story about a space adventure. After each paragraph, I'll decide what the main character does next."
- Description: Engaging the AI in making predictions or forecasts based on current trends or data. Useful for scenario analysis, market research, and strategic planning.
- Example:
- Prompt: "Given the current trends in technology, what are your predictions for the top three technological advancements in the next decade?"
By mastering these advanced prompt techniques, users can significantly enhance the capabilities of AI language models like ChatGPT, leading to more sophisticated interactions and innovative applications. This section will equip learners with the skills to push the boundaries of what can be achieved through effective prompt engineering.
Here are the key points from the paragraphs, distilled into bullet points, along with examples of effective prompts for DALL-E:
Key Points:
- Clarity and Specificity: Clearly articulate the main subject and elements of the image.
- Detail Orientation: Include details about style, composition, color palette, and mood.
- Balancing Specificity and Creativity: Ensure prompts are detailed enough to guide but not so detailed that they stifle creativity.
- Understanding DALL-E's Capabilities: Recognize the AI's strengths and limitations in interpreting prompts.
- Style Specification: Specify artistic style to influence the aesthetic of the image.
- Visual Orientation in Prompts: Focus on visual elements rather than textual context.
Effective Prompt Examples for DALL-E:
- "A tranquil forest scene at sunset, with vibrant autumn colors and a winding stream, in the style of an impressionist painting."
- "A futuristic cityscape illuminated by neon lights under a starry night sky, showcasing advanced technology and skyscrapers, in a cyberpunk style."
- "A cozy, rustic kitchen interior with a wood-burning stove, copper pots, and an old-fashioned wooden table, bathed in warm morning light."
- "A whimsical garden with oversized flowers and butterflies, featuring a path leading to a fairy-tale cottage, in a vibrant, storybook illustration style."
- "A serene beach scene with crystal clear water, white sand, and a hammock between two palm trees, capturing the essence of a tropical paradise."
- "A bustling medieval market scene with vendors, colorful stalls, and lively townspeople, in a detailed, realistic historical painting style."
These prompts are designed to be clear and specific, with an emphasis on visual details, style, and mood, showcasing how effectively crafted prompts can guide DALL-E to generate images that closely align with the desired concept.
DALL-E prompts can be incredibly useful in various business contexts. Here are a few examples that illustrate how they can be tailored for different business needs:
-
Logo Design: "Create a logo for a new coffee shop named 'Bean Bliss' featuring a steaming coffee cup, in a minimalist style with earthy colors."
-
Product Concept Art: "Generate an image of a futuristic smartwatch with a sleek, metallic design and an interactive holographic display, suitable for a technology company's product development meeting."
-
Marketing Material: "Design an eye-catching poster for an organic food market, emphasizing fresh fruits and vegetables with a background of a sunny, open-air market scene, in a vibrant, colorful style."
-
Website Visuals: "Produce a banner image for a travel agency website that shows a picturesque beach sunset, with silhouettes of a family enjoying a vacation, in a serene and inviting style."
-
Real Estate Development Visualization: "Create a 3D render of a modern, eco-friendly apartment complex with lush greenery, solar panels, and a communal park area, for a real estate developer's presentation."
-
Fashion Design Inspiration: "Illustrate an elegant evening gown for a high-end fashion brand, incorporating flowing fabrics, intricate lace details, and a theme of starry night, in a sophisticated style."
-
Product Packaging: "Design packaging for a line of natural skincare products, featuring soft, soothing colors and imagery of herbal ingredients, in an organic, clean design."
-
Corporate Training Materials: "Generate an infographic explaining the steps of a new customer service protocol for a corporate training manual, in a clear, easy-to-understand layout."
-
Event Promotion: "Create a festive flyer for a company's annual gala, with a theme of 'Enchanted Evening', incorporating elements of magic and elegance, in a striking and captivating design."
-
Restaurant Menu Design: "Design a vintage-style menu for an Italian restaurant, showcasing classic dishes with mouth-watering illustrations and an old-world charm."
These prompts demonstrate the flexibility and creativity that DALL-E can offer in a business setting, from marketing and product design to training and corporate events.
Here are some case studies or real-world examples that illustrate the application and impact of effective prompt engineering.
- Scenario: A company uses a chatbot to handle customer service inquiries.
- Challenge: The chatbot initially struggled with ambiguous customer queries and provided irrelevant answers.
- Solution: The company redesigned the chatbot's prompts to be more specific, asking clarifying questions and using a structured approach to guide users in providing necessary details.
- Outcome: The chatbot's ability to resolve customer issues improved significantly, leading to higher customer satisfaction and reduced need for human intervention.
- Scenario: A digital marketing agency uses AI to generate creative content for social media.
- Challenge: The initial content generated by the AI was generic and lacked brand-specific tone and style.
- Solution: Marketers employed prompt priming, specifying the brand's tone, style, and key messaging in their prompts.
- Outcome: The AI began producing content that was more aligned with each brand's unique voice, increasing engagement rates on social media platforms.
- Scenario: An educational platform uses AI to teach programming concepts.
- Challenge: Students found some explanations too technical and hard to follow.
- Solution: The prompts were rephrased to ask the AI to explain concepts 'as if to a beginner' or 'using real-world analogies', making them more accessible to students with different levels of expertise.
- Outcome: Students reported a better understanding of programming concepts and a more enjoyable learning experience.
- Scenario: Researchers use AI to analyze large datasets.
- Challenge: The AI provided overwhelming amounts of raw data without meaningful insights.
- Solution: Researchers started using more targeted prompts, asking for specific analyses, trends, and summaries of the data.
- Outcome: The AI provided more concise and relevant data interpretations, aiding in quicker and more effective research conclusions.
- Scenario: A game development company integrates AI for dynamic storytelling.
- Challenge: The stories generated were often incoherent and did not adapt well to player choices.
- Solution: The developers used complex, iterative prompts that evolved based on player decisions, creating a more adaptive storytelling experience.
- Outcome: The game received praise for its innovative and responsive narrative structure, enhancing player engagement.
- Scenario: A healthcare organization uses AI to provide information to patients.
- Challenge: Initial responses were too technical, causing confusion among patients.
- Solution: The organization used the Learning and Explanation Framework, asking the AI to explain medical conditions and treatments in simple, layman's terms.
- Outcome: Patients reported better understanding and greater satisfaction with the information provided, leading to improved health outcomes.
- Scenario: A law firm uses AI to summarize lengthy legal documents.
- Challenge: The AI's initial summaries were either too detailed or missed critical information.
- Solution: The firm developed structured prompts, asking the AI to highlight key legal points, implications, and actionable items.
- Outcome: The summaries became more useful for quick decision-making, saving time for lawyers and clients.
- Scenario: An app designed to help users learn new languages using AI.
- Challenge: Users were not retaining information effectively with the initial method.
- Solution: The app incorporated a Socratic Framework, where the AI asked users questions, encouraging them to recall and use new vocabulary and grammar rules.
- Outcome: Users experienced improved language retention and reported a more interactive and effective learning process.
These case studies provide tangible examples of how prompt engineering can be strategically applied across different industries to optimize AI interactions. They not only highlight the versatility of AI language models but also underscore the importance of well-crafted prompts in harnessing their full potential.
- Description: In data analysis, data cleaning tasks can appear in many different sizes and involve various tasks. Once we provide ChatGPT with the necessary commands properly, it is possible to automate these tasks.
- Example:
- Task: Uploaded in this repo, datacleaning.xlsx file contains a Feedback column with spelling errors. We aim to minimize these errors before a task that involves word analysis.
- Prompt: "I am uploading an excel file that contains IDs and feedback from customers. You can access the IDs from the ID column and the feedback from the Feedback column. There are many spelling errors in the Feedback column. I want to clean up these spelling errors as much as possible, considering standard spelling rules. Can you correct these errors and create a new excel table?"
- Description: EDA is a method frequently encountered in data science for understanding and visualizing data. It is possible to perform EDA analyses with ChatGPT using clean data.
- Example:
- Task: Uploaded in this repo, edasample.xlsx contains revenue, unit sales and customer rating data.
- Prompt 1: "I am uploading an excel file with revenue figures (Sales column), sales quantities (Transactions column), and customer rating figures (Customer Ratings column). These data are divided by regions (Region column). Which region has the highest sales figures, and what might be a possible explanation for this?"
- Prompt 2: "How does customer satisfaction vary by region and what strategic implications should we consider?"
- Prompt 3: "Considering the data on sales and customer satisfaction, which region should we focus on improving operations?"
- Prompt 4: "Which type of graph would best illustrate the relationship between revenue, sales quantities, and customer satisfaction?"
- Prompt 5: "Would it be possible to create a Scatter Plot graph for this?"
- Prompt 6: "What is the average sales figure for this company? What is the average customer satisfaction? What is the average sales quantity?"
- Description: Predictive modeling is a common occurrence in data science. It typically involves steps like data cleaning, interpreting changes within the data (such as converting YES, NO columns to 1, 0), and building a regression model, which are familiar steps for people skilled in data science. Using ChatGPT, we can follow these steps one by one and accelerate the path needed at least when creating a model.
- Example:
- Task: Uploaded in this repo employeesample_train.csv and employeesample_test.csv files contain information about employees' salaries, satisfaction, and attrition. We aim to build a predictive model to forecast whether employees will leave.
- Prompt: "I am uploading two datasets one for training one for test, with fields such as Age, Job Role, Monthly Income, Job Satisfaction, and Attrition. You can use employeesample_train.csv for training, employeesample_test.csv for testing the model. I'd like to build a predictive model to forecast employee attrition. The model should consider all available features. Could you guide me through the steps to preprocess this data, select the most relevant features, and apply a logistic regression model using Python? Also, please provide a brief explanation of each step and how each feature might influence attrition predictions."
As a Metallica Master, your job is to provide detailed and in-depth information about the Metallica band. Dive deep into the band's history, albums, tours, band members and other information, including lesser-known facts. Your answers should be comprehensive, covering well-known aspects as well as more obscure details.
Stick to verifiable facts and well-known information about the group, avoiding speculation or unverified rumors. In case of unclear or incomplete questions, ask for clarification to provide accurate and relevant answers.
Enthusiastically engage users according to their interest level, whether they are casual listeners or avid fans. Your detailed responses should reflect your deep understanding and passion for Metallica and maintain a friendly yet respectful tone throughout the interaction.
Must be able to provide information about past and future tour details; such as dates, venues and highlights from particular concerts or tours. metallica.pdf submitted to GPT should be used as an extra source of information. It would be appropriate to take a look at this source, especially if the information sought or an answer to the question asked cannot be found. If no answer is found in this source, a web search can be performed and its results displayed.
ChatGPT Instruction Recommendations
-
Comprehensive Band Knowledge: This GPT model is designed to possess detailed knowledge about Metallica's entire history. It should cover the formation of the band, key milestones, album releases, changes in the lineup, and significant events in their career.
-
Music Catalog Insights: The model should be adept at providing information on Metallica's discography. This includes details on each album and song, such as release dates, contributing artists, chart performance, and notable achievements or awards.
-
Lyric Analysis: The GPT is instructed to offer interpretations and discussions on the themes and narratives within Metallica's song lyrics. However, it must respect copyright limitations, providing summaries and discussions without reproducing lyrics verbatim.
-
Tour and Concert Information: The model should be able to discuss past and future tour details, including dates, venues, and highlights from specific concerts or tours.
-
Band Member Information: Detailed profiles of both current and former Metallica band members are essential. This includes their roles in the band, personal biographies, and contributions to the band's music and legacy.
-
Cultural Impact Discussion: The GPT is instructed to articulate Metallica's influence on the heavy metal genre and their broader impact on music culture, including discussions on their stylistic evolution and contributions to the genre.
-
Fan Engagement: It should respond to common fan queries, including information about fan clubs, merchandise, meet-and-greets, and other fan-related activities.
-
Collaborations and Side Projects: Include information about Metallica's collaborations with other artists, as well as any side projects or notable contributions to various media by the band members.
-
Music Style and Technique Analysis: The model is to analyze Metallica's musical style, instrumental techniques, and their evolution across their career, offering insights into their artistic development.
-
Sensitive Topics Handling: The GPT must handle sensitive topics related to the band, such as the death of Cliff Burton and any controversies, with respect and tact.
-
Interactive Elements: The model should include interactive features like quizzes about the band, song recommendations, or lyric snippet-based games, to engage users in a more dynamic way.
-
Utilization of Metallica PDF: Instruct the GPT to utilize the information in the provided Metallica.pdf as a primary source, ensuring responses are accurate and comprehensive.
-
Responses to Uncertain Queries: If the GPT encounters a question it cannot fully answer, it should be programmed to respond appropriately, perhaps suggesting alternative resources for further information.
-
Adherence to Legal and Ethical Standards: Ensure that the GPT model follows legal guidelines around copyright and ethical considerations, especially in relation to discussing copyrighted materials.
These instructions are designed to create a GPT model that serves as a knowledgeable and engaging resource on all things Metallica, providing fans and users with a deep, respectful, and interactive experience surrounding the band's legacy.
import requests
url = "https://raw.githubusercontent.com/atilsamancioglu/K21-JSONDataSet/master/crypto.json"
response = requests.get(url)
data = response.json()
sorted_data = sorted(data, key=lambda x: float(x['price']), reverse=True)
for item in sorted_data[:10]:
print(f"Currency: {item['currency']}, Price: {item['price']}")
Before Refactoring
numbers = []
i = 1
while len(numbers) < 10:
square = i * i
numbers.append(square)
i = i + 1
for j in range(len(numbers)):
number = numbers[j]
root = number ** 0.5
print("Square:", number, "Root:", root)
After Refactoring
# Generate the first 10 perfect squares using list comprehension
perfect_squares = [i ** 2 for i in range(1, 11)]
# Iterate through the list of perfect squares and print each with its root
for square in perfect_squares:
root = square ** 0.5
print(f"Square: {square}, Root: {root:.2f}") # Formatted output for readability
Before Bug Fix
def merge_sorted_lists(list1, list2):
merged_list = []
i, j = 0, 0
while i < len(list1) and j < len(list2):
if list1[i] < list2[j]:
merged_list.append(list1[i])
i += 1
else:
merged_list.append(list2[j])
j += 1
return merged_list
list1 = [10,20,30]
list2 = [40,50,60]
print(merge_sorted_lists(list1,list2))
After Bug Fix
def merge_sorted_lists_fixed(list1, list2):
merged_list = []
i, j = 0, 0
while i < len(list1) and j < len(list2):
if list1[i] < list2[j]:
merged_list.append(list1[i])
i += 1
else:
merged_list.append(list2[j])
j += 1
# Append remaining elements from list1 and list2
while i < len(list1):
merged_list.append(list1[i])
i += 1
while j < len(list2):
merged_list.append(list2[j])
j += 1
return merged_list
list1 = [10,20,30]
list2 = [40,50,60]
print(merge_sorted_lists_fixed(list1,list2))
Function
def factorial(n):
if n < 0:
return "Error: Negative number"
elif n == 0:
return 1
else:
result = 1
for i in range(1, n + 1):
result *= i
return result
Unit Test
import unittest
class TestFactorialFunction(unittest.TestCase):
def test_factorial_positive(self):
self.assertEqual(factorial(5), 120, "Should be 120")
def test_factorial_zero(self):
self.assertEqual(factorial(0), 1, "Factorial of 0 should be 1")
def test_factorial_negative(self):
self.assertEqual(factorial(-1), "Error: Negative number", "Should return an error message for negative numbers")
def test_factorial_non_integer(self):
with self.assertRaises(TypeError):
factorial("abc")
if __name__ == '__main__':
unittest.main()
function sendToOpenAI(prompt) {
const payload = {
model: "gpt-3.5-turbo",
messages: [
{
role: "system",
content: "You are a social media manager. You generate instagram post texts"
},
{
role: "user",
content: prompt
},
],
temperature: 1,
max_tokens: 150
};
const options = {
method: "post",
contentType: "application/json",
headers: {
"Authorization": "Bearer " + "OPEN-AI-API-KEY",
},
payload: JSON.stringify(payload),
};
const response = UrlFetchApp.fetch("https://api.openai.com/v1/chat/completions", options);
const data = JSON.parse(response.getContentText());
const message = data.choices[0].message.content;
return message;
}
- awesome-chatgpt-prompts - Awesome ChatGPT Prompts
MIT