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

The return value of the vector_stores.file_batches.poll method contains the ID of the VectorStore.

Đang mở
#2,724 1 bình luận 0 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu từ phương thức vector_stores.file_batches.poll và tái hiện hành vi bằng mã mẫu trong issue này. So sánh các trường id và object của đối tượng VectorStoreFileBatch được trả về với batch_obj; công việc được hoàn tất khi kết quả polling nhất quán biểu diễn file batch và trả về ID mong đợi của nó, kèm theo một regression test bao quát hành vi này.

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

Mô tả

bug
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

The expected result is that the file_batches object ID should be stored and returned.

To Reproduce

Run the sample code.
call poll method.

Code snippets
import openai

file_obj = None
vector_store_obj = None

try:
    client = openai.OpenAI(
        api_key=os.environ['OPENAI_API_KEY']
    )
    file_obj = client.files.create(file=('test_data.json', b'{"aa": "AA"}\n'), purpose='user_data')
    vector_store_obj = client.vector_stores.create(name='test_vector_store')

    batch_obj = client.vector_stores.file_batches.create(
        vector_store_id=vector_store_obj.id,
        file_ids=[file_obj.id]
    )
    print(f'type:[{type(batch_obj)}]')
    print(batch_obj.model_dump_json(indent=2))

    response = client.vector_stores.file_batches.poll(batch_id=batch_obj.id, vector_store_id=vector_store_obj.id)
    print(f'type:[{type(response)}]')
    print(response.model_dump_json(indent=2))

    print("# The return value contains the vector_store id.")
    print("# Shouldn't the return value of the file_batches.poll method be the batch_obj ID?")
    print(f'# OpenAI version:[{openai.__version__}]')

finally:
    if file_obj:
        client.files.delete(file_id=file_obj.id)
    if vector_store_obj:
        client.vector_stores.delete(vector_store_id=vector_store_obj.id)

# Below are the execution results.
'''
type:[<class 'openai.types.vector_stores.vector_store_file_batch.VectorStoreFileBatch'>]
{
  "id": "vsfb_ibj_6905db4e33dc81f4a789ad8df2b5c748",
  "created_at": 1761991502,
  "file_counts": {
    "cancelled": 0,
    "completed": 0,
    "failed": 0,
    "in_progress": 1,
    "total": 1
  },
  "object": "vector_store.file_batch",
  "status": "in_progress",
  "vector_store_id": "vs_6905db4d53708191a75c5ef9979258fd"
}
type:[<class 'openai.types.vector_stores.vector_store_file_batch.VectorStoreFileBatch'>]
{
  "id": "vs_6905db4d53708191a75c5ef9979258fd",
  "created_at": 1761991501,
  "file_counts": {
    "cancelled": 0,
    "completed": 1,
    "failed": 0,
    "in_progress": 0,
    "total": 1
  },
  "object": "vector_store",
  "status": "completed",
  "vector_store_id": null,
  "name": "test_vector_store",
  "description": null,
  "usage_bytes": 0,
  "expires_after": null,
  "expires_at": null,
  "last_active_at": 1761991501,
  "metadata": {}
}
# The return value contains the vector_store id.
# Shouldn't the return value of the file_batches.poll method be the batch_obj ID?
# OpenAI version:[1.109.1]
'''
OS

Ubuntu24.04

Python version

Python3.12.3

Library version

openai v1.109.1

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

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.