Skip to content

Commit 470b1d6

Browse files
authored
add support for REASONING_EFFORT environment variable (#809)
1 parent 6e2236d commit 470b1d6

File tree

5 files changed

+48
-3
lines changed

5 files changed

+48
-3
lines changed

docs/ai-providers/openai.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,43 @@ holmes ask "what pods are failing?" --api-key="your-api-key"
2727
## Available Models
2828

2929
```bash
30-
# GPT-4o (default, recommended)
30+
# GPT-4o (default)
3131
holmes ask "what pods are failing?"
3232

3333
# GPT-4o mini (faster, but results are not as accurate)
3434
holmes ask "what pods are failing?" --model="gpt-4o-mini"
35+
36+
# GPT-5
37+
holmes ask "what pods are failing?" --model="gpt-5"
3538
```
3639

40+
## GPT-5 Reasoning Effort
41+
42+
When using GPT-5 models, you can control the reasoning effort level by setting the `REASONING_EFFORT` environment variable. This allows you to balance between response quality and processing time/cost.
43+
44+
```bash
45+
# Use minimal reasoning effort for faster responses
46+
export REASONING_EFFORT="minimal"
47+
holmes ask "what pods are failing?" --model="gpt-5"
48+
49+
# Use default reasoning effort
50+
export REASONING_EFFORT="medium"
51+
holmes ask "what pods are failing?" --model="gpt-5"
52+
53+
# Use high reasoning effort for complex investigations
54+
export REASONING_EFFORT="high"
55+
holmes ask "what pods are failing?" --model="gpt-5"
56+
```
57+
58+
Available reasoning effort levels:
59+
60+
- `minimal` - Fastest responses, suitable for simple queries
61+
- `low` - Balance between speed and quality
62+
- `medium` - Standard reasoning depth (default)
63+
- `high` - Deeper reasoning for complex problems
64+
65+
For more details on reasoning effort levels, refer to the [OpenAI documentation](https://platform.openai.com/docs/).
66+
3767
## Additional Resources
3868

3969
HolmesGPT uses the LiteLLM API to support OpenAI provider. Refer to [LiteLLM OpenAI docs](https://litellm.vercel.app/docs/providers/openai){:target="_blank"} for more details.

docs/installation/cli-installation.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ After installation, choose your AI provider and follow the steps below. See supp
9494

9595
3. **Ask your first question**:
9696
```bash
97+
# Uses gpt-4o by default
9798
holmes ask "what is wrong with the user-profile-import pod?"
99+
100+
# Or specify a different model
101+
holmes ask "what is wrong with the user-profile-import pod?" --model="gpt-5"
98102
```
99103

100104
=== "Azure OpenAI"

holmes/common/env_vars.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def load_bool(env_var, default: Optional[bool]) -> Optional[bool]:
3737
SENTRY_TRACES_SAMPLE_RATE = float(os.environ.get("SENTRY_TRACES_SAMPLE_RATE", "0.0"))
3838

3939
THINKING = os.environ.get("THINKING", "")
40+
REASONING_EFFORT = os.environ.get("REASONING_EFFORT", "").strip().lower()
4041
TEMPERATURE = float(os.environ.get("TEMPERATURE", "0.00000001"))
4142

4243
STREAM_CHUNKS_PER_PARSE = int(

holmes/core/llm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import litellm
1212
import os
1313
from holmes.common.env_vars import (
14+
REASONING_EFFORT,
1415
THINKING,
1516
)
1617

@@ -207,6 +208,8 @@ def completion(
207208
stream: Optional[bool] = None,
208209
) -> Union[ModelResponse, CustomStreamWrapper]:
209210
tools_args = {}
211+
allowed_openai_params = None
212+
210213
if tools and len(tools) > 0 and tool_choice == "auto":
211214
tools_args["tools"] = tools
212215
tools_args["tool_choice"] = tool_choice # type: ignore
@@ -217,6 +220,12 @@ def completion(
217220
if self.args.get("thinking", None):
218221
litellm.modify_params = True
219222

223+
if REASONING_EFFORT:
224+
self.args.setdefault("reasoning_effort", REASONING_EFFORT)
225+
allowed_openai_params = [
226+
"reasoning_effort"
227+
] # can be removed after next litelm version
228+
220229
self.args.setdefault("temperature", temperature)
221230
# Get the litellm module to use (wrapped or unwrapped)
222231
litellm_to_use = self.tracer.wrap_llm(litellm) if self.tracer else litellm
@@ -227,6 +236,7 @@ def completion(
227236
messages=messages,
228237
response_format=response_format,
229238
drop_params=drop_params,
239+
allowed_openai_params=allowed_openai_params,
230240
stream=stream,
231241
**tools_args,
232242
**self.args,

tests/llm/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ def check_llm_api_with_test_call():
236236
)
237237

238238
if azure_base:
239-
error_msg = f"Tried to use AzureAI (model: {classifier_model}) because AZURE_API_BASE was set - and failed. Check AZURE_API_BASE, AZURE_API_KEY, AZURE_API_VERSION, or unset them to use OpenAI. Exception: {type(e).__name__}: {str(e)}"
239+
error_msg = f"Exception: {type(e).__name__}: {str(e)} - Tried to use AzureAI (model: {classifier_model}) because AZURE_API_BASE was set. Check AZURE_API_BASE, AZURE_API_KEY, AZURE_API_VERSION, or unset them to use OpenAI."
240240

241241
else:
242-
error_msg = f"Tried to use OpenAI (model: {classifier_model}) Check OPENAI_API_KEY or set AZURE_API_BASE to use Azure AI. Exception: {type(e).__name__}: {str(e)}"
242+
error_msg = f"Exception: {type(e).__name__}: {str(e)} - Tried to use OpenAI (model: {classifier_model}). Check OPENAI_API_KEY or set AZURE_API_BASE to use Azure AI."
243243

244244
return False, error_msg
245245

0 commit comments

Comments
 (0)