llama-index-llms-openai 0.3.40__py3-none-any.whl → 0.3.41__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.
@@ -309,14 +309,6 @@ def to_openai_message_dict(
309
309
  if isinstance(block, TextBlock):
310
310
  content.append({"type": "text", "text": block.text})
311
311
  content_txt += block.text
312
- elif isinstance(block, DocumentBlock):
313
- if not block.data:
314
- file_buffer = block.resolve_document()
315
- b64_string = block._get_b64_string(data_buffer=file_buffer)
316
- else:
317
- b64_string = block.data.decode("utf-8")
318
- mimetype = block.document_mimetype if block.document_mimetype is not None else "application/pdf"
319
- content.append({"type": "input_file", "filename": block.title, "file_data": f"data:{mimetype};base64,{b64_string}"})
320
312
  elif isinstance(block, ImageBlock):
321
313
  if block.url:
322
314
  content.append(
@@ -428,6 +420,14 @@ def to_openai_responses_message_dict(
428
420
  if isinstance(block, TextBlock):
429
421
  content.append({"type": "input_text", "text": block.text})
430
422
  content_txt += block.text
423
+ elif isinstance(block, DocumentBlock):
424
+ if not block.data:
425
+ file_buffer = block.resolve_document()
426
+ b64_string = block._get_b64_string(file_buffer)
427
+ mimetype = block._guess_mimetype()
428
+ else:
429
+ b64_string = block.data.decode("utf-8")
430
+ content.append({"type": "input_file", "filename": block.title, "file_data": f"data:{mimetype};base64,{b64_string}"})
431
431
  elif isinstance(block, ImageBlock):
432
432
  if block.url:
433
433
  content.append(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-index-llms-openai
3
- Version: 0.3.40
3
+ Version: 0.3.41
4
4
  Summary: llama-index llms openai integration
5
5
  Author: llama-index
6
6
  License-Expression: MIT
@@ -2,8 +2,8 @@ llama_index/llms/openai/__init__.py,sha256=8nmgixeXifQ4eVSgtCic54WxXqrrpXQPL4rhA
2
2
  llama_index/llms/openai/base.py,sha256=fu4Y1uX8IuOtVTHqaG-tyd_PpN9bUfnW6ESoyaptaVs,38620
3
3
  llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  llama_index/llms/openai/responses.py,sha256=SdTAqO2FqGuvm9u01BlI92IpY0RhOaJ3mU03Rc0OHso,34525
5
- llama_index/llms/openai/utils.py,sha256=muOF4y0GdHAx1IShN8mzPknfcXD9CbGVnT126v0jjcY,27092
6
- llama_index_llms_openai-0.3.40.dist-info/METADATA,sha256=Y-clVQQJI87rINC8loiY6IAWJCH8kRzxS5Yt6Ayd_SA,3040
7
- llama_index_llms_openai-0.3.40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- llama_index_llms_openai-0.3.40.dist-info/licenses/LICENSE,sha256=JPQLUZD9rKvCTdu192Nk0V5PAwklIg6jANii3UmTyMs,1065
9
- llama_index_llms_openai-0.3.40.dist-info/RECORD,,
5
+ llama_index/llms/openai/utils.py,sha256=BiHTTRgCQ07GUhuWxG_J_vG8-YK3FIYgRjg2cwix2Qk,27022
6
+ llama_index_llms_openai-0.3.41.dist-info/METADATA,sha256=Xfj-rmVx63Ezz_PbvtHLgMHaqLWx8nmKqdRLw0GH_c0,3040
7
+ llama_index_llms_openai-0.3.41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ llama_index_llms_openai-0.3.41.dist-info/licenses/LICENSE,sha256=JPQLUZD9rKvCTdu192Nk0V5PAwklIg6jANii3UmTyMs,1065
9
+ llama_index_llms_openai-0.3.41.dist-info/RECORD,,