본문 바로가기

Data Science/Prompt Engineering

ChatGPT Prompt Engineering for Developers - (6) Transforming

반응형

DeepLearning.AI 강의 ChatGPT Prompt Engineering for Developers - Transforming 요약

 

https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/

 

ChatGPT Prompt Engineering for Developers

What you’ll learn in this course In ChatGPT Prompt Engineering for Developers, you will learn how to use a large language model (LLM) to quickly build new and powerful applications.  Using the OpenAI API, you’ll...

www.deeplearning.ai

 

LLM에게 번역을 명령할 때

 

 

텍스트가 사용되는 상황 혹은 원하는 어조를 명시

prompt = f"""
Translate the following from slang to a business letter: 
'Dude, This is Joe, check out this spec on this standing lamp.'
"""
response = get_completion(prompt)
print(response)

 

 

구조화된 출력 방식을 명시

data_json = { "resturant employees" :[ 
    {"name":"Shyam", "email":"shyamjaiswal@gmail.com"},
    {"name":"Bob", "email":"bob32@gmail.com"},
    {"name":"Jai", "email":"jai87@gmail.com"}
]}

prompt = f"""
Translate the following python dictionary from JSON to an HTML \
table with column headers and title: {data_json}
"""
response = get_completion(prompt)
print(response)


from IPython.display import display, Markdown, Latex, HTML, JSON
display(HTML(response))

 

 

문법 및 철자 검사 요청

text = [ 
  "The girl with the black and white puppies have a ball.",  # The girl has a ball.
  "Yolanda has her notebook.", # ok
  "Its going to be a long day. Does the car need it’s oil changed?",  # Homonyms
  "Their goes my freedom. There going to bring they’re suitcases.",  # Homonyms
  "Your going to need you’re notebook.",  # Homonyms
  "That medicine effects my ability to sleep. Have you heard of the butterfly affect?", # Homonyms
  "This phrase is to cherck chatGPT for speling abilitty"  # spelling
]
for t in text:
    prompt = f"""Proofread and correct the following text
    and rewrite the corrected version. If you don't find
    and errors, just say "No errors found". Don't use 
    any punctuation around the text:
    ```{t}```"""
    response = get_completion(prompt)
    print(response)
    
    
    
from redlines import Redlines

diff = Redlines(text,response)
display(Markdown(diff.output_markdown))

 

반응형