Output response types are not usable as parameters
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ả
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:
vs
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
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openai/openai-python
-
sdk-breaking-change v4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
openai/openai-python#3837 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openai/openai-python#3556 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
upstream
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openai/openai-python#3294 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openai/openai-python#2927 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug openapi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openai/openai-python#2502 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
conda-forge/conda-build-feedstock#289 · 1 bình luận · 1 reaction ·
-
`pulptest` no longer works in 4.0.0: `ImportError: Start directory is not importable: 'pulp/tests'`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
remove reddit feedsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
TomCasavant/ohio-sites#224 ·