llama-index-llms-openai 0.3.21__tar.gz → 0.3.22__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.
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Jerry Liu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-index-llms-openai
3
- Version: 0.3.21
3
+ Version: 0.3.22
4
4
  Summary: llama-index llms openai integration
5
5
  License: MIT
6
6
  Author: llama-index
@@ -626,10 +626,19 @@ def update_tool_calls(
626
626
  # validations to get passed by mypy
627
627
  assert t.function is not None
628
628
  assert tc_delta.function is not None
629
- assert t.function.arguments is not None
630
- assert t.function.name is not None
631
- assert t.id is not None
632
629
 
630
+ # Initialize fields if they're None
631
+ # OpenAI(or Compatible)'s streaming API can return partial tool call
632
+ # information across multiple chunks where some fields may be None in
633
+ # initial chunks and populated in subsequent ones
634
+ if t.function.arguments is None:
635
+ t.function.arguments = ""
636
+ if t.function.name is None:
637
+ t.function.name = ""
638
+ if t.id is None:
639
+ t.id = ""
640
+
641
+ # Update with delta values
633
642
  t.function.arguments += tc_delta.function.arguments or ""
634
643
  t.function.name += tc_delta.function.name or ""
635
644
  t.id += tc_delta.id or ""
@@ -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.21"
32
+ version = "0.3.22"
33
33
 
34
34
  [tool.poetry.dependencies]
35
35
  python = ">=3.9,<4.0"