llama-index-llms-openai 0.4.1__py3-none-any.whl → 0.4.2__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/responses.py +11 -10
- {llama_index_llms_openai-0.4.1.dist-info → llama_index_llms_openai-0.4.2.dist-info}/METADATA +1 -1
- {llama_index_llms_openai-0.4.1.dist-info → llama_index_llms_openai-0.4.2.dist-info}/RECORD +5 -5
- {llama_index_llms_openai-0.4.1.dist-info → llama_index_llms_openai-0.4.2.dist-info}/WHEEL +0 -0
- {llama_index_llms_openai-0.4.1.dist-info → llama_index_llms_openai-0.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -36,7 +36,6 @@ from typing import (
|
|
|
36
36
|
Dict,
|
|
37
37
|
Generator,
|
|
38
38
|
List,
|
|
39
|
-
Literal,
|
|
40
39
|
Optional,
|
|
41
40
|
Protocol,
|
|
42
41
|
Sequence,
|
|
@@ -143,6 +142,9 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
143
142
|
model: name of the OpenAI model to use.
|
|
144
143
|
temperature: a float from 0 to 1 controlling randomness in generation; higher will lead to more creative, less deterministic responses.
|
|
145
144
|
max_output_tokens: the maximum number of tokens to generate.
|
|
145
|
+
reasoning_options: Optional dictionary to configure reasoning for O1 models.
|
|
146
|
+
Corresponds to the 'reasoning' parameter in the OpenAI API.
|
|
147
|
+
Example: {"effort": "low", "summary": "concise"}
|
|
146
148
|
include: Additional output data to include in the model response.
|
|
147
149
|
instructions: Instructions for the model to follow.
|
|
148
150
|
track_previous_responses: Whether to track previous responses. If true, the LLM class will statefully track previous responses.
|
|
@@ -193,6 +195,10 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
193
195
|
description="The maximum number of tokens to generate.",
|
|
194
196
|
gt=0,
|
|
195
197
|
)
|
|
198
|
+
reasoning_options: Optional[Dict[str, Any]] = Field(
|
|
199
|
+
default=None,
|
|
200
|
+
description="Optional dictionary to configure reasoning for O1 models. Example: {'effort': 'low', 'summary': 'concise'}",
|
|
201
|
+
)
|
|
196
202
|
include: Optional[List[str]] = Field(
|
|
197
203
|
default=None,
|
|
198
204
|
description="Additional output data to include in the model response.",
|
|
@@ -249,10 +255,6 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
249
255
|
api_key: str = Field(default=None, description="The OpenAI API key.")
|
|
250
256
|
api_base: str = Field(description="The base URL for OpenAI API.")
|
|
251
257
|
api_version: str = Field(description="The API version for OpenAI API.")
|
|
252
|
-
reasoning_effort: Optional[Literal["low", "medium", "high"]] = Field(
|
|
253
|
-
default=None,
|
|
254
|
-
description="The effort to use for reasoning models.",
|
|
255
|
-
)
|
|
256
258
|
context_window: Optional[int] = Field(
|
|
257
259
|
default=None,
|
|
258
260
|
description="The context window override for the model.",
|
|
@@ -269,7 +271,7 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
269
271
|
model: str = DEFAULT_OPENAI_MODEL,
|
|
270
272
|
temperature: float = DEFAULT_TEMPERATURE,
|
|
271
273
|
max_output_tokens: Optional[int] = None,
|
|
272
|
-
|
|
274
|
+
reasoning_options: Optional[Dict[str, Any]] = None,
|
|
273
275
|
include: Optional[List[str]] = None,
|
|
274
276
|
instructions: Optional[str] = None,
|
|
275
277
|
track_previous_responses: bool = False,
|
|
@@ -310,7 +312,7 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
310
312
|
model=model,
|
|
311
313
|
temperature=temperature,
|
|
312
314
|
max_output_tokens=max_output_tokens,
|
|
313
|
-
|
|
315
|
+
reasoning_options=reasoning_options,
|
|
314
316
|
include=include,
|
|
315
317
|
instructions=instructions,
|
|
316
318
|
track_previous_responses=track_previous_responses,
|
|
@@ -409,9 +411,8 @@ class OpenAIResponses(FunctionCallingLLM):
|
|
|
409
411
|
"user": self.user,
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
if self.model in O1_MODELS and self.
|
|
413
|
-
|
|
414
|
-
model_kwargs["reasoning_effort"] = {"effort": self.reasoning_effort}
|
|
414
|
+
if self.model in O1_MODELS and self.reasoning_options is not None:
|
|
415
|
+
model_kwargs["reasoning"] = self.reasoning_options
|
|
415
416
|
|
|
416
417
|
# priority is class args > additional_kwargs > runtime args
|
|
417
418
|
model_kwargs.update(self.additional_kwargs)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
llama_index/llms/openai/__init__.py,sha256=8nmgixeXifQ4eVSgtCic54WxXqrrpXQPL4rhACWCSFs,229
|
|
2
2
|
llama_index/llms/openai/base.py,sha256=LTed9nxKpEnfha_FNDBrzNP3B1CTDFwaxGyAFUXXV5o,38856
|
|
3
3
|
llama_index/llms/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
llama_index/llms/openai/responses.py,sha256=
|
|
4
|
+
llama_index/llms/openai/responses.py,sha256=_riTPjwXa5Ibv9ltjExpTpsDMRyZksHAGo87lhtjYoA,36113
|
|
5
5
|
llama_index/llms/openai/utils.py,sha256=0xO-_6FPZRFCbW5JeqJDCMzLx3WN2_vVeAApWG74oA4,28071
|
|
6
|
-
llama_index_llms_openai-0.4.
|
|
7
|
-
llama_index_llms_openai-0.4.
|
|
8
|
-
llama_index_llms_openai-0.4.
|
|
9
|
-
llama_index_llms_openai-0.4.
|
|
6
|
+
llama_index_llms_openai-0.4.2.dist-info/METADATA,sha256=r6hIdRSMwh92km_2f6ifixIADfbf_VT9LR5ImTO8Sc8,3039
|
|
7
|
+
llama_index_llms_openai-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
llama_index_llms_openai-0.4.2.dist-info/licenses/LICENSE,sha256=JPQLUZD9rKvCTdu192Nk0V5PAwklIg6jANii3UmTyMs,1065
|
|
9
|
+
llama_index_llms_openai-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
{llama_index_llms_openai-0.4.1.dist-info → llama_index_llms_openai-0.4.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|