Input files in Agents SDK

Hello there,

I am trying to send several messages to an Agent with the SDK by considering a list of TResponseInputItem

I can send several text messages in a Run, but it is being imposible to send a file. What is the way to do it?

Thanks in advance,
Carlos

Any luck with solving this?

I tried a number of combination and nothing worked:

  • [{'role': 'user', 'content': [{'type': 'input_image', 'image_url': 'https://...'}]}]
    {‘error’: {‘message’: ‘There was an issue with your request. Please check your inputs and try again’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}

  • [{'role': 'user', 'content': [{'type': 'input_image', 'image_url': {'url': 'https://...'}}]}]
    {‘error’: {‘message’: “Invalid type for ‘input[0].content[0].image_url’: expected an image URL, but got an object instead.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].image_url’, ‘code’: ‘invalid_type’}}

  • [{'role': 'user', 'content': [{'type': 'input_url', 'image_url': {'url': 'https://...'}}]}]
    {‘error’: {‘message’: “Invalid value: ‘input_url’. Supported values are: ‘input_text’, ‘input_image’, ‘output_text’, ‘refusal’, ‘input_file’, ‘computer_screenshot’, and ‘summary_text’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].type’, ‘code’: ‘invalid_value’}}

  • [{'role': 'user', 'content': [{'type': 'image_file', 'image_file': {'file_id': 'file-...', 'detail': 'low'}}]}]
    {‘error’: {‘message’: “Invalid value: ‘image_file’. Supported values are: ‘input_text’, ‘input_image’, ‘output_text’, ‘refusal’, ‘input_file’, ‘computer_screenshot’, and ‘summary_text’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].type’, ‘code’: ‘invalid_value’}}

  • [{'role': 'user', 'content': [{'type': 'input_file', 'input_file': {'file_id': 'file-...', 'detail': 'low'}}]}]
    {‘error’: {‘message’: “Unknown parameter: ‘input[0].content[0].input_file’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].input_file’, ‘code’: ‘unknown_parameter’}}

  • [{'role': 'user', 'content': [{'type': 'input_image', 'image_file': {'file_id': 'file-...', 'detail': 'low'}}]}]
    {‘error’: {‘message’: “Unknown parameter: ‘input[0].content[0].image_file’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].image_file’, ‘code’: ‘unknown_parameter’}}

  • [{'role': 'user', 'content': [{'type': 'input_image', 'input_file': {'file_id': 'file-...', 'detail': 'low'}}]}]
    {‘error’: {‘message’: “Unknown parameter: ‘input[0].content[0].input_file’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].content[0].input_file’, ‘code’: ‘unknown_parameter’}}

Also, there is no clear documentation on this for Agents SDK.

Anybody any luck with this?

You can check official examples, e.g., remote image