Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realtime ResponseOutputItemDoneEvent model has incorrect type for the item field #2126

Open
1 task done
fedirz opened this issue Feb 15, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@fedirz
Copy link

fedirz commented Feb 15, 2025

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

ResponseOutputItemDoneEvent doesn't support item.content[0].type to have a value of "audio" (the value returned by OpenAI's API)

Image

To Reproduce

from openai.types.beta.realtime import ConversationItem, ConversationItemContent, ResponseOutputItemDoneEvent

ResponseOutputItemDoneEvent(
    event_id="event_id",
    response_id="response_id",
    type="response.output_item.done",
    output_index=0,
    item=ConversationItem(content=[ConversationItemContent(type="audio")]),
)

Output:

Traceback (most recent call last):
  File "/home/nixos/code/speaches/src/response_output_item_done_example.py", line 8, in <module>
    item=ConversationItem(content=[ConversationItemContent(type="audio")]),
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nixos/code/speaches/.venv/lib/python3.12/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for ConversationItemContent
type
  Input should be 'input_text', 'input_audio', 'item_reference' or 'text' [type=literal_error, input_value='audio', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error

Code snippets

OS

Linux

Python version

Python 3.12.5

Library version

openai 1.60.0

@fedirz fedirz added the bug Something isn't working label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant