Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style(search): format args checking and make 402 message endpoint-agnostic

Sagar Kewat88b15fbd9b3c
diff --git a/src/openhuman/search/tools/exa.rs b/src/openhuman/search/tools/exa.rs
index 1d63286da4..f3588e77b8 100644
--- a/src/openhuman/search/tools/exa.rs
+++ b/src/openhuman/search/tools/exa.rs
@@ -242,7 +242,7 @@ impl ExaClient {
}
if status == reqwest::StatusCode::PAYMENT_REQUIRED || status.as_u16() == 402 {
anyhow::bail!(
- "Exa search credits exhausted (HTTP 402). \
+ "Exa credits exhausted (HTTP 402). \
Please top up your Exa account at dashboard.exa.ai or switch search provider."
);
}
@@ -704,10 +704,18 @@ impl Tool for ExaGetContentsTool {
"urls": urls,
"text": true,
});
- if args.get("include_summary").and_then(Value::as_bool).unwrap_or(false) {
+ if args
+ .get("include_summary")
+ .and_then(Value::as_bool)
+ .unwrap_or(false)
+ {
body["summary"] = json!(true);
}
- if args.get("include_highlights").and_then(Value::as_bool).unwrap_or(false) {
+ if args
+ .get("include_highlights")
+ .and_then(Value::as_bool)
+ .unwrap_or(false)
+ {
body["highlights"] = json!(true);
}
diff --git a/src/openhuman/search/tools/exa_tests.rs b/src/openhuman/search/tools/exa_tests.rs
index b7adb9662a..9cda8fc075 100644
--- a/src/openhuman/search/tools/exa_tests.rs
+++ b/src/openhuman/search/tools/exa_tests.rs
@@ -337,7 +337,7 @@ async fn payment_required_status_surfaces_actionable_credits_error() {
post(|| async {
(
StatusCode::PAYMENT_REQUIRED,
- r#"{"error":"You have exceeded your credits limit. Please top up to keep using Exa at dashboard.exa.ai","tag":"NO_MORE_CREDITS"}"#,
+ r#"{"error":"You have exceeded your credits limit for query: private search","tag":"NO_MORE_CREDITS"}"#,
)
}),
);
@@ -350,7 +350,7 @@ async fn payment_required_status_surfaces_actionable_credits_error() {
.expect_err("402 must fail with actionable message");
let message = err.to_string();
- assert!(message.contains("Exa search credits exhausted (HTTP 402)"));
+ assert!(message.contains("Exa credits exhausted (HTTP 402)"));
assert!(message.contains("dashboard.exa.ai"));
assert!(!message.contains("private search"));
}