MCPcopy Index your code
hub / github.com/FSoft-AI4Code/CodeWiki / from_dict

Method from_dict

codewiki/cli/models/config.py:182–211  ·  view source on GitHub ↗

Create Configuration from dictionary. Args: data: Configuration dictionary Returns: Configuration instance

(cls, data: dict)

Source from the content-addressed store, hash-verified

180
181 @classmethod
182 def from_dict(cls, data: dict) -> 'Configuration':
183 """
184 Create Configuration from dictionary.
185
186 Args:
187 data: Configuration dictionary
188
189 Returns:
190 Configuration instance
191 """
192 agent_instructions = AgentInstructions()
193 if 'agent_instructions' in data:
194 agent_instructions = AgentInstructions.from_dict(data['agent_instructions'])
195
196 return cls(
197 base_url=data.get('base_url', ''),
198 main_model=data.get('main_model', ''),
199 cluster_model=data.get('cluster_model', ''),
200 fallback_model=data.get('fallback_model', 'glm-4p5'),
201 default_output=data.get('default_output', 'docs'),
202 provider=data.get('provider', 'openai-compatible'),
203 aws_region=data.get('aws_region', 'us-east-1'),
204 api_version=data.get('api_version', '2024-12-01-preview'),
205 azure_deployment=data.get('azure_deployment', ''),
206 max_tokens=data.get('max_tokens', 32768),
207 max_token_per_module=data.get('max_token_per_module', 36369),
208 max_token_per_leaf_module=data.get('max_token_per_leaf_module', 16000),
209 max_depth=data.get('max_depth', 2),
210 agent_instructions=agent_instructions,
211 )
212
213 def is_complete(self) -> bool:
214 """Check if all required fields are set.

Callers 1

loadMethod · 0.45

Calls 2

AgentInstructionsClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected