반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

'code-davinci-003'에 해당되는 글 1

  1. 2023.03.04 Openai cookbook : GPT-3 , Code explanation examples


반응형

오늘은 Openai cookbook의 Code explanation 예제 페이지를 살펴 보겠습니다.

https://github.com/openai/openai-cookbook/blob/main/code_explanation_examples.md

 

GitHub - openai/openai-cookbook: Examples and guides for using the OpenAI API

Examples and guides for using the OpenAI API. Contribute to openai/openai-cookbook development by creating an account on GitHub.

github.com

 

Code explanation examples

GPT의 코드에 대한 이해는 많은 use case들에 적용할 수 있습니다.

 

  • Generating in-code documentation (e.g., Python docstrings, git commit messages)
  • 코드 내 문서 생성 (예 파이썬 docstrings, git commit 메세지)
  • Generating out-of-code documentation (e.g., man pages)
  • 코드 외 문서 생성 (예 매뉴얼 페이지
  • An interactive code exploration tool
  • 대화형 코드 탐색 도구
  • Communicating program results back to users via a natural language interface
  • 프로그램 결과를 자연어 인터페이스를 통해 사용자에게 다시 전달

예를 들어 당신이 한 SQL 쿼리에 대해 이해하기를 원한다면 code-davinci-002 에게 아래 예제 프롬프트를 제공하는 방법을 사용할 수 있습니다.

 

A SQL query:
```
SELECT c.customer_id
FROM Customers c
JOIN Streaming s
ON c.customer_id = s.customer_id
WHERE c.signup_date BETWEEN '2020-03-01' AND '2020-03-31'
AND s.watch_date BETWEEN c.signup_date AND DATE_ADD(c.signup_date, INTERVAL 30 DAY)
GROUP BY c.customer_id
HAVING SUM(s.watch_minutes) > 50 * 60
```

Questions:
1. What does the SQL query do?
2. Why might someone be interested in this time period?
3. Why might a company be interested in this SQL query?

Answers:

 

Output

1. The SQL query finds all customers who signed up in March 2020 and watched more than 50 hours of content in the first 30 days after signing up.
2. The time period is interesting because it is the first month of the COVID-19 pandemic.
3. A company might be interested in this SQL query because it can help them understand how the pandemic has affected their business.

Note : code-davinci-002는 instruction을 따르도록 훈련되지 않았으므로 일반적으로 output을 조정하는데 도움이 되는 예제 또는 기타 structure와 생성을 제때에 멈출 수 있게 하는 stop sequence들이 필요합니다. 더 쉽게 프롬프트 하려면 text-davinci-003을 사용하세요.

 

반응형
이전 1 다음