makeBCT

#AI #OpenAI #Chatbot #Cloud #WordPress

OpenAI API : Create embeddings

임베딩이란 기계 학습 모델과 알고리즘이 쉽게 사용할 수 있는 주어진 입력의 벡터 표현(or 벡터 값)

POST https://api.openai.com/v1/embeddingsCreates an embedding vector representing the input text.
Request bodymodel (string / 필수)ID of the model to use.
input (string or array / 필수)Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.
user (string / 선택)

Request 시 (curl 사용 )

curl https://api.openai.com/v1/embeddings \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "The food was delicious and the waiter...",
    "model": "text-embedding-ada-002"
  }'

Parameters

{
  "model": "text-embedding-ada-002",
  "input": "The food was delicious and the waiter..."
}

Response 값

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        0.0023064255,
        -0.009327292,
        .... (1536 floats total for ada-002)
        -0.0028842222,
      ],
      "index": 0
    }
  ],
  "model": "text-embedding-ada-002",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

인기 글

사용자 작성 모듈 import 시 에러)(ModuleNotFoundError: No module named
파이썬 모듈을 만들고 테스트 할 때 ModuleNotFoundError: No module named 에러가 발생한 경우원인파이썬은 모듈을 불러올 때 모듈 설치 경로와 자신의...
오라클 클라우드 OCI 가입 드디어 성공 했습니다 (상세 후기)
2023년 2월 16일에 ‘오라클 클라우드 지급 검증 실패 글‘을 남긴 적이 있습니다.그 때 검색을 통해 해결 방법을 찾아 보았고, 당시 성공했던 분들의...
Permission denied (publickey) 해결 방법
Plesk에서 생성된 system user로 ftp 접속 시 다음과 같은 에러 메시지가 발생하면서 접속이 되지 않습니다.상태: 152.67.193.32:49152에 연결... 응답: fzSftp...
WSL2/Ubuntu 22.04 LTS에 Anaconda 설치 
WSL2/Ubuntu 환경에서 Python 버전별로 가상환경을 만드는 방법 중 그나마 Anaconda 방법이 좋은 것 같네요. 설치 방법은 간단합니다.1. apt update사용자...
[Ubuntu] ufw 방화벽 설정
ufw란?iptables 보다 쉽고 직관적으로 방화벽 설정을 할 수 있는 패키지ufw 상태 관리 명령어ufw의 상태를 관리하는 명령어# ufw 활성화 $ sudo...

BCT Ai Chatbot

답변을 준비중입니다 . . .