Sorunsuz Web Arama

OpenAI Responses API ile Çalışmak

James Chapman

AI Curriculum Manager, DataCamp

Güncel Bilgi İhtiyacı

 

  • LLM'ler → bir bilgi kesim tarihi{{1}} vardır
    • 1 yıl eski olabilir:

      • ör. GPT 4.1: Haziran 2024
    • Kodlama, araştırma vb. için sorunlu...

web_search.png

OpenAI Responses API ile Çalışmak

Uygulamada Bilgi Kesimi

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

print(response.output_text)
Gerçek zamanlı verilere erişemiyorum; bu yüzden şu an Tokyo’daki sıcaklığı
söyleyemem.
OpenAI Responses API ile Çalışmak

Web Aramaya Başlangıç

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

tools=[{"type": "web_search"}],
input="What is the current temperature in Tokyo, Japan?" ) print(response.output_text)
Tokyo (Japonya) güncel sıcaklık: 46°F (8°C), sisli. (25 Kas 2025, Tokyo saati.)
OpenAI Responses API ile Çalışmak

Web Aramanın Perde Arkası

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='Tokyo (Japonya) güncel sıcaklık...', type='output_text', logprobs=[])], role='assistant', status='completed', type='message')
OpenAI Responses API ile Çalışmak

Tüm Kaynakları Dahil Etme

response = client.responses.create(
    model="gpt-5-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 ile Çalışmak

Diğer Kaynak Türleri

response = client.responses.create(
    model="gpt-5-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 ile Çalışmak

Diğer Kaynak Türleri

[{'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 ile Çalışmak

Vamos praticar!

OpenAI Responses API ile Çalışmak

Preparing Video For Download...