async_openai/assistants/
steps.rs1use crate::{
2 config::Config,
3 error::OpenAIError,
4 types::assistants::{ListRunStepsResponse, RunStepObject},
5 Client, RequestOptions,
6};
7
8#[deprecated(
10 note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
11)]
12pub struct Steps<'c, C: Config> {
13 pub thread_id: String,
14 pub run_id: String,
15 client: &'c Client<C>,
16 pub(crate) request_options: RequestOptions,
17}
18
19impl<'c, C: Config> Steps<'c, C> {
20 pub fn new(client: &'c Client<C>, thread_id: &str, run_id: &str) -> Self {
21 Self {
22 client,
23 thread_id: thread_id.into(),
24 run_id: run_id.into(),
25 request_options: RequestOptions::new(),
26 }
27 }
28
29 #[crate::byot(T0 = std::fmt::Display, R = serde::de::DeserializeOwned)]
31 pub async fn retrieve(&self, step_id: &str) -> Result<RunStepObject, OpenAIError> {
32 self.client
33 .get(
34 &format!(
35 "/threads/{}/runs/{}/steps/{step_id}",
36 self.thread_id, self.run_id
37 ),
38 &self.request_options,
39 )
40 .await
41 }
42
43 #[crate::byot(R = serde::de::DeserializeOwned)]
45 pub async fn list(&self) -> Result<ListRunStepsResponse, OpenAIError> {
46 self.client
47 .get(
48 &format!("/threads/{}/runs/{}/steps", self.thread_id, self.run_id),
49 &self.request_options,
50 )
51 .await
52 }
53}