Open
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
When streaming from azure open ai API the delta of the choice is None. In the python open ai client v1.42.0 delta is type ChoiceDelta
i.e. not None
.
To Reproduce
Run this code in line with
completion = await self._client.chat.completions.create(
model=self.deployment.name,
messages=cast(list[ChatCompletionMessageParam], messages),
stream=True,
temperature=temperature,
)
async for response_chunk in completion:
...
The types are:
response_chunk: ChatCompletionChunk
response_chunk.choices: list[Choice]
response_chunk.choices[0].delta: ChoiceDelta
The response from azure open ai API returns delta=None
when stream ends
Response example:
Choice(delta=None, finish_reason=None ...........)
Code snippets
No response
OS
linux, ubuntu 20.04
Python version
3.12.1
Library version
openai v 1.42.0