MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / _parse_config

Function _parse_config

optillm/plugins/deepthink_plugin.py:117–148  ·  view source on GitHub ↗

Parse and validate configuration parameters.

(request_config: Dict[str, Any])

Source from the content-addressed store, hash-verified

115 return final_response, total_tokens
116
117def _parse_config(request_config: Dict[str, Any]) -> Dict[str, Any]:
118 """Parse and validate configuration parameters."""
119
120 default_config = {
121 "deepthink_samples": 3,
122 "confidence_threshold": 0.7,
123 "max_tokens": 16382,
124 "temperature": 0.7,
125 "top_p": 0.95,
126 "enable_self_discover": True,
127 "reasoning_modules_limit": 7
128 }
129
130 # Override with request config values
131 for key, value in request_config.items():
132 if key in default_config:
133 default_config[key] = value
134
135 # Handle max_completion_tokens (preferred) or max_tokens (deprecated)
136 if 'max_completion_tokens' in request_config:
137 default_config['max_tokens'] = request_config['max_completion_tokens']
138 elif 'max_tokens' in request_config:
139 default_config['max_tokens'] = request_config['max_tokens']
140
141 # Validate ranges
142 default_config["deepthink_samples"] = max(1, min(10, default_config["deepthink_samples"]))
143 default_config["confidence_threshold"] = max(0.0, min(1.0, default_config["confidence_threshold"]))
144 default_config["temperature"] = max(0.0, min(2.0, default_config["temperature"]))
145 default_config["top_p"] = max(0.0, min(1.0, default_config["top_p"]))
146 default_config["reasoning_modules_limit"] = max(3, min(15, default_config["reasoning_modules_limit"]))
147
148 return default_config
149
150def _extract_task_description(initial_query: str, system_prompt: str) -> str:
151 """Extract a task description for SELF-DISCOVER from the query and system prompt."""

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected