• https://platform.openai.com/docs/api-reference
    • [ENDPOINTS]
    •  Chat
      • multi-turn 대화 생성에 유용함.
      • gpt-3.5 에서는 "system 메세지" 가 잘 안먹혔는데, gpt-4 부터는 더 주의를 기울이도록 훈련 한다고 함.
      • POST https://api.openai.com/v1/chat/completions
        • model : …
        • messages :
          • role : system, user, assistant
          • content : ... 
          • name : 메세지 작성자 (a-z, A-Z, 0-9, and underscores) (64자)
        • temperature : 0~1 사이값 (0:정확성 ~ 1 :다양성)
        • top_p : (temperature 대신해서) 사용할수있는 쌤플링 옵션. (예: 0.1 == 상위 10% 만 사용)
          • temperature , top_p 둘다 사용하는건 비추 한다고 함!
        • n : 몇개를 만들것인가? (max_tokens 와 stop 을 잘 셋팅해서… 너무 많이 되지않게 주의!)
        • max_tokens : 생성될 최대 토큰수 (즉, messages 토큰수 + max_tokens 이하로 완성됨!)
        • stop: 추가 생성을 중지하는데 참고할 시퀀스 (최대 4개)
        • seed : effort to sample deterministically. (requests with the same seed and params -> same result)
        • stream: `for r in response` 식의 토큰단위(?) 처리가 가능?!?!
        • presence_penalty : -2.0 ~ 2.0 사이값 (새 주제로 이야기 가능성 높임)
        • frequency_penalty : -2.0 ~ 2.0 사이값 (동일한 반복의 가능성을 낮춤)
        • logit_bias : 특정 토큰값이 나타날 확률을 튜닝
        • logprobs : 출력된 토큰의 로그 확률을 함께 반환
        • top_logprobs : ...
        • response_format : 'text' 혹은 'json_object' ( system 또는 user 메시지 으로 꼭 명시해죠)
        • user: 쿼리마다 해당 사용자ID를 표식하여… 어뷰징 모니터링 등등에 활용하기 좋음!
      • -> The chat completion object
      • -> The chat completion chunk object
    • Moderations
    • ----------------------------------------------------------------------------------------------------
    • Audio
    • ----------------------------------------------------------------------------------------------------
    • Images
    • ----------------------------------------------------------------------------------------------------
    • Files
    • Uploads
    • Fine-tuning
      • POST https://platform.openai.com/docs/api-reference/fine-tuning/create
        • model : ...
        • training_file :
        • validation_file : 
        • hyperparameters :
          • batch_size, learning_rate_multiplier, n_epochs
        • suffix : 생성되는 모델명 접미어
        • seed : 똑같은 시드값을 주면 -> 왠만하면 같은 결과로 나온다고 함. (디폴트 랜덤)
      • -> The fine-tuning job object
    • [ASSISTANTS]
    • ...
    • [REALTIME]
    • Client-Events
    • Server-Events
  • ;
  • https://pypi.org/project/openai
    • Usage
    • Vision
    • Polling Helpers , Bulk Upload Helpers 
      • '_and_poll' 식으로 끝나는 메소드를 통해~ 특정 오래걸리는 비동기 실행의 완료까지를 다룰수있음. 
      • 즉, 한번에 여러파일 대용량 업로더 사용시에도~ 그 상태를 모니터링 할 수 있는거임.
    • Streaming Helpers
      • Assistant Streaming API 전용 문서 : https://github.com/openai/openai-python/blob/main/helpers.md 있음.
    • Async usage
      • 비동기 프레임워크 사용시, AsyncOpenAI(...) 를 선언하고 await 호출도 똑같이 사용이 가능함.
    • Streaming Responses
      • Server Side Events (SSE) 로 for chunk in stream: 식으로 지원함.
    • Module-level client
      • Global Client 보다는, 대신 Client 를 인스턴스화 하여 사용하는것을 강추!   예) client = OpenAI()
        • It can be difficult to reason about where client options are configured
        • It's not possible to change certain client options without potentially causing race conditions
        • It's harder to mock for testing purposes
        • It's not possible to control cleanup of network connections
    • Using types , Nested params
      • https://docs.python.org/3/library/typing.html#typing.TypedDict
    • Pagination (파인튜닝)
    • File Uploads (파인튜닝)
    • Handling errors, Request _IDs, Retries, Timeouts : ...
    • Advanced
      • Logging
      • How to tell whether None means null or missing
      • Accessing raw response data (e.g. headers)
      • Making custom/undocumented requests
      • Configuring the HTTP client
      • Managing HTTP resources
    • Microsoft Azure OpenAI
      • ...
  • ;

'AI' 카테고리의 다른 글

OpenAI Doc2  (0) 2024.05.25
OpenAI Cookbook (CHAT COMPLETIONS)  (0) 2024.05.24
OpenAI Docs  (0) 2023.01.29
Hugging Face  (0) 2022.09.10
facebook research  (0) 2022.04.29

+ Recent posts