Skip to content

Commit c32f5a1

Browse files
committed
Include encrypted content if reasoning is specified
This way, for Azure, an empty dictionary will lead to encrypted content being included
1 parent d5692c4 commit c32f5a1

File tree

2 files changed

+19
-34
lines changed

2 files changed

+19
-34
lines changed

chatlas/_provider_openai.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,13 @@ def ChatOpenAI(
175175
if service_tier is not None:
176176
kwargs_chat["service_tier"] = service_tier
177177

178-
provider = OpenAIProvider(
179-
api_key=api_key,
180-
model=model,
181-
base_url=base_url,
182-
kwargs=kwargs,
183-
)
184-
provider._is_reasoning_model = is_reasoning_model(model)
185-
186178
return Chat(
187-
provider=provider,
179+
provider=OpenAIProvider(
180+
api_key=api_key,
181+
model=model,
182+
base_url=base_url,
183+
kwargs=kwargs,
184+
),
188185
system_prompt=system_prompt,
189186
kwargs_chat=kwargs_chat,
190187
)
@@ -198,8 +195,6 @@ class OpenAIProvider(
198195
"SubmitInputArgs",
199196
]
200197
):
201-
_is_reasoning_model: bool = False
202-
203198
def chat_perform(
204199
self,
205200
*,
@@ -284,7 +279,7 @@ def _chat_perform_args(
284279

285280
# Request reasoning content for reasoning models
286281
include = []
287-
if self._is_reasoning_model:
282+
if "reasoning" in kwargs_full or is_reasoning_model(self.model):
288283
include.append("reasoning.encrypted_content")
289284

290285
if "log_probs" in kwargs_full:

chatlas/_provider_openai_azure.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from openai.types.chat import ChatCompletion
77

88
from ._chat import Chat
9-
from ._provider_openai import OpenAIProvider, is_reasoning_model
9+
from ._provider_openai import OpenAIProvider
1010
from ._provider_openai_completions import OpenAICompletionsProvider
1111
from ._utils import MISSING, MISSING_TYPE, is_testing, split_http_client_kwargs
1212

@@ -75,11 +75,10 @@ def ChatAzureOpenAI(
7575
system_prompt
7676
A system prompt to set the behavior of the assistant.
7777
reasoning
78-
The reasoning effort to use. Set this for reasoning-capable models
79-
(like the o-series). Since Azure uses custom deployment names rather
80-
than model names, chatlas cannot automatically detect reasoning models.
81-
Pass a reasoning effort string (e.g., "low", "medium", "high") or a
82-
Reasoning dict to enable reasoning features.
78+
The reasoning effort (e.g., `"low"`, `"medium"`, `"high"`) for
79+
reasoning-capable models like the o and gpt-5 series. To use the default
80+
reasoning settings in a way that will work for multi-turn conversations,
81+
set this to an empty dictionary `{}`.
8382
service_tier
8483
Request a specific service tier. Options:
8584
- `"auto"` (default): uses the service tier configured in Project settings.
@@ -98,12 +97,6 @@ def ChatAzureOpenAI(
9897

9998
kwargs_chat: "ResponsesSubmitInputArgs" = {}
10099

101-
# Detect reasoning models by checking if:
102-
# 1. The user explicitly passed reasoning parameter, OR
103-
# 2. The deployment_id matches a known reasoning model pattern (o*, gpt-5*)
104-
# This allows automatic detection when deployment names match model names,
105-
# while also supporting custom deployment names via the reasoning parameter.
106-
detected_reasoning = reasoning is not None or is_reasoning_model(deployment_id)
107100
if reasoning is not None:
108101
if isinstance(reasoning, str):
109102
reasoning = {"effort": reasoning, "summary": "auto"}
@@ -112,17 +105,14 @@ def ChatAzureOpenAI(
112105
if service_tier is not None:
113106
kwargs_chat["service_tier"] = service_tier
114107

115-
provider = OpenAIAzureProvider(
116-
endpoint=endpoint,
117-
deployment_id=deployment_id,
118-
api_version=api_version,
119-
api_key=api_key,
120-
kwargs=kwargs,
121-
)
122-
provider._is_reasoning_model = detected_reasoning
123-
124108
return Chat(
125-
provider=provider,
109+
provider=OpenAIAzureProvider(
110+
endpoint=endpoint,
111+
deployment_id=deployment_id,
112+
api_version=api_version,
113+
api_key=api_key,
114+
kwargs=kwargs,
115+
),
126116
system_prompt=system_prompt,
127117
kwargs_chat=kwargs_chat,
128118
)

0 commit comments

Comments
 (0)