MCPcopy Create free account
hub / github.com/AI45Lab/Code / llm_config

Method llm_config

core/src/config/loader.rs:458–478  ·  view source on GitHub ↗

Get LlmConfig for a specific provider and model Returns None if provider/model is not found or API key is missing.

(&self, provider_name: &str, model_id: &str)

Source from the content-addressed store, hash-verified

456 ///
457 /// Returns None if provider/model is not found or API key is missing.
458 pub fn llm_config(&self, provider_name: &str, model_id: &str) -> Option<LlmConfig> {
459 let provider = self.find_provider(provider_name)?;
460 let model = provider.find_model(model_id)?;
461 let api_key = provider.get_api_key(model)?;
462 let base_url = provider.get_base_url(model);
463 let headers = provider.get_headers(model);
464 let session_id_header = provider.get_session_id_header(model);
465
466 let mut config = LlmConfig::new(&provider.name, &model.id, api_key);
467 if let Some(url) = base_url {
468 config = config.with_base_url(url);
469 }
470 if !headers.is_empty() {
471 config = config.with_headers(headers);
472 }
473 if let Some(header_name) = session_id_header {
474 config = config.with_session_id_header(header_name);
475 }
476 config = apply_model_caps(config, model, self.thinking_budget);
477 Some(config)
478 }
479
480 /// List all available models across all providers
481 pub fn list_models(&self) -> Vec<(&ProviderConfig, &ModelConfig)> {

Callers 3

real_clientFunction · 0.80

Calls 11

apply_model_capsFunction · 0.85
find_providerMethod · 0.80
find_modelMethod · 0.80
get_api_keyMethod · 0.80
get_base_urlMethod · 0.80
get_headersMethod · 0.80
get_session_id_headerMethod · 0.80
with_base_urlMethod · 0.45
is_emptyMethod · 0.45
with_headersMethod · 0.45

Tested by 2

real_clientFunction · 0.64