Skip to content

Commit 5e6c183

Browse files
kamilamin123luigiw
andauthored
fix:AttributeError in _openai_utils.py with Azure OpenAI Async Streaming #4000 (#4001)
# Description #4000 # All Promptflow Contribution checklist: - [x] **The pull request does not introduce [breaking changes].** - [x] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [x] **I have read the [contribution guidelines](https://github.com/microsoft/promptflow/blob/main/CONTRIBUTING.md).** - [x] **I confirm that all new dependencies are compatible with the MIT license.** - [x] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [x] Pull request includes test coverage for the included changes. --------- Co-authored-by: Hanchi Wang <[email protected]>
1 parent e78109d commit 5e6c183

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/promptflow-tracing/promptflow/tracing/_openai_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def get_generated_message(self):
253253
chunks = []
254254
role = "assistant"
255255
for item in self._response:
256-
if item.choices and item.choices[0].delta.content:
256+
if item.choices and item.choices[0].delta and getattr(item.choices[0].delta, "content", None):
257257
chunks.append(item.choices[0].delta.content)
258258
role = item.choices[0].delta.role or role
259259
return {"content": "".join(chunks), "role": role} if chunks else None

0 commit comments

Comments
 (0)