llama-index-llms-openai 0.2.8__py3-none-any.whl → 0.2.9__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.
- llama_index/llms/openai/base.py +1 -1
- llama_index/llms/openai/utils.py +11 -0
- {llama_index_llms_openai-0.2.8.dist-info → llama_index_llms_openai-0.2.9.dist-info}/METADATA +2 -2
- llama_index_llms_openai-0.2.9.dist-info/RECORD +6 -0
- {llama_index_llms_openai-0.2.8.dist-info → llama_index_llms_openai-0.2.9.dist-info}/WHEEL +1 -1
- llama_index_llms_openai-0.2.8.dist-info/RECORD +0 -6
llama_index/llms/openai/base.py
CHANGED
|
@@ -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/utils.py
CHANGED
|
@@ -428,3 +428,14 @@ def validate_openai_api_key(api_key: Optional[str] = None) -> None:
|
|
|
428
428
|
|
|
429
429
|
if not openai_api_key:
|
|
430
430
|
raise ValueError(MISSING_API_KEY_ERROR_MESSAGE)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def resolve_tool_choice(tool_choice: Union[str, dict] = "auto") -> Union[str, dict]:
|
|
434
|
+
"""Resolve tool choice.
|
|
435
|
+
|
|
436
|
+
If tool_choice is a function name string, return the appropriate dict.
|
|
437
|
+
"""
|
|
438
|
+
if isinstance(tool_choice, str) and tool_choice not in ["none", "auto", "required"]:
|
|
439
|
+
return {"type": "function", "function": {"name": tool_choice}}
|
|
440
|
+
|
|
441
|
+
return tool_choice
|
{llama_index_llms_openai-0.2.8.dist-info → llama_index_llms_openai-0.2.9.dist-info}/METADATA
RENAMED
|
@@ -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.9
|
|
4
4
|
Summary: llama-index llms openai integration
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: llama-index
|
|
@@ -10,8 +10,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
14
|
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
15
|
Requires-Dist: openai (>=1.40.0,<2.0.0)
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
llama_index/llms/openai/__init__.py,sha256=vm3cIBSGkBFlE77GyfyN0EhpJcnJZN95QMhPN53EkbE,148
|
|
2
|
+
llama_index/llms/openai/base.py,sha256=h3jab2lijnvWRFwx2M7dlWsY48JBMmehDsU55ebjHBE,36997
|
|
3
|
+
llama_index/llms/openai/utils.py,sha256=zduRqlmGGNy7c1uoDIdDcExD47Myq9WpczVTvRid2cI,14025
|
|
4
|
+
llama_index_llms_openai-0.2.9.dist-info/METADATA,sha256=SzGCTND1cCtoBjU3qmCE5k_qhvV105uQISfoMmmj0Pw,648
|
|
5
|
+
llama_index_llms_openai-0.2.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
+
llama_index_llms_openai-0.2.9.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
llama_index/llms/openai/__init__.py,sha256=vm3cIBSGkBFlE77GyfyN0EhpJcnJZN95QMhPN53EkbE,148
|
|
2
|
-
llama_index/llms/openai/base.py,sha256=JJf0cEUZFDJnQGWGfHYLQXwr4OYQEkn96fE1jd1HgLc,37029
|
|
3
|
-
llama_index/llms/openai/utils.py,sha256=n-7uzAE23knhSCxrDS-C87Xsm_icH1nPbrdZaMPxz5I,13642
|
|
4
|
-
llama_index_llms_openai-0.2.8.dist-info/METADATA,sha256=9fBTFVSF3GpEVZgPjDFS8yYelX5ZVgwS0bygQQiaRuE,654
|
|
5
|
-
llama_index_llms_openai-0.2.8.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
6
|
-
llama_index_llms_openai-0.2.8.dist-info/RECORD,,
|