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

Method from_cli

codewiki/src/config.py:158–223  ·  view source on GitHub ↗

Create configuration for CLI context. Args: repo_path: Repository path output_dir: Output directory for generated docs llm_base_url: LLM API base URL llm_api_key: LLM API key main_model: Primary model cluster_m

(
        cls,
        repo_path: str,
        output_dir: str,
        llm_base_url: str,
        llm_api_key: str,
        main_model: str,
        cluster_model: str,
        fallback_model: str = FALLBACK_MODEL_1,
        provider: str = "openai-compatible",
        aws_region: str = "us-east-1",
        api_version: str = "2024-12-01-preview",
        azure_deployment: str = "",
        max_tokens: int = DEFAULT_MAX_TOKENS,
        max_token_per_module: int = DEFAULT_MAX_TOKEN_PER_MODULE,
        max_token_per_leaf_module: int = DEFAULT_MAX_TOKEN_PER_LEAF_MODULE,
        max_depth: int = MAX_DEPTH,
        agent_instructions: Optional[Dict[str, Any]] = None
    )

Source from the content-addressed store, hash-verified

156
157 @classmethod
158 def from_cli(
159 cls,
160 repo_path: str,
161 output_dir: str,
162 llm_base_url: str,
163 llm_api_key: str,
164 main_model: str,
165 cluster_model: str,
166 fallback_model: str = FALLBACK_MODEL_1,
167 provider: str = "openai-compatible",
168 aws_region: str = "us-east-1",
169 api_version: str = "2024-12-01-preview",
170 azure_deployment: str = "",
171 max_tokens: int = DEFAULT_MAX_TOKENS,
172 max_token_per_module: int = DEFAULT_MAX_TOKEN_PER_MODULE,
173 max_token_per_leaf_module: int = DEFAULT_MAX_TOKEN_PER_LEAF_MODULE,
174 max_depth: int = MAX_DEPTH,
175 agent_instructions: Optional[Dict[str, Any]] = None
176 ) -> 'Config':
177 """
178 Create configuration for CLI context.
179
180 Args:
181 repo_path: Repository path
182 output_dir: Output directory for generated docs
183 llm_base_url: LLM API base URL
184 llm_api_key: LLM API key
185 main_model: Primary model
186 cluster_model: Clustering model
187 fallback_model: Fallback model
188 provider: LLM provider type (openai-compatible, atlas-cloud, anthropic, bedrock, azure-openai)
189 aws_region: AWS region for Bedrock provider
190 api_version: Azure OpenAI API version
191 azure_deployment: Azure OpenAI deployment name
192 max_tokens: Maximum tokens for LLM response
193 max_token_per_module: Maximum tokens per module for clustering
194 max_token_per_leaf_module: Maximum tokens per leaf module
195 max_depth: Maximum depth for hierarchical decomposition
196 agent_instructions: Custom agent instructions dict
197
198 Returns:
199 Config instance
200 """
201 repo_name = os.path.basename(os.path.normpath(repo_path))
202 base_output_dir = os.path.join(output_dir, "temp")
203
204 return cls(
205 repo_path=repo_path,
206 output_dir=base_output_dir,
207 dependency_graph_dir=os.path.join(base_output_dir, DEPENDENCY_GRAPHS_DIR),
208 docs_dir=output_dir,
209 max_depth=max_depth,
210 llm_base_url=llm_base_url,
211 llm_api_key=llm_api_key,
212 main_model=main_model,
213 cluster_model=cluster_model,
214 fallback_model=fallback_model,
215 provider=provider,

Callers 3

generateMethod · 0.80
to_backend_configMethod · 0.80
_legacy_generate_docsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected