Skip to content

Commit 75b5436

Browse files
committed
style: simplification of async closure
1 parent ba44d0f commit 75b5436

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

src/llm/anthropic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,13 @@ impl LlmGenerationClient for Client {
9090
let encoded_api_key = encode(&self.api_key);
9191

9292
let resp = retryable::run(
93-
|| async {
93+
|| {
9494
self.client
9595
.post(url)
9696
.header("x-api-key", encoded_api_key.as_ref())
9797
.header("anthropic-version", "2023-06-01")
9898
.json(&payload)
9999
.send()
100-
.await
101100
},
102101
&retryable::HEAVY_LOADED_OPTIONS,
103102
)

src/llm/gemini.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl LlmGenerationClient for Client {
114114

115115
let url = self.get_api_url(request.model, "generateContent");
116116
let resp = retryable::run(
117-
|| async { self.client.post(&url).json(&payload).send().await },
117+
|| self.client.post(&url).json(&payload).send(),
118118
&retryable::HEAVY_LOADED_OPTIONS,
119119
)
120120
.await?;
@@ -173,7 +173,7 @@ impl LlmEmbeddingClient for Client {
173173
payload["taskType"] = serde_json::Value::String(task_type.into());
174174
}
175175
let resp = retryable::run(
176-
|| async { self.client.post(&url).json(&payload).send().await },
176+
|| self.client.post(&url).json(&payload).send(),
177177
&retryable::HEAVY_LOADED_OPTIONS,
178178
)
179179
.await?;

src/llm/ollama.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ impl LlmGenerationClient for Client {
6666
stream: Some(false),
6767
};
6868
let res = retryable::run(
69-
|| async {
69+
|| {
7070
self.reqwest_client
7171
.post(self.generate_url.as_str())
7272
.json(&req)
7373
.send()
74-
.await
7574
},
7675
&retryable::HEAVY_LOADED_OPTIONS,
7776
)

src/llm/voyage.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,12 @@ impl LlmEmbeddingClient for Client {
7676
}
7777

7878
let resp = retryable::run(
79-
|| async {
79+
|| {
8080
self.client
8181
.post(url)
8282
.header("Authorization", format!("Bearer {}", self.api_key))
8383
.json(&payload)
8484
.send()
85-
.await
8685
},
8786
&retryable::HEAVY_LOADED_OPTIONS,
8887
)

0 commit comments

Comments
 (0)