llama-index-llms-openai 0.3.19__py3-none-any.whl → 0.3.21__py3-none-any.whl

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.
@@ -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
 
@@ -354,7 +359,11 @@ def to_openai_message_dict(
354
359
  }
355
360
 
356
361
  # TODO: O1 models do not support system prompts
357
- if model is not None and model in O1_MODELS:
362
+ if (
363
+ model is not None
364
+ and model in O1_MODELS
365
+ and model not in O1_MODELS_WITHOUT_FUNCTION_CALLING
366
+ ):
358
367
  if message_dict["role"] == "system":
359
368
  message_dict["role"] = "developer"
360
369
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-index-llms-openai
3
- Version: 0.3.19
3
+ Version: 0.3.21
4
4
  Summary: llama-index llms openai integration
5
5
  License: MIT
6
6
  Author: llama-index
@@ -0,0 +1,7 @@
1
+ llama_index/llms/openai/__init__.py,sha256=vm3cIBSGkBFlE77GyfyN0EhpJcnJZN95QMhPN53EkbE,148
2
+ llama_index/llms/openai/base.py,sha256=9HBszflpKp81gRSMaWKVa4PnG6sLfV9mWOyAkTM7MUI,38055
3
+ llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ llama_index/llms/openai/utils.py,sha256=Hskpn6pK7uKPlZgs7BbyTahcXBlsYicXo8GVHf2_uKE,20910
5
+ llama_index_llms_openai-0.3.21.dist-info/METADATA,sha256=RhtKor0qomLXf2a36QewnV0O3W_xnYXMg0ocODgdits,3322
6
+ llama_index_llms_openai-0.3.21.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
+ llama_index_llms_openai-0.3.21.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- llama_index/llms/openai/__init__.py,sha256=vm3cIBSGkBFlE77GyfyN0EhpJcnJZN95QMhPN53EkbE,148
2
- llama_index/llms/openai/base.py,sha256=9HBszflpKp81gRSMaWKVa4PnG6sLfV9mWOyAkTM7MUI,38055
3
- llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- llama_index/llms/openai/utils.py,sha256=iccv7WhW6a_h2c6uIVNkxsgVTKav79B3z3Xb4bxmCeM,20624
5
- llama_index_llms_openai-0.3.19.dist-info/METADATA,sha256=0-WvrMN-0zlSjShW6GAYPC4mukiPoQBwPsbeQsfos3o,3322
6
- llama_index_llms_openai-0.3.19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
- llama_index_llms_openai-0.3.19.dist-info/RECORD,,