Skip to content

Commit

Permalink
fix: address lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Dec 10, 2024
1 parent 916db2a commit 6f63a2e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions rig-core/src/providers/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ impl Client {
/// Create a new Local client from the `LOCAL_API_KEY` environment variable.
/// Panics if the environment variable is not set.
pub fn from_env() -> Self {
let api_key = std::env::var("LOCAL_API_KEY").expect("LOCAL_API_KEY not set");
Self::new()
}

Expand Down Expand Up @@ -98,6 +97,12 @@ impl Client {
}
}

impl Default for Client {
fn default() -> Self {
Self::new()
}
}

#[derive(Debug, Deserialize)]
struct ApiErrorResponse {
message: String,
Expand Down Expand Up @@ -280,9 +285,13 @@ impl TryFrom<CompletionResponse> for completion::CompletionResponse<CompletionRe
);

// Validate the arguments are valid JSON
let parsed_args: serde_json::Value = serde_json::from_str(&call.function.arguments).map_err(|e| {
CompletionError::ResponseError(format!("Invalid tool arguments JSON: {}", e))
})?;
let parsed_args: serde_json::Value = serde_json::from_str(&call.function.arguments)
.map_err(|e| {
CompletionError::ResponseError(format!(
"Invalid tool arguments JSON: {}",
e
))
})?;

// Validate it's a JSON object
if !parsed_args.is_object() {
Expand Down

0 comments on commit 6f63a2e

Please sign in to comment.