본문 바로가기
C.W.K.
Stream
Lesson 04 of 07 · published

Built-in Tools — web_search, code_interpreter, file_search

~22 min · hosted-tools, web-search, code-interpreter, file-search

Level 0Tokenizer
0 XP0/54 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Responses 의 hosted tool 은 tools=[{"type":"web_search"}] 처럼 한 줄로 켤 수 있어. 같은 기능을 직접 만들려면 검색 제공자 연결, 실행 환경, 저장소를 따로 구축해야 해. 먼저 hosted tool 을 검토하고 요구에 맞지 않을 때 custom tool 로 내려가.

대표 hosted tool 세 가지

  • web_search — OpenAI 가 선택한 검색 제공자를 통해 웹을 검색해.
  • code_interpreter — 격리된 Python 환경에서 모델이 코드를 작성하고 실행한 뒤 결과를 해석해.
  • file_search — vector store 에 올린 PDF 나 문서를 검색해 답변 문맥으로 사용해.

도구 비용은 따로 계산해

hosted tool 은 모델 token 비용과 별도로 과금돼. web_search 와 code_interpreter 는 호출 기준, file_search 는 query 와 저장 용량 기준 비용이 있어. 모델이 loop 안에서 여러 번 호출할 수 있게 열기 전에 현재 pricing 을 확인해.

custom tool 이 필요한 때

검색 제공자를 직접 선택해야 하거나 사내 데이터와 권한 규칙을 연결해야 한다면 custom function tool 로 감싸. 그런 요구가 없다면 hosted tool 이 구현과 운영 부담을 크게 줄여줘.

Code

web_search 와 code_interpreter 활성화·python
# Web search
response = client.responses.create(
    model="gpt-5.4",
    input="What is the current price of NVIDIA stock?",
    tools=[{"type": "web_search"}],
)

# File search (requires vector store)
response = client.responses.create(
    model="gpt-5.4",
    input="Summarize the Q3 earnings report.",
    tools=[{"type": "file_search", "vector_store_ids": ["vs_abc123"]}],
)

# Code interpreter
response = client.responses.create(
    model="gpt-5.4",
    input="Calculate the 10,000th Fibonacci number.",
    tools=[{"type": "code_interpreter"}],
)

# Image generation
response = client.responses.create(
    model="gpt-4.1-mini",
    input="Generate an image of a sunset over the ocean.",
    tools=[{"type": "image_generation"}],
)

# Computer use
response = client.responses.create(
    model="computer-use-preview",
    input="Take a screenshot and tell me what's on the screen.",
    tools=[{"type": "computer", "display_width": 1024, "display_height": 768}],
)

External links

Exercise

web_search 와 PDF 다섯 개를 넣은 file_search vector store 를 함께 쓸 수 있는 Q&A loop 를 만들어. 질문마다 모델이 어느 도구를 호출했는지 기록하고, 기대한 경로를 고를 때까지 system instruction 을 다듬어.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.