diff --git a/source/_posts/chatgpt.md b/source/_posts/chatgpt.md index eb2c25e..ab661d0 100644 --- a/source/_posts/chatgpt.md +++ b/source/_posts/chatgpt.md @@ -14,345 +14,286 @@ plugins: - copyCode --- -## Overview +## Glossary -### Terminology +### AI -- Prompt: input text that guides an AI model’s response. -- Tokens: the smallest units of text processed by an AI model. -- Token Limit: the max number of tokens an AI model can process in one request. -- Artificial intelligence (AI): machines that imitate human intelligence. -- AI Model: a program trained on datasets to recognize patterns and make decisions without human intervention. -- Large language model (LLM): a transformer-based AI model trained on large text datasets to understand and generate - human-like language. -- Hallucination: when an AI model generates responses that are false or misleading but presented as fact. -- Jailbreak: exploiting AI model vulnerabilities to bypass ethical guidelines and perform restricted actions. +- Prompt: input or query that guides an AI model in generating a + response.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273982/definition-of-prompt-ai-prompt) +- Tokens: the smallest units of text processed by an AI model (e.g., words, subwords, characters, and punctuation marks) + that varies depending on the model and the tokenization + method.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273998/definition-of-token/) +- Token Limit: the maximum number of tokens an AI model can process in one + interaction.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273998/definition-of-token/) +- Artificial intelligence (AI): technology that enables machines to simulate human cognition (e.g., human learning, + comprehension, problem solving, decision making, creativity, and + autonomy).[[s]](https://www.ibm.com/think/topics/artificial-intelligence) +- AI Model: program trained on a set of data to recognize patterns or make decisions without further human + intervention.[[s]](https://www.ibm.com/think/topics/ai-model) +- Large language model (LLM): transformer-based AI model trained on large text datasets to understand and generate + natural language.[[s]](https://www.ibm.com/think/topics/large-language-models) +- Hallucination: AI response that detects nonexistent patterns and creates outputs that are nonsensical and + inaccurate.[[s]](https://www.ibm.com/think/topics/ai-hallucinations) +- Jailbreak: exploiting vulnerabilities in AI systems to bypass their ethical guidelines and perform restricted + actions.[[s]](https://www.ibm.com/think/insights/ai-jailbreak) -### Tips +### Prompt Engineering Techniques -Prompt Efficiency +- Zero-shot: prompt with no examples.[[s]](https://www.ibm.com/think/topics/zero-shot-prompting) +- One-shot: prompt with one example.[[s]](https://www.ibm.com/think/topics/one-shot-prompting) +- Few-shot: prompt with multiple examples.[[s]](https://www.ibm.com/think/topics/few-shot-prompting) +- Chain of thought: prompt guiding the model to break down complex reasoning into intermediate + steps.[[s]](https://cloud.google.com/discover/what-is-prompt-engineering?hl=en) -- Focus on achieving the desired output efficiently with minimal words in the prompt. -- Specify general instructions at the start of a conversation or when changing direction to avoid constantly restating - them in each new prompt. +### Modes -```{.wrap} -Example: specify the role once at the start of a conversation. -``` +- Study and learn: interactive learning that encourages step by step problem solving instead of giving direct + answers.[[s]](https://openai.com/index/chatgpt-study-mode/) +- Create image: generate images from text + prompts.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview) +- Think longer: performs deeper reasoning and generates more accurate, thoughtful, and detailed + responses.[[s]](https://openai.com/index/introducing-gpt-5) +- Deep research: reads and synthesizes content across multiple online sources and produces cited structured + outputs.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview) +- Web search: finds recent and real-time information + online.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview) +- Canvas: separate interface for collaborative writing and coding that provides inline editing, suggestions, and + feedback.[[s]](https://openai.com/index/introducing-canvas/) -- Restructure text to eliminate filler words that don’t add meaning: +## Prompt Tips -```{.wrap} -Example: “provide a breakdown" -> "provide sales breakdown”. -``` +### Efficiency -- Do not explicitly refer to the item being processed unless addressing a specific part of it as what you provide will - typically speak for itself: +- Use the latest model as it's generally more capable and easier to + prompt.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api) +- Provide general instructions at the start of conversations or when changing direction to avoid repeating them. +- Don't say polite phrases to the AI (e.g., please, thank you) as it adds unecessary computational + costs.[[s]](https://www.techradar.com/computing/artificial-intelligence/chatgpt-spends-tens-of-millions-of-dollars-on-people-playing-please-and-thank-you-but-sam-altman-says-its-worth-it?utm_source=chatgpt.com) +- Don't explicitly ask the AI for help (e.g., can you help me do x?). +- Don't explicitly reference yourself unless clarifying multiple entities (e.g., I want to, do x for me). -```{.wrap} -Example: “Filter this piece of text" -> "Filter text” -``` +### Clarity -- Do not explicitly ask the AI for help: +- Be clear, specific, and provide enough context for the model to understand what you are + asking.[[s]](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt) +- Prompt engineering often requires iterative refinement by adjusting wording, adding context, and simplifying + requests.[[s]](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt) +- Break complex tasks into smaller focused + prompts.[[s]](https://help.openai.com/en/articles/4936848-how-do-i-create-a-good-prompt-for-an-ai-model) +- Specify focus areas, highlight important aspects, and ask for multiple + options.[[s]](https://help.openai.com/en/articles/4936848-how-do-i-create-a-good-prompt-for-an-ai-model) +- Provide examples of the desired output format to improve + accuracy.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api) +- Focus on specifying what to do and not just what to + avoid.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api) +- Before writing a prompt, identify the goal and expected + output.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) +- Provide important keywords or phrases where possible to faciliate SEO and communicate term preferences to the AI + model.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) +- Keep prompts precise and clean by omitting unnecessary or redundant + information.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) +- Avoid conflicting terms that might confuse the + AI.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) +- Open-ended questions usually provide more detailed responses than [closed-ended questions] and yes/no + questions.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) +- When in doubt, ask AI to generate prompts for + you.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt) -```{.wrap} -Example: “can you help me x”. -``` +### Security -- Do not explicitly reference yourself unless clarifying multiple entities: +- Don't share sensitive information with AI as you can't be certain how it's stored, if it will be shared, of if it's + vulnerable to data + breaches.[[s]](https://www.grantthornton.com/insights/articles/advisory/2023/anticipate-cybersecurity-and-privacy-risks-in-ai) -```{.wrap} -Example: "do X for me". -Example: ”I want to x”. -``` - -- Do not be polite to the AI: - -```{.wrap} -Example: "please do X". -Example: “thanks”. -``` - -Prompt Clarity - -- Consider breaking up complex ideas into granular bullet points to improve clarity, avoid searching for text, and - eliminate comma lists and conjunctions (e.g., and). -- Avoid vague or close ended questions. - -```{.wrap} -Example: “Do you think our site is good" -> "Explain flaws in the designs of each webpage” -``` - -- Ensure prompts are specific - -```{.wrap} -Example: “explain our sales" -> "explain a breakdown of our sales performance for the last quarter”. -``` - -Response Refinement - -- If the AI model misunderstands your request then specify the intended action. -- Provide sufficient context so the AI model can understand the scenario. - -Privacy And Security - -- Never share sensitive information with AI model's as you can't be certain how it's stored, whether it will be shared, - of if a data breach may occur. - -## Prompt Engineering +## Prompt Structure ### Prompt Frameworks -Only use prompt components that are relevant for your needs. +General Purpose ``` -General Purpose -[role] [task] [tone] [format] [restriction] +[role] [task] [style] [output format] [constraint] ``` ### Role Standard -- Act as [occupation] - -Common Standard Roles - -- Personal Coach -- Consultant -- Entrepreneur -- Proofreader -- Therapist - -Also See - -- [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) _(github.com)_ +- Act as [occupation] with [specifications] +- [List of roles](https://github.com/f/awesome-chatgpt-prompts) Roleplay -- Act as [figure] with [appearance] [personality] [behaviour examples] [lore] in [scenario] +- Act as [name] with [visual description] [personality] [behaviour examples] [lore] in [scenario] -### Task +### Tasks (Language And Text) {.secondary} [verb] [task] [specifics] -#### 5W1H Questions +Generate + +- Generate [content type] to [entity] about [topic] and cover [aspects] +- Generate random [names|numbers|words|ideas|X] matching [criteria] +- [Continue|extend|lengthen] + +Summarise + +- [Summarise|shorten|write concise|write key points|write main lesson] +- Create outline + +Refine + +- [Write better|improve] +- Paraphrase +- Correct spelling, grammar, and punctuation errors +- Change [narrative voice A] to [narrative voice B] +- Replace X with Y + +Explain + +- [Explain|elaborate] +- Explain [how to do|each step of] X +- Explain what X does +- Explain X [in simple terms|like I’m 5|simplify]; Simplify X +- Teach me about [topic|subject] +- Provide [example|analogy] + +Organize + +- Sort X by [key] in [order] +- Categorize + +Advise + +- Create [strategy|goals|milestones|roadmap|schedule|timeline] for X +- Recommend [media type] [on|similar to] [topic] +- Recommend [gifts|X] for [entity|occasion] +- Recommend improvements +- Provide [advice|feedback] for X + +Analyze + +- Extract [themes|keywords|info] about X +- Identify [similarities|differences] between X and Y +- Analyse the [sentiment|tone] of X +- Identify gaps in X +- Evaluate [strengths and weaknesses|pros and cons] of X +- Is X [comparison] Y? + +Translate + +- Translate [language A] into [language B] +- Convert [unit A] to [unit B] +- Reformat as [output format] + +Filter + +- Filter items where [condition] +- Choose best from [options] +- Choose [top|lowest|first|last|random] [quantity] from [options] + +Engage + +- Provide questions about X + +Research + +- Get up-to-date [facts|news|data] on X +- Find [sources|references|citations] for X +- Is this true? + +### Tasks (Meta) {.secondary} + +Chat Memory + +- Based on [previous context] do X + +### Tasks (Code) {.secondary} + +Generate + +- Generate code in [programming language] to do X + +Translate + +- Translate [programming language A] into [programming language B] + +Optimize + +- Optimize X for [benefit] + +Debug + +- Debug X and explain why it's doing Y + +### Tasks (Image) {.secondary} + +Generate + +- Generate image of X in [style] + +Edit + +- Edit image to have X + +### Tasks (File And Image Upload) {.secondary} + +Explain + +- Question what is shown +- Interpet visuals + +Analysis + +- Extract data + +### Task (5W1H Questions) {.secondary} Who - Who is X? -- Who is [involved | affected | responsible] for X? +- Who is [involved|affected by|responsible] for X? - Who should I contact for help with X? What -- [What is | define | explain | describe] X? -- What does X do? -- What did [entity | text] mean by [quote]? -- What events led up to [event]? -- What [assumptions | risks | constraints] exist for X? -- What are the critical features of X? -- [What is done well? what can be improved?] +- [What is|define|explain|describe] X? +- What are the key topics of X? +- What does [quote] mean? +- [What is done well?|what can be improved?] - What is the best way to do X? -- What are the top 5 X? When -- When [did | will] [entity | event] occur? -- When is X due? -- When is the best time to initiate X? +- When [did|will] X happen? +- When is the best time to do X? Where -- Where did [entity | event] happen? -- [Where to find X? | where to find resources about X? | suggest websites about X] +- Where did X take place? +- Where to find X? Why -- Why did [entity] choose [approach]? -- Why [did | will] [event] occur? -- Why is [approach] being implemented? +- Why did X happen? +- Why is this approach used? +- Why is X important? - Why might X succeed or fail? -- Why is [solution] preferable to [alternative]? -- Why is it important? +- Why is X preferable to Y? How - How to do X? - How does X work? -- How does X do Y? -- How to measure [metric] accurately? +- How did this happen? -#### Utility +### Style -Generate And Expand Content +Using [style] -- Write [content type] to [entity] about [topic] should cover [aspects] **_(Content type examples: article, description, documentation, dummy data, email, resume, essay, guide, outline, program, recipe, SEO keywords, story, social media post, study plan, title, video script)_** -- Generate random [names | numbers | words | ideas | X] matching [criteria] -- [Continue | expand] -- Create image of X +Imitate -Summarize And Outline - -- [Summarise | write key takeaways | write main points | write main lesson | highlight important info] -- [Shorten | write concise] -- Create outline - -Modify And Refine Text - -- [Write better | improve] -- Paraphrase -- Correct spelling, grammar, punctuation errors -- Change [narrative voice A] to [narrative voice B] - -Explain And Teach - -- [Explain | elaborate] -- Explain [how to do | each step of] X -- Explain what X does -- Explain X [in simple terms | like I’m 5]; Simplify X -- Teach me about [topic | subject] -- Provide [example | analogy] - -Organize And Structure - -- Sort X by [key] in [order] **_(Sort order examples: alphabetical, chronological, ascending, descending, lexicographical, custom)_** -- Categorize - -Plan And Strategize - -- Plan [strategy for | goals and steps to achieve | milestones for | roadmap for] X -- Create [schedule | timeline] for X - -Recommend And Advise - -- Recommend [media type] [on | similar to] [topic] -- Recommend [gift ideas | thing] for [entity | occasion] -- Recommend improvements -- Provide advice for [situation] -- Give feedback on idea for X - -Analyze And Compare - -- Extract [themes | keywords | info] about X -- Identify [similarities | differences] between X and Y -- Analyse the [sentiment | tone] of X -- Identify gaps in X -- Evaluate [strengths and weaknesses | pros and cons] of X -- Is X [comparison operator] Y? **_(Can be abstractly expressed as a sentence like "is an apple bigger than a walnut"?)_** -- Reverse engineer X - -Translate And Convert - -- Translate [human language A] into [human language B] -- Translate [programming language A] into [programming language B] -- Translate into emojis -- Convert [unit A] to [unit B] -- Reformat as [output format] - -Filter And Choose - -- Filter X where [condition] -- Exclude X where [condition] -- Choose best from [options] -- Choose [top | lowest | first | last | random] [quantity] from [options] - -Real-Time Lookup And Verify - -- Get up-to-date [facts | news | data] on X -- Is this true? -- Find [sources | references | citations] for X - -Engagement And Trivia - -- Give questions about X - -Chat Memory - -- What did you mean by X? -- What was said earlier about X? -- Use earlier context to do X - -#### Conditional Clauses - -- [Verb] [item number] -- [Verb] the [first | last | random] [quantity] of X -- [Verb] the [first | last | random] [quantity] of X where [condition] -- [Verb] X where [condition] -- [Verb] X where not [condition] - -#### Database CRUD Operations - -Create - -- [Write content about X|suggest ideas about X|suggest titles about X] -- Write content about X in the style of [style] -- Write better -- Write email to [entity] about X -- [Continue|expand] -- [Explain how to do X|create roadmap for X] -- [Suggest best practices for X|suggest improvements|what am I doing right?|what am I doing wrong?] -- Show list of emojis about X -- [Create|generate|imagine] image about X - -Read - -- [Summarise|write concise main points] -- [Explain|elaborate] -- Explain what [entity|text] meant by X -- Identify themes in X -- Write outline about X -- Extract keywords -- Get up-to-date [facts|news|data] on X -- Is this true? -- Suggest [media] [about|similar to] X -- Pick best from [options] - -Update - -- For all X do [action] -- For X do [action] if matching [criteria] -- Reformat everything as [format] - -Delete - -- Delete [quantity] of X matching [criteria] -- Delete everything except X -- Delete [item] [number] -- Delete duplicate items from X - -Compare - -- Identify [simlarities|diffirences] between X and Y -- Identify gaps in X -- Evaluate pros and cons of X -- X [comparison operator] Y. It could be abstractly expressed as "are apples bigger than walnuts?" - -Filter - -- Filter X by [criteria] -- Exclude X by [criteria]. Everything is excluded by default. - -Select - -- Select [quantity] of X based on [criteria|randomly] - -Simplify - -- Explain X like I’m 5 -- Explain in simple terms - -Sort - -- Sort X by [key] in [alphabetical|chronological|ascending|descending|lexicographical|custom] order - -Translate - -- Translate into [language]. For programming languages it's specifically called transpile - -### Tone - -Using [tone] tone +- Using style of [person|brand|genre|character] Formality @@ -364,7 +305,9 @@ Directness - Direct - Indirect -Positive Tones +Tones + +Positive - Optimistic - Appreciative @@ -376,7 +319,7 @@ Positive Tones - Humorous - Inspirational -Negative Tones +Negative - Pessimistic - Accusatory @@ -386,14 +329,17 @@ Negative Tones - Sarcastic - Urgent -### Format +### Output Format (Text) {.secondary} -In [format] +In [output format] -Presentation +Paragraphs -- Plain text -- Bullet point list +- Paragraphs **_(default)_** + +List + +- Bulleted list - Numbered list - Check list @@ -401,59 +347,94 @@ Code - Code -Process +Instructions - Step-by-step instructions -Response +Knowledge Base -- Question and answer -- Dialogue +- Q&A +- FAQ -Creative +Creative Writing +- [Joke|humour] +- [Lyrics|song] +- [Metaphorical|stylized language] - Poetry -- Music lyrics -- Script -- Comic strip dialogue -- Poetry -- Music lyrics -- Riddle +- [Script|screenplay|dialogue] +- [Story|narrative] -Game +Games -- Quiz -- RPG -- Choose-Your-Own-Adventure +- [Quiz|test|flashcards|drills] +- [Riddle|puzzle] +- [rpg|choose-your-own-adventure] -### Restriction +### Output Format (Visual) {.secondary} -But [restriction] +Data Visualization -Length Constraints +- Table +- [Chart type] chart -- Concise -- In N words -- In N sentences +Creative Visual -Language Constraints +- ASCII Art +- Emojis +- Word cloud + +### Output Format (File Type) {.secondary} + +Document + +- PDF + +Structured Data And Markup + +- Plain text +- Markdown +- HTML +- XML +- CSV +- JSON +- LaTeX + +Programming Code And Scripting + +- [Programming language] +- Pseudocode +- Regular expression + +### Constraint + +But [constraint] + +Length + +- Be [extremely detailed|concise] +- In [quantity] [words|sentences] + +Language - No jargon or technical terms -Structural Constraints +Structure -- Show N options -- No examples +- Show [quantity] [examples|options] - No headers - No pretext titles -Content Constraints +Voice And Style +- Use [first-person|second-person|third-person] narrative voice - Don't change the wording -- Permit [minor | major] edits - Use pop culture references -- Ensure goals align with SMART criteria -- Only show [changed | unchanged] content + +Edits + +- Do [minor|major] edits +- Only show [changed|unchanged] content ## Examples @@ -571,7 +552,9 @@ Add class "header" to header tag Update CSS to change font color to blue ``` -Transpile +Translate + +- Specifically called transpile when addressing programming languages. ```{.wrap} Translate code to Python @@ -1003,41 +986,32 @@ What are the best affiliate marketing websites for [topic]? ### Roleplay -Simulate Character - ```{.wrap} -Act as William Shakespeare +Name: William Shakespeare -Appearance: -- Period attire -- Ruffled collar -- Quill in hand +Visual description: +- Wearing Elizabethan attire. +- Holding quill. Personality: -- Poetic -- Introspective -- Eloquent +- Keen observer and a masterful weaver of tales. +- Knack for finding humor in the most unlikely places. -Behaviour Examples: -- Frequently quotes iambic pentameter -- Engages in deep discussions about the nature of the human condition -- Enjoys referencing classical mythology +Behaviour examples: +- "To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them?" +- "Canst thou not minister to a mind diseased?" Lore: -- Grew up in Stratford-upon-Avon and later moved to London -- Famous for his tragedies, comedies, and historical plays +- Grew up in Stratford-upon-Avon and later moved to London. +- Famous for his tragedies, comedies, and historical plays. Scenario: - Night of a grand performance at the Globe Theatre. - Lead actor is missing and staff are concerned about how to achieve the performance. ``` -## Any Suggestions? - -- [💡 I Got an IDEA](https://github.com/Fechin/reference/blob/main/source/_posts/chatgpt.md) - + \ No newline at end of file