llama-index-llms-openai 0.3.20__tar.gz → 0.3.21__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-index-llms-openai
3
- Version: 0.3.20
3
+ Version: 0.3.21
4
4
  Summary: llama-index llms openai integration
5
5
  License: MIT
6
6
  Author: llama-index
@@ -323,11 +323,16 @@ def to_openai_message_dict(
323
323
  raise ValueError(msg)
324
324
 
325
325
  # NOTE: Sending a null value (None) for Tool Message to OpenAI will cause error
326
- # It's only Allowed to send None if it's an Assistant Message
326
+ # It's only Allowed to send None if it's an Assistant Message and either a function call or tool calls were performed
327
327
  # Reference: https://platform.openai.com/docs/api-reference/chat/create
328
328
  content_txt = (
329
329
  None
330
- if content_txt == "" and message.role == MessageRole.ASSISTANT
330
+ if content_txt == ""
331
+ and message.role == MessageRole.ASSISTANT
332
+ and (
333
+ "function_call" in message.additional_kwargs
334
+ or "tool_calls" in message.additional_kwargs
335
+ )
331
336
  else content_txt
332
337
  )
333
338
 
@@ -29,7 +29,7 @@ exclude = ["**/BUILD"]
29
29
  license = "MIT"
30
30
  name = "llama-index-llms-openai"
31
31
  readme = "README.md"
32
- version = "0.3.20"
32
+ version = "0.3.21"
33
33
 
34
34
  [tool.poetry.dependencies]
35
35
  python = ">=3.9,<4.0"