Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Output response types are not usable as parameters

Đang mở
#2,323 0 bình luận 5 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api, developer-experience

Hướng nghiên cứu

Bắt đầu bằng cách so sánh src/openai/types/responses/easy_input_message_param.py và src/openai/types/responses/response_output_message.py, tập trung vào các trường bắt buộc được mô tả trong báo cáo. Theo dõi cách các kiểu được tự động tạo này được sinh ra trước khi quyết định thay đổi khả năng tương thích nên được đặt ở đâu. Công việc được xem là hoàn tất khi mẫu messages.append(item) được báo cáo vượt qua kiểm tra kiểu Python mà không làm suy yếu các yêu cầu dự kiến đối với kiểu response và input.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug sdk
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

Consider the following code:

messages: ResponseInputParam = [{"role": "developer", "content": instructions}]

# ...
resp = client.responses.create(
    model="o4-mini",
    input=messages,
)

for item in resp.output:
    match item:
        case ResponseOutputMessage(content=content):
            print(item.content)
            messages.append(item)

This seems like it should work fine, but it generates a type checking error:

error: Argument of type "ResponseOutputMessage" cannot be assigned to parameter "object" of type "ResponseInputItemParam" in function "append"
    Type "ResponseOutputMessage" is not assignable to type "ResponseInputItemParam"
      "ResponseOutputMessage" is not assignable to "EasyInputMessageParam"
      "ResponseOutputMessage" is not assignable to "Message"
      "ResponseOutputMessage" is not assignable to "ResponseOutputMessageParam"
      "ResponseOutputMessage" is not assignable to "ResponseFileSearchToolCallParam"
      "ResponseOutputMessage" is not assignable to "ResponseComputerToolCallParam"
      "ResponseOutputMessage" is not assignable to "ComputerCallOutput"
      "ResponseOutputMessage" is not assignable to "ResponseFunctionWebSearchParam"
    ... (reportArgumentType)

I think this is because the parameter types use Required, but the output types don't. For example, EasyMessageInputParam requires content, but ResponseOutputMessage doesn't:

https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/easy_input_message_param.py#L13-L18

vs

https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/response_output_message.py#L20-L21

I recognize that the bindings are auto-generated and this may not be trivial to fix.

To Reproduce

n/a

Code snippets

OS

linux

Python version

Python v3.13.2

Library version

openai v1.75.0

Ngôn ngữ chính
Python
Star
31.7k
Fork
6.8k
Merge trung bình
2 ngày 8 giờ
Pull request đã merge (30 ngày)
121

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openai/openai-python

Tất cả issue của openai/openai-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.