model : gpt-3.5-turbo

https://openai.com/blog/introducing-chatgpt-and-whisper-apis

 

Introducing ChatGPT and Whisper APIs

Developers can now integrate ChatGPT and Whisper models into their apps and products through our API.

openai.com

 

파라미터 

messages = [
        {"role": "system, user, assistant 중 선택", "content": "role에 알맞게 메세지 작성"},
        {"role": "system, user, assistant 중 선택", "content": "role에 알맞게 메세지 작성"},
]
  • temperature
    • Optional
    • type : float(0.0 ~ 2.0) 
    • default : 1
    • 높을 수록 random, 낮을수록 deterministic 답변을 줌(테스트 해봐야 알 것 같음)
    • top_p과 같이 변경하는 것은 권장하지 않음
  • top_p 
    • Optional
    • type : float(0.0 ~ 1.0)
    • default : 1
    • model이 생성한 token 결과를 sampling 함(테스트 해봐야 알 것 같음)
    • temperature과 같이 변경하는 것은 권장하지 않음
  • n
    • Optional
    • type : float
    • default : 1
    • 유저 메세지에 대해 생성할 대화 개수 
  • stream
    • Optional
    • type : boolean
    • default : false
    • 보류
  • stop
    • Optional
    • type : string or array(최대 4개)
    • default : null
    • token을 생성을 종료하는 키워드 지정. 
  • max_tokens
    • Optional
    • type : integer
    • default : inf
    • 최대로 생성할 수 있는 token 길이로 보통 4096개이다.
  • presence_penalty
    • Optional
    • type : float(-2.0 ~ 2.0)
    • default : 0
    • token을 만들 때 sampling 한 결과를 기억해 페널티를 주는 방식. 양수는 새로운 주제를, 음수로 갈수록 기존의 주제를 반환할 확률이 올라감.
  • frequency_penalty
    • Optional
    • type : float(-2.0 ~ 2.0)
    • default : 0
    • token을 만들 때 sampling 한 결과를 기억해 페널티를 주는 방식. 한번의 답변에 대해 양수는 동일한 말을, 음수로 갈수록 새로운 말을 반환할 확률이 올라감. 
  • logit_bias
    • Optional
    • type : map
    • default : null
    • 보류
  • user
    • Optional
    • type : string
    • 최종 사용자를 나타내는 고유 식별자 

 

참조 

https://platform.openai.com/docs/api-reference/chat/create

 

OpenAI API

An API for accessing new AI models developed by OpenAI

platform.openai.com

https://wooiljeong.github.io/python/chatgpt-api/

 

ChatGPT API Python 사용법 (feat.DALL-E, Karlo)

ChatGPT API Python 사용법 (feat.DALL-E, Karlo)

wooiljeong.github.io

 

'ai > chatGPT' 카테고리의 다른 글

chatGPT-api 예제 코드  (0) 2023.03.26

+ Recent posts