Gratulujeme!

Working with the OpenAI Responses API

James Chapman

AI Curriculum Manager, DataCamp

Kapitola 1: Úvod do Responses API

 

response = client.responses.create(
    model="gpt-5.4-mini",
    input="What is recursion?",
    reasoning={"effort": "none"},
    max_output_tokens=500
)

Logo Responses API

Working with the OpenAI Responses API

Kapitola 2: Webové vyhledávání

Webové vyhledávání

Working with the OpenAI Responses API

Kapitola 2: Nástroje pro volání funkcí

Nástroje pro volání funkcí

Working with the OpenAI Responses API

Kapitola 3: Strukturované výstupy

from pydantic import BaseModel

class QuizResult(BaseModel):
    score: int
    passed: bool
    feedback: str
result = response.output_parsed

print(f"Score: {result.score}/10")
print(f"Passed: {result.passed}")
print(f"Feedback: {result.feedback}")
response = client.responses.parse(
    model="gpt-5.4-mini",
    instructions="...",
    input="...",
    text_format=QuizResult
)
Working with the OpenAI Responses API

Kapitola 3: Streamování a sémantické události

  • stream=True

 

Typ události Popis
response.created Model začal generovat
response.output_text.delta Částečná aktualizace textu
response.output_text.done Textový blok dokončen
response.function_call.arguments.delta Streamování argumentů nástroje
response.completed Celá odpověď dokončena
Working with the OpenAI Responses API

Kapitola 3: Multimodalita

- Shrnutí: Mírný pokles – závěrečná cena
277,18, pokles o cca 0,26 % oproti předchozímu
závěru; v době po uzavření burzy mírný pokles na
276,94.

Graf akcií AAPL na Yahoo Finance

1 Apple, Inc. – graf akcií ze yahoo!finance
Working with the OpenAI Responses API

Pojďme cvičit!

Working with the OpenAI Responses API

Preparing Video For Download...