본문 바로가기

명사 美 비격식 (무리 중에서) 아주 뛰어난[눈에 띄는] 사람[것]

이론

openai api란? api_key, 예시코드, web_search, File Search, Code Interpreter, Function Calling, Remote MCP, Streaming, Agents

 

 


openai api는 텍스트 생성, 자연어 처리, 이미지 이해등 다양한 작업을 api로 사용할 수 있다. 

OpenAI API는 프로그램에서 ChatGPT(GPT-5.5)를 사용할 수 있도록 해주는 서비스

sk-xxxxxxxxxxxxxxxxxxxx 처럼 생긴 비밀번호 키로 인증해 권한설정.

api_key="sk-xxxx" 등으로 문서에 작성하면 git에도 올라갈수도있어 위험하니 환경변수에 저장하라. export OPENAI_API_KEY="your_api_key_here". Windows에서는 OPENAI_API_KEY라는 이름으로 등록하면 SDK가 자동으로 읽는다 .

SDK는 직접 HTTP요청을 보내지않아도되는 API를 쉽게 사용할 수 있게 만든 라이브러리

[js] npm install openai / [python] pip install openai

https://standout.tistory.com/1075

 

API란?

API Application Programming Interface 프로그램에 요청을 전달하기위한 통로 혹은 방법

standout.tistory.com

https://standout.tistory.com/1559

 

SDK란?: SDK와 JDK

SDKSoftware Development Kit소프트웨어 개발에 필요한 도구들의 모음특정 프레임워크나 언어에 대한 SDK도 있다.아래와 같이 구성된다. 도구 (Tools): 소스 코드 편집기, 디버거, 빌드 도구 등라이브러리

standout.tistory.com

 

 

 

예시사용

import OpenAI from "openai";

const client = new OpenAI();

const response = await client.responses.create({

model: "gpt-5.5",

input: "Write a one-sentence bedtime story about a unicorn."

});

console.log(response.output_text);

 

 

 

 

기본 훈련된 지식만 사용하는 gpt에게 "web_search"설정으로 인터넷 검색 권한을 줄 수 있다 . 외 업로드한 파일 검색 File Search, Python 코드 실행 및 데이터 분석 Code Interpreter, 사용자가 만든 함수(API) 호출 Function Calling, 외부 시스템이나 서비스와 연결 Remote MCP 가 있다 .

tools:[

{type:"web_search"}

]

https://standout.tistory.com/1876

 

RAG(Retrieval-Augmented Generation)와 LLM의 Hallucination(환각): 외부 문서를 검색한 후 검색 결과를 바탕으

RAG(Retrieval-Augmented Generation)기업은 범용 언어모델을 그대로 사용하는 것이 아니라 사내 문서, 정보, 고객데이터 등을 추가해 기업전용 AI시스템을 구축하며 LLM은 이때 존재하지않는 정보를 생성

standout.tistory.com

 

 

Streaming으로 즉시답변생성이 아닌 타이핑되듯 답변이 나타날 수 있다 .

거의 지연없이 음성과 이미지를 처리하는 api Realtime API 가 있다. 이로 ai음성 비서등을 만들수있다.

Agents는 가장 최신 기능중 하나로 역할이 다른 ai를 만들어 협력하게할 수 있다.

https://developers.openai.com/api/docs/quickstart

 

Developer quickstart | OpenAI API

Learn how to use the OpenAI API to generate human-like responses to natural language prompts, analyze images with computer vision, use powerful built-in tools, and more.

developers.openai.com

https://standout.tistory.com/1886

 

Agents Agentic AI의 4요소 LLM, 도구, 기억, 루프 : 프롬프트, API 호출, Agent Loop, RAG, 장기기억, 팀협업(fe

Agentic AI 에이전트형 AI 두뇌 LLM에 세가지를 붙인 시스템 도구, 기억, 루프.말은 잘하지만 스스로 행동은 못하는 도구. 여기에 도구.기억.반복 루프를 붙여 실제로 일을 끝내게 만든것이 에이전트.

standout.tistory.com