fix python_api example (#10196)

### What problem does this PR solve?

Fix coding example in example

### Type of change

- [x] Documentation Update
This commit is contained in:
Shaun Zhang
2025-09-22 17:27:25 +08:00
committed by GitHub
parent 94dbd4aac9
commit da80fa40bc

View File

@ -85,11 +85,11 @@ completion = client.chat.completions.create(
)
if stream:
for chunk in completion:
print(chunk)
if reference and chunk.choices[0].finish_reason == "stop":
print(f"Reference:\n{chunk.choices[0].delta.reference}")
print(f"Final content:\n{chunk.choices[0].delta.final_content}")
for chunk in completion:
print(chunk)
if reference and chunk.choices[0].finish_reason == "stop":
print(f"Reference:\n{chunk.choices[0].delta.reference}")
print(f"Final content:\n{chunk.choices[0].delta.final_content}")
else:
print(completion.choices[0].message.content)
if reference: