Skip to content

Commit 8d23110

Browse files
Merge pull request #120850 from KuiMing/patch-9
Fix KeyError by correcting image_file_id index
2 parents 919e3ba + 437d388 commit 8d23110

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

articles/ai-services/openai/how-to/assistant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ We had requested that the model generate an image of a sine wave. In order to do
365365

366366
```python
367367
data = json.loads(messages.model_dump_json(indent=2)) # Load JSON data into a Python object
368-
image_file_id = data['data'][1]['content'][0]['image_file']['file_id']
368+
image_file_id = data['data'][0]['content'][0]['image_file']['file_id']
369369

370370
print(image_file_id) # Outputs: assistant-1YGVTvNzc2JXajI5JU9F0HMD
371371
```

0 commit comments

Comments
 (0)