-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working