llama-index-llms-openai 0.2.8__tar.gz → 0.2.10__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.
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/PKG-INFO +1 -2
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/base.py +1 -1
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/utils.py +12 -0
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/pyproject.toml +1 -2
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/README.md +0 -0
- {llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-index-llms-openai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: llama-index llms openai integration
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: llama-index
|
|
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Requires-Dist: llama-index-core (>=0.11.7,<0.12.0)
|
|
14
|
-
Requires-Dist: llama-index-utils-openai (>=0.1.0,<0.2.0)
|
|
15
14
|
Requires-Dist: openai (>=1.40.0,<2.0.0)
|
|
16
15
|
Description-Content-Type: text/markdown
|
|
17
16
|
|
{llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/base.py
RENAMED
|
@@ -63,6 +63,7 @@ from llama_index.llms.openai.utils import (
|
|
|
63
63
|
openai_modelname_to_contextsize,
|
|
64
64
|
resolve_openai_credentials,
|
|
65
65
|
to_openai_message_dicts,
|
|
66
|
+
resolve_tool_choice,
|
|
66
67
|
)
|
|
67
68
|
from llama_index.core.bridge.pydantic import (
|
|
68
69
|
BaseModel,
|
|
@@ -76,7 +77,6 @@ from openai.types.chat.chat_completion_chunk import (
|
|
|
76
77
|
ChoiceDeltaToolCall,
|
|
77
78
|
)
|
|
78
79
|
from llama_index.core.llms.utils import parse_partial_json
|
|
79
|
-
from llama_index.utils.openai import resolve_tool_choice
|
|
80
80
|
|
|
81
81
|
import llama_index.core.instrumentation as instrument
|
|
82
82
|
|
{llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/utils.py
RENAMED
|
@@ -67,6 +67,7 @@ GPT4_MODELS: Dict[str, int] = {
|
|
|
67
67
|
|
|
68
68
|
AZURE_TURBO_MODELS: Dict[str, int] = {
|
|
69
69
|
"gpt-4o": 128000,
|
|
70
|
+
"gpt-4o-mini": 128000,
|
|
70
71
|
"gpt-35-turbo-16k": 16384,
|
|
71
72
|
"gpt-35-turbo": 4096,
|
|
72
73
|
# 0125 (2024) model (JSON mode)
|
|
@@ -428,3 +429,14 @@ def validate_openai_api_key(api_key: Optional[str] = None) -> None:
|
|
|
428
429
|
|
|
429
430
|
if not openai_api_key:
|
|
430
431
|
raise ValueError(MISSING_API_KEY_ERROR_MESSAGE)
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def resolve_tool_choice(tool_choice: Union[str, dict] = "auto") -> Union[str, dict]:
|
|
435
|
+
"""Resolve tool choice.
|
|
436
|
+
|
|
437
|
+
If tool_choice is a function name string, return the appropriate dict.
|
|
438
|
+
"""
|
|
439
|
+
if isinstance(tool_choice, str) and tool_choice not in ["none", "auto", "required"]:
|
|
440
|
+
return {"type": "function", "function": {"name": tool_choice}}
|
|
441
|
+
|
|
442
|
+
return tool_choice
|
|
@@ -29,13 +29,12 @@ exclude = ["**/BUILD"]
|
|
|
29
29
|
license = "MIT"
|
|
30
30
|
name = "llama-index-llms-openai"
|
|
31
31
|
readme = "README.md"
|
|
32
|
-
version = "0.2.
|
|
32
|
+
version = "0.2.10"
|
|
33
33
|
|
|
34
34
|
[tool.poetry.dependencies]
|
|
35
35
|
python = ">=3.8.1,<4.0"
|
|
36
36
|
openai = "^1.40.0"
|
|
37
37
|
llama-index-core = "^0.11.7"
|
|
38
|
-
llama-index-utils-openai = "^0.1.0"
|
|
39
38
|
|
|
40
39
|
[tool.poetry.group.dev.dependencies]
|
|
41
40
|
ipython = "8.10.0"
|
|
File without changes
|
{llama_index_llms_openai-0.2.8 → llama_index_llms_openai-0.2.10}/llama_index/llms/openai/__init__.py
RENAMED
|
File without changes
|