llama-index-llms-openai 0.3.38__py3-none-any.whl → 0.3.40__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.
@@ -28,6 +28,7 @@ from llama_index.core.base.llms.types import (
28
28
  MessageRole,
29
29
  TextBlock,
30
30
  AudioBlock,
31
+ DocumentBlock,
31
32
  )
32
33
  from llama_index.core.bridge.pydantic import BaseModel
33
34
 
@@ -308,6 +309,14 @@ def to_openai_message_dict(
308
309
  if isinstance(block, TextBlock):
309
310
  content.append({"type": "text", "text": block.text})
310
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}"})
311
320
  elif isinstance(block, ImageBlock):
312
321
  if block.url:
313
322
  content.append(
@@ -752,7 +761,7 @@ def update_tool_calls(
752
761
  List[ChoiceDeltaToolCall]: the updated tool calls
753
762
  """
754
763
  # openai provides chunks consisting of tool_call deltas one tool at a time
755
- if tool_calls_delta is None:
764
+ if tool_calls_delta is None or len(tool_calls_delta) == 0:
756
765
  return tool_calls
757
766
 
758
767
  tc_delta = tool_calls_delta[0]
@@ -1,18 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: llama-index-llms-openai
3
- Version: 0.3.38
3
+ Version: 0.3.40
4
4
  Summary: llama-index llms openai integration
5
- License: MIT
6
5
  Author: llama-index
7
- Requires-Python: >=3.9,<4.0
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: llama-index-core (>=0.12.17,<0.13.0)
15
- Requires-Dist: openai (>=1.66.3,<2.0.0)
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: <4.0,>=3.9
9
+ Requires-Dist: llama-index-core<0.13,>=0.12.36
10
+ Requires-Dist: openai<2,>=1.66.3
16
11
  Description-Content-Type: text/markdown
17
12
 
18
13
  # LlamaIndex Llms Integration: Openai
@@ -146,4 +141,3 @@ print(resp)
146
141
  ### LLM Implementation example
147
142
 
148
143
  https://docs.llamaindex.ai/en/stable/examples/llm/openai/
149
-
@@ -0,0 +1,9 @@
1
+ llama_index/llms/openai/__init__.py,sha256=8nmgixeXifQ4eVSgtCic54WxXqrrpXQPL4rhACWCSFs,229
2
+ llama_index/llms/openai/base.py,sha256=fu4Y1uX8IuOtVTHqaG-tyd_PpN9bUfnW6ESoyaptaVs,38620
3
+ llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,9 +0,0 @@
1
- llama_index/llms/openai/__init__.py,sha256=8nmgixeXifQ4eVSgtCic54WxXqrrpXQPL4rhACWCSFs,229
2
- llama_index/llms/openai/base.py,sha256=fu4Y1uX8IuOtVTHqaG-tyd_PpN9bUfnW6ESoyaptaVs,38620
3
- llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- llama_index/llms/openai/responses.py,sha256=SdTAqO2FqGuvm9u01BlI92IpY0RhOaJ3mU03Rc0OHso,34525
5
- llama_index/llms/openai/utils.py,sha256=FoOrExwAk6z4QOYMs60Xoewdnpcmp3YZCdUAbJyCgKU,26522
6
- llama_index_llms_openai-0.3.38.dist-info/LICENSE,sha256=JPQLUZD9rKvCTdu192Nk0V5PAwklIg6jANii3UmTyMs,1065
7
- llama_index_llms_openai-0.3.38.dist-info/METADATA,sha256=XJrs6PI7X3jUajWmoxwjUeEPYUMhbrwDFb-j3EBk42I,3322
8
- llama_index_llms_openai-0.3.38.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
9
- llama_index_llms_openai-0.3.38.dist-info/RECORD,,