본문으로 건너뛰기

My Awesome ChatGPT

· 약 3분

개요

  • 이제는 질문을 어떻게 하느냐와 그 결과가 맞는지 틀린지 판단을 빨리하는 사람이 살아남을 것 같다.
  • 개발 관련된 팁 말고 현장에 바로 쓸만한 레파지토리들을 정리해본다.

aicommits

src/utils/openai.ts#L7
const promptTemplate =
"Write an insightful but concise Git commit message in a complete sentence in present tense for the following diff without prefacing it with anything:";

node chatgpt

const completionParams = {
temperature: 0.7,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
};

tiktoken

  • openai API를 사용하기위해 정확한 토큰 수를 구해야할 수도 있다.
  • openai/tiktoken을 사용해야하지만 파이썬이다.
  • dqbd/tiktoken 이미 벌써 노드 래퍼가 나왔다. 3.5 터보도 지원한다.
import { encoding_for_model as encodingForModel } from "@dqbd/tiktoken";

const encoder = encodingForModel("gpt-3.5-turbo");
const tokenLength = encoder.encode("YOUR_CHAT").length;

chatgpt-retrieval-plugin

openai/chatgpt-retrieval-plugin

  • .well-known 경로에 ai-plugin.json 이 manifest.json 의 역할
  • 같은 경로의 Openapi.yaml 이 엔드포인트 명세
  • 인증은 none | user_http | service_http | oauth 네 종류
  • 간단한 서비스는 service_http 정도로 충분해보임, user_http 는 고객이 API key 를 입력해야하고, oauthsearch:read 와 같은 권한 추가 필요.
  • 문서 유사도 비교를 위해 벡터 DB 를 사용하는 것으로 보이나, Node.js 의 마땅한 래퍼가 없어서 레디스로 구현하면 될듯, 하지만 Redisearch 모듈은 필요.