Skip to content

Commit 914e622

Browse files
committed
cargo fmt
1 parent dd51463 commit 914e622

35 files changed

+453
-142
lines changed

async-openai/src/assistants.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,19 @@ impl<'c, C: Config> Assistants<'c, C> {
3232
&self,
3333
request: CreateAssistantRequest,
3434
) -> Result<AssistantObject, OpenAIError> {
35-
self.client.post("/assistants", request, &self.request_options).await
35+
self.client
36+
.post("/assistants", request, &self.request_options)
37+
.await
3638
}
3739

3840
/// Retrieves an assistant.
3941
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
4042
pub async fn retrieve(&self, assistant_id: &str) -> Result<AssistantObject, OpenAIError> {
4143
self.client
42-
.get(&format!("/assistants/{assistant_id}"), &self.request_options)
44+
.get(
45+
&format!("/assistants/{assistant_id}"),
46+
&self.request_options,
47+
)
4348
.await
4449
}
4550

@@ -51,15 +56,22 @@ impl<'c, C: Config> Assistants<'c, C> {
5156
request: ModifyAssistantRequest,
5257
) -> Result<AssistantObject, OpenAIError> {
5358
self.client
54-
.post(&format!("/assistants/{assistant_id}"), request, &self.request_options)
59+
.post(
60+
&format!("/assistants/{assistant_id}"),
61+
request,
62+
&self.request_options,
63+
)
5564
.await
5665
}
5766

5867
/// Delete an assistant.
5968
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
6069
pub async fn delete(&self, assistant_id: &str) -> Result<DeleteAssistantResponse, OpenAIError> {
6170
self.client
62-
.delete(&format!("/assistants/{assistant_id}"), &self.request_options)
71+
.delete(
72+
&format!("/assistants/{assistant_id}"),
73+
&self.request_options,
74+
)
6375
.await
6476
}
6577

@@ -69,6 +81,8 @@ impl<'c, C: Config> Assistants<'c, C> {
6981
where
7082
Q: Serialize + ?Sized,
7183
{
72-
self.client.get_with_query("/assistants", &query, &self.request_options).await
84+
self.client
85+
.get_with_query("/assistants", &query, &self.request_options)
86+
.await
7387
}
7488
}

async-openai/src/audit_logs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use serde::Serialize;
22

33
use crate::{
4-
config::Config, error::OpenAIError, types::admin::audit_logs::ListAuditLogsResponse, Client, RequestOptions,
4+
config::Config, error::OpenAIError, types::admin::audit_logs::ListAuditLogsResponse, Client,
5+
RequestOptions,
56
};
67

78
/// Logs of user actions and configuration changes within this organization.

async-openai/src/batches.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ impl<'c, C: Config> Batches<'c, C> {
2626
/// Creates and executes a batch from an uploaded file of requests
2727
#[crate::byot(T0 = serde::Serialize, R = serde::de::DeserializeOwned)]
2828
pub async fn create(&self, request: BatchRequest) -> Result<Batch, OpenAIError> {
29-
self.client.post("/batches", request, &self.request_options).await
29+
self.client
30+
.post("/batches", request, &self.request_options)
31+
.await
3032
}
3133

3234
/// List your organization's batches.
@@ -35,13 +37,17 @@ impl<'c, C: Config> Batches<'c, C> {
3537
where
3638
Q: Serialize + ?Sized,
3739
{
38-
self.client.get_with_query("/batches", &query, &self.request_options).await
40+
self.client
41+
.get_with_query("/batches", &query, &self.request_options)
42+
.await
3943
}
4044

4145
/// Retrieves a batch.
4246
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
4347
pub async fn retrieve(&self, batch_id: &str) -> Result<Batch, OpenAIError> {
44-
self.client.get(&format!("/batches/{batch_id}"), &self.request_options).await
48+
self.client
49+
.get(&format!("/batches/{batch_id}"), &self.request_options)
50+
.await
4551
}
4652

4753
/// Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.

async-openai/src/certificates.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ impl<'c, C: Config> Certificates<'c, C> {
5959
request: ToggleCertificatesRequest,
6060
) -> Result<ListCertificatesResponse, OpenAIError> {
6161
self.client
62-
.post("/organization/certificates/activate", request, &self.request_options)
62+
.post(
63+
"/organization/certificates/activate",
64+
request,
65+
&self.request_options,
66+
)
6367
.await
6468
}
6569

@@ -70,15 +74,22 @@ impl<'c, C: Config> Certificates<'c, C> {
7074
request: ToggleCertificatesRequest,
7175
) -> Result<ListCertificatesResponse, OpenAIError> {
7276
self.client
73-
.post("/organization/certificates/deactivate", request, &self.request_options)
77+
.post(
78+
"/organization/certificates/deactivate",
79+
request,
80+
&self.request_options,
81+
)
7482
.await
7583
}
7684

7785
/// Retrieve a single certificate.
7886
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
7987
pub async fn retrieve(&self, certificate_id: &str) -> Result<Certificate, OpenAIError> {
8088
self.client
81-
.get(format!("/organization/certificates/{certificate_id}").as_str(), &self.request_options)
89+
.get(
90+
format!("/organization/certificates/{certificate_id}").as_str(),
91+
&self.request_options,
92+
)
8293
.await
8394
}
8495

@@ -124,7 +135,10 @@ impl<'c, C: Config> Certificates<'c, C> {
124135
certificate_id: &str,
125136
) -> Result<DeleteCertificateResponse, OpenAIError> {
126137
self.client
127-
.delete(format!("/organization/certificates/{certificate_id}").as_str(), &self.request_options)
138+
.delete(
139+
format!("/organization/certificates/{certificate_id}").as_str(),
140+
&self.request_options,
141+
)
128142
.await
129143
}
130144
}

async-openai/src/chatkit.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ impl<'c, C: Config> ChatkitSessions<'c, C> {
5757
&self,
5858
request: CreateChatSessionBody,
5959
) -> Result<ChatSessionResource, OpenAIError> {
60-
self.client.post("/chatkit/sessions", request, &self.request_options).await
60+
self.client
61+
.post("/chatkit/sessions", request, &self.request_options)
62+
.await
6163
}
6264

6365
/// Cancel a ChatKit session.
@@ -93,22 +95,30 @@ impl<'c, C: Config> ChatkitThreads<'c, C> {
9395
where
9496
Q: Serialize + ?Sized,
9597
{
96-
self.client.get_with_query("/chatkit/threads", &query, &self.request_options).await
98+
self.client
99+
.get_with_query("/chatkit/threads", &query, &self.request_options)
100+
.await
97101
}
98102

99103
/// Retrieve a ChatKit thread.
100104
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
101105
pub async fn retrieve(&self, thread_id: &str) -> Result<ThreadResource, OpenAIError> {
102106
self.client
103-
.get(&format!("/chatkit/threads/{thread_id}"), &self.request_options)
107+
.get(
108+
&format!("/chatkit/threads/{thread_id}"),
109+
&self.request_options,
110+
)
104111
.await
105112
}
106113

107114
/// Delete a ChatKit thread.
108115
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
109116
pub async fn delete(&self, thread_id: &str) -> Result<DeletedThreadResource, OpenAIError> {
110117
self.client
111-
.delete(&format!("/chatkit/threads/{thread_id}"), &self.request_options)
118+
.delete(
119+
&format!("/chatkit/threads/{thread_id}"),
120+
&self.request_options,
121+
)
112122
.await
113123
}
114124

@@ -123,7 +133,11 @@ impl<'c, C: Config> ChatkitThreads<'c, C> {
123133
Q: Serialize + ?Sized,
124134
{
125135
self.client
126-
.get_with_query(&format!("/chatkit/threads/{thread_id}/items"), &query, &self.request_options)
136+
.get_with_query(
137+
&format!("/chatkit/threads/{thread_id}/items"),
138+
&query,
139+
&self.request_options,
140+
)
127141
.await
128142
}
129143
}

async-openai/src/completion.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ impl<'c, C: Config> Completions<'c, C> {
4444
));
4545
}
4646
}
47-
self.client.post("/completions", request, &self.request_options).await
47+
self.client
48+
.post("/completions", request, &self.request_options)
49+
.await
4850
}
4951

5052
/// Creates a completion request for the provided prompt and parameters
@@ -77,6 +79,9 @@ impl<'c, C: Config> Completions<'c, C> {
7779

7880
request.stream = Some(true);
7981
}
80-
Ok(self.client.post_stream("/completions", request, &self.request_options).await)
82+
Ok(self
83+
.client
84+
.post_stream("/completions", request, &self.request_options)
85+
.await)
8186
}
8287
}

async-openai/src/container_files.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ impl<'c, C: Config> ContainerFiles<'c, C> {
3838
request: CreateContainerFileRequest,
3939
) -> Result<ContainerFileResource, OpenAIError> {
4040
self.client
41-
.post_form(&format!("/containers/{}/files", self.container_id), request, &self.request_options)
41+
.post_form(
42+
&format!("/containers/{}/files", self.container_id),
43+
request,
44+
&self.request_options,
45+
)
4246
.await
4347
}
4448

@@ -49,23 +53,33 @@ impl<'c, C: Config> ContainerFiles<'c, C> {
4953
Q: Serialize + ?Sized,
5054
{
5155
self.client
52-
.get_with_query(&format!("/containers/{}/files", self.container_id), &query, &self.request_options)
56+
.get_with_query(
57+
&format!("/containers/{}/files", self.container_id),
58+
&query,
59+
&self.request_options,
60+
)
5361
.await
5462
}
5563

5664
/// Retrieve a container file.
5765
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
5866
pub async fn retrieve(&self, file_id: &str) -> Result<ContainerFileResource, OpenAIError> {
5967
self.client
60-
.get(format!("/containers/{}/files/{file_id}", self.container_id).as_str(), &self.request_options)
68+
.get(
69+
format!("/containers/{}/files/{file_id}", self.container_id).as_str(),
70+
&self.request_options,
71+
)
6172
.await
6273
}
6374

6475
/// Delete a container file.
6576
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
6677
pub async fn delete(&self, file_id: &str) -> Result<DeleteContainerFileResponse, OpenAIError> {
6778
self.client
68-
.delete(format!("/containers/{}/files/{file_id}", self.container_id).as_str(), &self.request_options)
79+
.delete(
80+
format!("/containers/{}/files/{file_id}", self.container_id).as_str(),
81+
&self.request_options,
82+
)
6983
.await
7084
}
7185

async-openai/src/containers.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ impl<'c, C: Config> Containers<'c, C> {
3434
&self,
3535
request: CreateContainerRequest,
3636
) -> Result<ContainerResource, OpenAIError> {
37-
self.client.post("/containers", request, &self.request_options).await
37+
self.client
38+
.post("/containers", request, &self.request_options)
39+
.await
3840
}
3941

4042
/// List containers.
@@ -43,22 +45,30 @@ impl<'c, C: Config> Containers<'c, C> {
4345
where
4446
Q: Serialize + ?Sized,
4547
{
46-
self.client.get_with_query("/containers", &query, &self.request_options).await
48+
self.client
49+
.get_with_query("/containers", &query, &self.request_options)
50+
.await
4751
}
4852

4953
/// Retrieve a container.
5054
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
5155
pub async fn retrieve(&self, container_id: &str) -> Result<ContainerResource, OpenAIError> {
5256
self.client
53-
.get(format!("/containers/{container_id}").as_str(), &self.request_options)
57+
.get(
58+
format!("/containers/{container_id}").as_str(),
59+
&self.request_options,
60+
)
5461
.await
5562
}
5663

5764
/// Delete a container.
5865
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
5966
pub async fn delete(&self, container_id: &str) -> Result<DeleteContainerResponse, OpenAIError> {
6067
self.client
61-
.delete(format!("/containers/{container_id}").as_str(), &self.request_options)
68+
.delete(
69+
format!("/containers/{container_id}").as_str(),
70+
&self.request_options,
71+
)
6272
.await
6373
}
6474
}

async-openai/src/conversation_items.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ impl<'c, C: Config> ConversationItems<'c, C> {
6060
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
6161
pub async fn retrieve(&self, item_id: &str) -> Result<ConversationItem, OpenAIError> {
6262
self.client
63-
.get(&format!(
64-
"/conversations/{}/items/{item_id}",
65-
&self.conversation_id
66-
), &self.request_options)
63+
.get(
64+
&format!("/conversations/{}/items/{item_id}", &self.conversation_id),
65+
&self.request_options,
66+
)
6767
.await
6868
}
6969

7070
/// Delete an item from a conversation.
7171
#[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
7272
pub async fn delete(&self, item_id: &str) -> Result<ConversationResource, OpenAIError> {
7373
self.client
74-
.delete(&format!(
75-
"/conversations/{}/items/{item_id}",
76-
&self.conversation_id
77-
), &self.request_options)
74+
.delete(
75+
&format!("/conversations/{}/items/{item_id}", &self.conversation_id),
76+
&self.request_options,
77+
)
7878
.await
7979
}
8080
}

0 commit comments

Comments
 (0)