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:
parent
94dbd4aac9
commit
da80fa40bc
1 changed files with 5 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue