Skip to content

Commit c5fc99b

Browse files
committed
chore(copilot): allows turn on thinking budget on opus or reasoning model
1 parent 4a842aa commit c5fc99b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

AgentCrew/modules/custom_llm/github_copilot_service.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ def __init__(
3737
# self._interaction_id = None
3838
logger.info("Initialized Github Copilot Service")
3939

40+
def set_think(self, budget_tokens) -> bool:
41+
"""
42+
Enable or disable thinking mode with the specified token budget.
43+
44+
Args:
45+
budget_tokens (int): Token budget for thinking. 0 to disable thinking mode.
46+
47+
Returns:
48+
bool: True if thinking mode is supported and successfully set, False otherwise.
49+
"""
50+
if "thinking" in ModelRegistry.get_model_capabilities(
51+
f"{self._provider_name}/{self.model}"
52+
):
53+
if budget_tokens == "0" or budget_tokens == "none":
54+
self.reasoning_effort = None
55+
elif budget_tokens not in ["low", "medium", "high", "max"]:
56+
raise ValueError("budget_tokens must be low, medium or high")
57+
58+
self.reasoning_effort = budget_tokens
59+
return True
60+
logger.info("Thinking mode is not supported for OpenAI models.")
61+
return False
62+
4063
def _github_copilot_token_to_open_ai_key(self, copilot_api_key):
4164
"""
4265
Convert GitHub Copilot token to OpenAI key format.

0 commit comments

Comments
 (0)