llama-index-llms-openai 0.3.9__tar.gz → 0.3.11__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.9
3
+ Version: 0.3.11
4
4
  Summary: llama-index llms openai integration
5
5
  License: MIT
6
6
  Author: llama-index
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Dist: llama-index-core (>=0.12.4,<0.13.0)
15
- Requires-Dist: openai (>=1.57.1,<2.0.0)
15
+ Requires-Dist: openai (>=1.58.1,<2.0.0)
16
16
  Description-Content-Type: text/markdown
17
17
 
18
18
  # LlamaIndex Llms Integration: Openai
@@ -34,6 +34,8 @@ DEFAULT_OPENAI_API_BASE = "https://api.openai.com/v1"
34
34
  DEFAULT_OPENAI_API_VERSION = ""
35
35
 
36
36
  O1_MODELS: Dict[str, int] = {
37
+ "o1": 200000,
38
+ "o1-2024-12-17": 200000,
37
39
  "o1-preview": 128000,
38
40
  "o1-preview-2024-09-12": 128000,
39
41
  "o1-mini": 128000,
@@ -285,6 +287,10 @@ def to_openai_message_dict(
285
287
  msg = f"Unsupported content block type: {type(block).__name__}"
286
288
  raise ValueError(msg)
287
289
 
290
+ # NOTE: Sending a blank string to openai will cause an error.
291
+ # This will commonly happen with tool calls.
292
+ content_txt = None if content_txt == "" else content_txt
293
+
288
294
  # NOTE: Despite what the openai docs say, if the role is ASSISTANT, SYSTEM
289
295
  # or TOOL, 'content' cannot be a list and must be string instead.
290
296
  # Furthermore, if all blocks are text blocks, we can use the content_txt
@@ -300,7 +306,7 @@ def to_openai_message_dict(
300
306
  # TODO: O1 models do not support system prompts
301
307
  if model is not None and model in O1_MODELS:
302
308
  if message_dict["role"] == "system":
303
- message_dict["role"] = "user"
309
+ message_dict["role"] = "developer"
304
310
 
305
311
  # NOTE: openai messages have additional arguments:
306
312
  # - function messages have `name`
@@ -29,11 +29,11 @@ exclude = ["**/BUILD"]
29
29
  license = "MIT"
30
30
  name = "llama-index-llms-openai"
31
31
  readme = "README.md"
32
- version = "0.3.9"
32
+ version = "0.3.11"
33
33
 
34
34
  [tool.poetry.dependencies]
35
35
  python = ">=3.9,<4.0"
36
- openai = "^1.57.1"
36
+ openai = "^1.58.1"
37
37
  llama-index-core = "^0.12.4"
38
38
 
39
39
  [tool.poetry.group.dev.dependencies]