Skip to content

Commit

Permalink
human readable key names
Browse files Browse the repository at this point in the history
  • Loading branch information
baxen committed Nov 28, 2024
1 parent 46afb7d commit ee77a9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/goose-cli/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn find_existing_profile(name: &str) -> Option<Profile> {
}

pub fn get_or_set_key(
provider_name: &str,
human_readable_name: &str,
key_name: &str,
) -> Result<String, Box<dyn std::error::Error>> {
// Try to get existing key first from keyring or environment
Expand All @@ -105,7 +105,7 @@ pub fn get_or_set_key(
}

// If no key found or error occurred, prompt user for input
let prompt = format!("Please enter your {} key:", provider_name);
let prompt = format!("Please enter your {}:", human_readable_name);
let key_val = get_env_value_or_input(key_name, &prompt, false);

// Check if user wants to save to the system keyring
Expand All @@ -129,7 +129,7 @@ pub fn get_or_set_key(
pub fn set_provider_config(provider_name: &str, model: String) -> ProviderConfig {
match provider_name.to_lowercase().as_str() {
PROVIDER_OPEN_AI => {
let api_key = get_or_set_key(provider_name, "OPENAI_API_KEY")
let api_key = get_or_set_key("OPENAI_API_KEY", "OPENAI_API_KEY")
.expect("Failed to get OpenAI API key");
ProviderConfig::OpenAi(OpenAiProviderConfig {
host: "https://api.openai.com".to_string(),
Expand All @@ -140,7 +140,7 @@ pub fn set_provider_config(provider_name: &str, model: String) -> ProviderConfig
})
}
PROVIDER_DATABRICKS => {
let host = get_or_set_key(provider_name, "DATABRICKS_HOST")
let host = get_or_set_key("databricks host url", "DATABRICKS_HOST")
.expect("Failed to get databricks host");

ProviderConfig::Databricks(DatabricksProviderConfig {
Expand Down

0 comments on commit ee77a9c

Please sign in to comment.