Položky odpovědi: Základní stavební bloky

Working with the OpenAI Responses API

James Chapman

AI Curriculum Manager, DataCamp

Cesta

 

ch1_recap0.jpg

Working with the OpenAI Responses API

Cesta

 

ch1_recap3.jpg

Working with the OpenAI Responses API

Cesta

 

ch1_recap3.jpg

Working with the OpenAI Responses API

Cesta

 

ch1_recap3.jpg

tool_concept.png

Working with the OpenAI Responses API

Vaše sada položek

for item in response.output:
    print(item)
ResponseReasoningItem(id='rs_0471305df20125be00692440df2ed88193bd532a15ee6ab7dc',
                      summary=[], type='reasoning', content=None, encrypted_content=None,
                      status=None)
ResponseOutputMessage(id='msg_0471305df20125be00692440df642481938921f6bd2c119688',
                      content=[ResponseOutputText(annotations=[], text='The OpenAI...',
                                                  type='output_text', logprobs=[])],
                      role='assistant', status='incomplete', type='message')
Working with the OpenAI Responses API

Položky jako stavební bloky

for item in response.output:

if item.type == "message":
if item.status == "incomplete":
print("Message cut-off!")
Message cut-off!
Working with the OpenAI Responses API

Položky jako stavební bloky

for item in response.outputs:

if item.type == "reasoning"
if item.summary: print(f"Reasoning Summary: {item.summary[0]}") else: print("No reasoning summary available.")
if item.type == "message": print(f"Assistant: {item.content[0].output_text}")
No reasoning summary available.

Assistant: The OpenAI...
Working with the OpenAI Responses API

Co nás čeká...

 

Aktuální typy položek

  • 'reasoning'
  • 'message'

 

for item in response.output:
    if item.type == "message":
        if item.status == "incomplete":
            print("Message cut-off!")

 

Nové typy položek

  • 'web_search_call'
  • 'function_call'
  • 'function_call_output'
Working with the OpenAI Responses API

Pojďme si procvičit!

Working with the OpenAI Responses API

Preparing Video For Download...