pub struct Threads<'c, C: Config> { /* private fields */ }
Expand description
Create threads that assistants can interact with.
Related guide: Assistants
Implementations§
Source§impl<'c, C: Config> Threads<'c, C>
impl<'c, C: Config> Threads<'c, C>
pub fn new(client: &'c Client<C>) -> Self
Sourcepub fn messages(&self, thread_id: &str) -> Messages<'_, C>
pub fn messages(&self, thread_id: &str) -> Messages<'_, C>
Call Messages group API to manage message in [thread_id] thread.
Sourcepub fn runs(&self, thread_id: &str) -> Runs<'_, C>
pub fn runs(&self, thread_id: &str) -> Runs<'_, C>
Call Runs group API to manage runs in [thread_id] thread.
Sourcepub async fn create_and_run(
&self,
request: CreateThreadAndRunRequest,
) -> Result<RunObject, OpenAIError>
pub async fn create_and_run( &self, request: CreateThreadAndRunRequest, ) -> Result<RunObject, OpenAIError>
Create a thread and run it in one request. Create a thread and run it in one request.
Sourcepub async fn create_and_run_byot<T0: Serialize, R: DeserializeOwned>(
&self,
request: T0,
) -> Result<R, OpenAIError>
pub async fn create_and_run_byot<T0: Serialize, R: DeserializeOwned>( &self, request: T0, ) -> Result<R, OpenAIError>
Create a thread and run it in one request.
Sourcepub async fn create_and_run_stream(
&self,
request: CreateThreadAndRunRequest,
) -> Result<AssistantEventStream, OpenAIError>
pub async fn create_and_run_stream( &self, request: CreateThreadAndRunRequest, ) -> Result<AssistantEventStream, OpenAIError>
Create a thread and run it in one request (streaming).
byot: You must ensure “stream: true” in serialized request
Create a thread and run it in one request (streaming).
byot: You must ensure “stream: true” in serialized request
Sourcepub async fn create_and_run_stream_byot<T0: Serialize, R>(
&self,
request: T0,
) -> Result<Pin<Box<dyn Stream<Item = Result<R, OpenAIError>> + Send>>, OpenAIError>
pub async fn create_and_run_stream_byot<T0: Serialize, R>( &self, request: T0, ) -> Result<Pin<Box<dyn Stream<Item = Result<R, OpenAIError>> + Send>>, OpenAIError>
Create a thread and run it in one request (streaming).
byot: You must ensure “stream: true” in serialized request
Sourcepub async fn create(
&self,
request: CreateThreadRequest,
) -> Result<ThreadObject, OpenAIError>
pub async fn create( &self, request: CreateThreadRequest, ) -> Result<ThreadObject, OpenAIError>
Create a thread. Create a thread.
Sourcepub async fn create_byot<T0: Serialize, R: DeserializeOwned>(
&self,
request: T0,
) -> Result<R, OpenAIError>
pub async fn create_byot<T0: Serialize, R: DeserializeOwned>( &self, request: T0, ) -> Result<R, OpenAIError>
Create a thread.
Sourcepub async fn retrieve(
&self,
thread_id: &str,
) -> Result<ThreadObject, OpenAIError>
pub async fn retrieve( &self, thread_id: &str, ) -> Result<ThreadObject, OpenAIError>
Retrieves a thread. Retrieves a thread.
Sourcepub async fn retrieve_byot<T0: Display, R: DeserializeOwned>(
&self,
thread_id: T0,
) -> Result<R, OpenAIError>
pub async fn retrieve_byot<T0: Display, R: DeserializeOwned>( &self, thread_id: T0, ) -> Result<R, OpenAIError>
Retrieves a thread.
Sourcepub async fn update(
&self,
thread_id: &str,
request: ModifyThreadRequest,
) -> Result<ThreadObject, OpenAIError>
pub async fn update( &self, thread_id: &str, request: ModifyThreadRequest, ) -> Result<ThreadObject, OpenAIError>
Modifies a thread. Modifies a thread.
Sourcepub async fn update_byot<T0: Display, T1: Serialize, R: DeserializeOwned>(
&self,
thread_id: T0,
request: T1,
) -> Result<R, OpenAIError>
pub async fn update_byot<T0: Display, T1: Serialize, R: DeserializeOwned>( &self, thread_id: T0, request: T1, ) -> Result<R, OpenAIError>
Modifies a thread.
Sourcepub async fn delete(
&self,
thread_id: &str,
) -> Result<DeleteThreadResponse, OpenAIError>
pub async fn delete( &self, thread_id: &str, ) -> Result<DeleteThreadResponse, OpenAIError>
Delete a thread. Delete a thread.
Sourcepub async fn delete_byot<T0: Display, R: DeserializeOwned>(
&self,
thread_id: T0,
) -> Result<R, OpenAIError>
pub async fn delete_byot<T0: Display, R: DeserializeOwned>( &self, thread_id: T0, ) -> Result<R, OpenAIError>
Delete a thread.