웹 검색 바로 시작하기

OpenAI Responses API 활용하기

James Chapman

AI Curriculum Manager, DataCamp

최신 정보의 필요성

 

  • LLM은 → 지식 차단 시점이 있습니다
    • 1년 이상 지난 정보일 수 있습니다:
      • 예: GPT 4.1은 2024년 6월
    • 코딩, 리서치 등에서 문제가 될 수 있습니다...

web_search.png

OpenAI Responses API 활용하기

지식 차단 시점의 실제 사례

response = client.responses.create(
    model="gpt-5.4-mini",
    input="What is the current temperature in Tokyo, Japan?"
)

print(response.output_text)
I can't access real-time data, so I can't tell you the current temperature in
Tokyo right now.
OpenAI Responses API 활용하기

웹 검색 시작하기

response = client.responses.create(
    model="gpt-5.4-mini",

tools=[{"type": "web_search"}],
input="What is the current temperature in Tokyo, Japan?" ) print(response.output_text)
Current temperature in Tokyo (Japan): 46°F (8°C), foggy. (As of Nov 25, 2025,
Tokyo time.)
OpenAI Responses API 활용하기

웹 검색 내부 동작 원리

for item in response.output:
    print(item)
ResponseReasoningItem(id='...', summary=[], type='reasoning', content=None,
                      encrypted_content=None, status=None)

ResponseFunctionWebSearch(id='...', action=ActionSearch(query='weather: Tokyo, Japan', type='search', sources=None), status='completed', type='web_search_call')
ResponseReasoningItem(id='...', summary=[], type='reasoning', content=None, encrypted_content=None, status=None)
ResponseOutputMessage(id='...', content=[ResponseOutputText(annotations=[], text='Current temperature in Tokyo (Japan)...', type='output_text', logprobs=[])], role='assistant', status='completed', type='message')
OpenAI Responses API 활용하기

모든 소스 포함하기

response = client.responses.create(
    model="gpt-5.4-mini",
    tools=[{"type": "web_search"}],
    input="What is the current temperature in Tokyo, Japan?",

include=["web_search_call.action.sources"]
)
for item in response.output: if item.type == "web_search_call": print(item)
ResponseFunctionWebSearch(id='...', action=ActionSearch(query='weather: Tokyo, Japan',
                          type='search', sources=[ActionSearchSource(type='api', url=None,
                          name='oai-weather')]), status='completed', type='web_search_call')
OpenAI Responses API 활용하기

기타 소스 유형

response = client.responses.create(
    model="gpt-5.4-mini",
    tools=[{"type": "web_search"}],
    input="What is the latest Python version released?",
    include=["web_search_call.action.sources"]
)

for item in response.output:
    if item.type == "web_search_call":
        print(item.action.sources)
OpenAI Responses API 활용하기

기타 소스 유형

[{'type': 'url', 'url': 'https://www.python.org/doc/versions/'},
 {'type': 'url', 'url': 'https://test.python.org/doc/versions/'},
 {'type': 'url', 'url': 'https://www.techradar.com/pro/...'}]

[{'type': 'url', 'url': 'https://www.python.org/downloads/latest/python3.14/'},
 {'type': 'url', 'url': 'https://www.python.org/downloads/release/python-3140rc1/'},
 {'type': 'url', 'url': 'https://blog.python.org/2025/10/python-3140-final-is-here.html'},
 {'type': 'url', 'url': 'https://www.python.org/downloads/release/python-3140rc2/'},
 {'type': 'url', 'url': 'https://peps.python.org/pep-0745/'},
 {'type': 'url', 'url': 'https://blog.python.org/2025/05/python-3140-beta-1-is-here.html'},
 {'type': 'url', 'url': 'https://www.python.org/downloads/release/python-3140rc3/'},
 {'type': 'url', 'url': 'https://blog.python.org/2025/10/'},
 {'type': 'url', 'url': 'https://blog.python.org/2025/07/python-314-release-candidate-1-is-go.html'},
 {'type': 'url', 'url': 'https://blog.python.org/2025/01/python-3140-alpha-4-is-out.html'},
 {'type': 'url', 'url': 'https://mail.python.org/archives/list/python-announce-list...'}]
OpenAI Responses API 활용하기

연습해 봅시다!

OpenAI Responses API 활용하기

Preparing Video For Download...