시작하기무료로 시작하기

원샷 프롬프팅: 과연 충분할까요?

앞서 확인하신 바와 같이, 초기 프롬프트에는 개선의 여지가 있습니다. Love these! = 5 예시를 추가하고 각 리뷰 뒤에 =를 붙여 더 일관된 형식과 더 정확한 숫자를 얻을 수 있는지 확인해 보세요.

이 연습은 강의의 일부입니다

OpenAI API 활용하기

강의 보기

연습 안내

  • 프롬프트 시작 부분에 Love these! = 5 예시를 추가하고 결과 형식을 나타낼 수 있도록 프롬프트의 각 리뷰 뒤에 =를 추가하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

client = OpenAI(api_key="")

# Add the example to the prompt
prompt = """Classify sentiment as 1-5 (negative to positive):
1. ____
2. Unbelievably good! ____
3. Shoes fell apart on the second use. ____
4. The shoes look nice, but they aren't very comfortable. ____
5. Can't wait to show them off! ____"""

response = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": prompt}], max_completion_tokens=100)
print(response.choices[0].message.content)
코드 편집 및 실행