### Vector Store File Test Setup Source: https://docs.rs/async-openai/0.34.0/src/async_openai/vectorstores/vector_store_files.rs.html Example test setup for creating and deleting vector store files. ```rust 115#[cfg(all(test, feature = "vectorstore", feature = "file"))] 116mod tests { 117 use crate::types::files::{CreateFileRequest, FileInput, FilePurpose}; 118 use crate::types::vectorstores::CreateVectorStoreRequest; 119 use crate::Client; 120 121 #[tokio::test] 122 async fn vector_store_file_creation_and_deletion( 123 ) -> Result<(), Box> { 124 let client = Client::new(); 125 126 // Create a file 127 let openai_file = client 128 .files() 129 .create(CreateFileRequest { ``` -------------------------------- ### GET /skills/byot Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Skills.html List all skills (Bring Your Own Token). ```APIDOC ## GET /skills/byot ### Description List all skills (Bring Your Own Token). ### Method GET ### Endpoint /skills/byot ### Response #### Success Response (200) - **R** - The deserialized response, must implement `DeserializeOwned`. #### Error Response - **OpenAIError** - If listing skills fails. ``` -------------------------------- ### GET /skills Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Skills.html List all skills. ```APIDOC ## GET /skills ### Description List all skills. ### Method GET ### Endpoint /skills ### Response #### Success Response (200) - **SkillListResource** - A list of available skills. #### Error Response - **OpenAIError** - If listing skills fails. ``` -------------------------------- ### GET /assistants Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/assistants_.rs.html List all available assistants. ```APIDOC ## GET /assistants ### Description Returns a list of assistants. ### Method GET ### Endpoint /assistants ### Response #### Success Response (200) - **ListAssistantsResponse** - A list of assistant objects. ``` -------------------------------- ### GetResponseQuery Struct Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/responses/api.rs.html Defines query parameters for getting a response. Allows including additional fields, enabling streaming, specifying a starting point for streaming, and enabling obfuscation. ```rust /// Query parameters for getting a response. #[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)] #[builder(name = "GetResponseQueryArgs")] #[builder(pattern = "mutable")] #[builder(setter(into, strip_option), default)] #[builder(derive(Debug))] #[builder(build_fn(error = "OpenAIError"))] pub struct GetResponseQuery { /// Additional fields to include in the response. #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>, /// If set to true, the model response data will be streamed to the client as it is generated using server-sent events. #[serde(skip_serializing_if = "Option::is_none")] pub stream: Option, /// The sequence number of the event after which to start streaming. #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option, /// When true, stream obfuscation will be enabled. #[serde(skip_serializing_if = "Option::is_none")] pub include_obfuscation: Option, } ``` -------------------------------- ### Initialize OpenAI Client Source: https://docs.rs/async-openai/0.34.0/async_openai/index.html Demonstrates various ways to instantiate the OpenAI client, including default settings, custom API keys, organization IDs, and custom HTTP clients. ```rust use async_openai::{Client, config::OpenAIConfig}; // Create a OpenAI client with api key from env var OPENAI_API_KEY and default base url. let client = Client::new(); // Above is shortcut for let config = OpenAIConfig::default(); let client = Client::with_config(config); // OR use API key from different source and a non default organization let api_key = "sk-..."; // This secret could be from a file, or environment variable. let config = OpenAIConfig::new() .with_api_key(api_key) .with_org_id("the-continental"); let client = Client::with_config(config); // Use custom reqwest client let http_client = reqwest::ClientBuilder::new().user_agent("async-openai").build().unwrap(); let client = Client::new().with_http_client(http_client); ``` -------------------------------- ### Initialize and Clone Async OpenAI Client Source: https://docs.rs/async-openai/0.34.0/src/async_openai/config.rs.html Demonstrates initializing an async OpenAI client with a configuration and cloning it. Asserts that the client's URL ends with '/v1'. ```rust let config = Arc::new(openai_config) as Arc; let client = Client::with_config(config); assert!(client.config().url("").ends_with("/v1")); let cloned_client = client.clone(); assert!(cloned_client.config().url("").ends_with("/v1")); ``` -------------------------------- ### Get Type ID Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Admin.html Gets the `TypeId` of `self`. This is a standard trait method for introspection. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Client Initialization Methods Source: https://docs.rs/async-openai/0.34.0/src/async_openai/client.rs.html Various methods to instantiate a Client, including support for custom configurations, HTTP clients, and backoff strategies. ```rust impl Client { /// Client with default [OpenAIConfig] pub fn new() -> Self { Self::default() } } impl Client { /// Create client with a custom HTTP client, OpenAI config, and backoff. #[cfg(not(target_family = "wasm"))] pub fn build( http_client: reqwest::Client, config: C, backoff: backoff::ExponentialBackoff, ) -> Self { Self { http_client, config, backoff, } } /// Create client with a custom HTTP client and config (WASM version without backoff). #[cfg(target_family = "wasm")] pub fn build(http_client: reqwest::Client, config: C) -> Self { Self { http_client, config, } } /// Create client with [OpenAIConfig] or [crate::config::AzureConfig] pub fn with_config(config: C) -> Self { Self { http_client: reqwest::Client::new(), config, #[cfg(not(target_family = "wasm"))] backoff: Default::default(), } } /// Provide your own [client] to make HTTP requests with. /// /// [client]: reqwest::Client pub fn with_http_client(mut self, http_client: reqwest::Client) -> Self { self.http_client = http_client; self } /// Exponential backoff for retrying [rate limited](https://platform.openai.com/docs/guides/rate-limits) requests. #[cfg(not(target_family = "wasm"))] pub fn with_backoff(mut self, backoff: backoff::ExponentialBackoff) -> Self { self.backoff = backoff; self } ``` -------------------------------- ### GET /stream Source: https://docs.rs/async-openai/0.34.0/src/async_openai/client.rs.html Internal method to initiate a GET request and receive a stream of events (SSE). ```APIDOC ## GET /stream ### Description Initiates a GET request to the specified path and returns a stream of deserialized objects from Server-Sent Events. ### Method GET ### Parameters #### Path Parameters - **path** (str) - Required - The API endpoint path. #### Query Parameters - **request_options** (RequestOptions) - Required - Configuration options for the request. ``` -------------------------------- ### Stream HTTP GET Requests Source: https://docs.rs/async-openai/0.34.0/src/async_openai/client.rs.html Initiates a GET request to receive Server-Sent Events (SSE), excluding WASM targets. ```rust #[allow(unused)] #[cfg(not(target_family = "wasm"))] pub(crate) async fn get_stream( &self, path: &str, request_options: &RequestOptions, ) -> Pin> + Send>> where O: DeserializeOwned + std::marker::Send + 'static, { let request_builder = self.build_request_builder(reqwest::Method::GET, path, request_options); let event_source = request_builder.eventsource().unwrap(); stream(event_source).await } ``` -------------------------------- ### Test Client Creation with OpenAIConfig Source: https://docs.rs/async-openai/0.34.0/src/async_openai/config.rs.html Demonstrates the creation of an OpenAI client using default configuration and verifies the generated URL. ```rust fn test_client_creation() { unsafe { std::env::set_var("OPENAI_API_KEY", "test") } let openai_config = OpenAIConfig::default(); let config = Box::new(openai_config.clone()) as Box; let client = Client::with_config(config); assert!(client.config().url("").ends_with("/v1")); } ``` -------------------------------- ### GET /models Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Models.html Lists the currently available models and provides basic information about each one. ```APIDOC ## GET /models ### Description Lists the currently available models, and provides basic information about each one such as the owner and availability. ### Method GET ### Endpoint /models ### Response #### Success Response (200) - **ListModelResponse** (object) - A list of available models. ``` -------------------------------- ### Initialize Audio Client Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Audio.html Creates a new instance of the Audio client. Requires a reference to an active Client with a specific Config. ```rust pub fn new(client: &'c Client) -> Self ``` -------------------------------- ### Initialize Steps Client Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/steps.rs.html Creates a new Steps client instance. Requires a configured Client, thread ID, and run ID. ```rust pub fn new(client: &'c Client, thread_id: &str, run_id: &str) -> Self { Self { client, thread_id: thread_id.into(), run_id: run_id.into(), request_options: RequestOptions::new(), } } ``` -------------------------------- ### GET /organization/groups Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/groups.rs.html Lists all groups in the organization. ```APIDOC ## GET /organization/groups ### Description Lists all groups in the organization. ### Method GET ### Endpoint /organization/groups ### Response #### Success Response (200) - **GroupListResource** (object) - A list of organization groups. ``` -------------------------------- ### Initialize ProjectCertificates Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.ProjectCertificates.html Creates a new instance of ProjectCertificates. Requires a client and the project ID. ```rust pub fn new(client: &'c Client, project_id: &str) -> Self> ``` -------------------------------- ### GET /videos Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Videos.html List all available videos. ```APIDOC ## GET /videos ### Description List Videos. ### Method GET ### Endpoint /videos ``` -------------------------------- ### Initialize FineTuning Client Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.FineTuning.html Creates a new instance of the FineTuning struct, requiring a reference to the Client. ```rust pub fn new(client: &'c Client) -> Self> ``` -------------------------------- ### Get Group Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/admin/groups/groups_.rs.html Retrieves details about a specific group. ```APIDOC ## GET /admin/groups/{group_id} ### Description Retrieves details about a specific group. ### Method GET ### Endpoint /admin/groups/{group_id} ### Path Parameters - **group_id** (string) - Required - The identifier of the group to retrieve. ### Response #### Success Response (200) - **id** (string) - Identifier for the group. - **name** (string) - Display name of the group. - **created_at** (integer) - Unix timestamp (in seconds) when the group was created. - **is_scim_managed** (boolean) - Whether the group is managed through SCIM and controlled by your identity provider. #### Response Example { "id": "sg_abc123", "name": "example_group_name", "created_at": 1678886400, "is_scim_managed": false } ``` -------------------------------- ### Create and Manage Vector Store Source: https://docs.rs/async-openai/0.34.0/src/async_openai/vectorstores/vector_store_files.rs.html Demonstrates creating a vector store with a file, checking its status, and deleting the resources. ```rust file: FileInput::from_vec_u8( String::from("meow.txt"), String::from(":3").into_bytes(), ), purpose: FilePurpose::UserData, expires_after: None, }) .await?; // Create a vector store let vecor_store_object = client .vector_stores() .create(CreateVectorStoreRequest { file_ids: Some(vec![openai_file.id.clone()]), name: None, description: None, expires_after: None, chunking_strategy: None, metadata: None, }) .await?; tokio::time::sleep(std::time::Duration::from_secs(2)).await; let vector_store_file_object = client .vector_stores() .files(&vecor_store_object.id) .retrieve(&openai_file.id) .await?; assert_eq!(vector_store_file_object.id, openai_file.id); // Delete the vector store client .vector_stores() .delete(&vecor_store_object.id) .await?; // Delete the file client.files().delete(&openai_file.id).await?; Ok(()) } } ``` -------------------------------- ### GET /organization/costs Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/usage.rs.html Retrieves the cost details for the organization. ```APIDOC ## GET /organization/costs ### Description Retrieves cost details for the organization. ### Method GET ### Endpoint /organization/costs ### Response #### Success Response (200) - **UsageResponse** (object) - The cost data for the organization. ``` -------------------------------- ### Initialize SkillVersions Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.SkillVersions.html Instantiate SkillVersions with a client and skill ID. Requires the 'skill' crate feature. ```rust pub fn new(client: &'c Client, skill_id: &str) -> Self ``` -------------------------------- ### GET /organization/certificates Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/certificates.rs.html List all certificates associated with the organization. ```APIDOC ## GET /organization/certificates ### Description Retrieve a list of all certificates for the organization. ### Method GET ### Endpoint /organization/certificates ### Response #### Success Response (200) - **ListCertificatesResponse** (object) - A list of organization certificates. ``` -------------------------------- ### Query and Retrieve Files Source: https://docs.rs/async-openai/0.34.0/src/async_openai/file.rs.html Demonstrates listing files with a query, retrieving specific file metadata, and deleting a file after a delay. ```rust let list_files = client.files().query(&query).unwrap().list().await.unwrap(); assert_eq!(list_files.data.into_iter().last().unwrap(), openai_file); let retrieved_file = client.files().retrieve(&openai_file.id).await.unwrap(); assert_eq!(openai_file.created_at, retrieved_file.created_at); assert_eq!(openai_file.bytes, retrieved_file.bytes); assert_eq!(openai_file.filename, retrieved_file.filename); assert_eq!(openai_file.purpose, retrieved_file.purpose); assert_eq!(openai_file.expires_at, retrieved_file.expires_at); /* // "To help mitigate abuse, downloading of fine-tune training files is disabled for free accounts." let retrieved_contents = client.files().retrieve_content(&openai_file.id) .await .unwrap(); assert_eq!(contents, retrieved_contents); */ // Sleep to prevent "File is still processing. Check back later." tokio::time::sleep(std::time::Duration::from_secs(15)).await; let delete_response = client.files().delete(&openai_file.id).await.unwrap(); assert_eq!(openai_file.id, delete_response.id); assert!(delete_response.deleted); ``` -------------------------------- ### GET /vector_stores Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.VectorStores.html Returns a list of all vector stores. ```APIDOC ## GET /vector_stores ### Description Returns a list of vector stores. ### Method GET ### Endpoint /vector_stores ### Response #### Success Response (200) - **response** (ListVectorStoresResponse) - A list of vector store objects. ``` -------------------------------- ### Initialize ProjectGroups Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/project_groups.rs.html Creates a new ProjectGroups instance. Requires a client and the project ID. ```rust pub fn new(client: &'c Client, project_id: &str) -> Self { Self { client, project_id: project_id.into(), request_options: RequestOptions::new(), } } ``` -------------------------------- ### GET /skills/{skill_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Skills.html Retrieve a skill by its ID. ```APIDOC ## GET /skills/{skill_id} ### Description Retrieve a skill by its ID. ### Method GET ### Endpoint /skills/{skill_id} ### Parameters #### Path Parameters - **skill_id** (str) - Required - The ID of the skill to retrieve. ### Response #### Success Response (200) - **SkillResource** - Details of the requested skill. #### Error Response - **OpenAIError** - If retrieving the skill fails. ``` -------------------------------- ### Initialize SkillVersions Source: https://docs.rs/async-openai/0.34.0/src/async_openai/skills/skill_versions.rs.html Creates a new SkillVersions instance. Requires a client and a skill ID. ```rust pub fn new(client: &'c Client, skill_id: &str) -> Self { Self { client, skill_id: skill_id.to_string(), request_options: RequestOptions::new(), } } ``` -------------------------------- ### Define Video Listing Query Parameters Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/videos/api.rs.html Defines the query parameters for listing videos, including limit, order, and pagination. The `Builder` pattern is used for construction, and it integrates with `OpenAIError` for build failures. ```rust /// Query parameters for listing videos. #[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)] #[builder(name = "ListVideosQueryArgs")] #[builder(pattern = "mutable")] #[builder(setter (into, strip_option), default)] #[builder(derive(Debug))] #[builder(build_fn(error = "OpenAIError"))] pub struct ListVideosQuery { /// Number of items to retrieve. #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, /// Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order. #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, /// Identifier for the last item from the previous pagination request. #[serde(skip_serializing_if = "Option::is_none")] pub after: Option, } ``` -------------------------------- ### GET /roles Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Roles.html Lists the roles configured for the organization. ```APIDOC ## GET /roles ### Description Lists the roles configured for the organization. ### Method GET ### Endpoint /roles ### Response #### Success Response (200) - **PublicRoleListResource** (object) - A list of organization roles. ``` -------------------------------- ### Client Constructors and Builders Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Client.html Methods for creating and configuring the Client instance. ```APIDOC ## Client Constructors and Builders ### `new()` Client with default OpenAIConfig. ```rust pub fn new() -> Self ``` ### `build()` Create client with a custom HTTP client, OpenAI config, and backoff. ```rust pub fn build( http_client: Client, config: C, backoff: ExponentialBackoff, ) -> Self ``` Available on **non-`target_family=wasm`** only. ### `with_config()` Create client with OpenAIConfig or crate::config::AzureConfig. ```rust pub fn with_config(config: C) -> Self ``` ### `with_http_client()` Provide your own client to make HTTP requests with. ```rust pub fn with_http_client(self, http_client: Client) -> Self ``` ### `with_backoff()` Exponential backoff for retrying rate limited requests. ```rust pub fn with_backoff(self, backoff: ExponentialBackoff) -> Self ``` Available on **non-`target_family=wasm`** only. ``` -------------------------------- ### Initialize ProjectRoles Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.ProjectRoles.html Creates a new instance of ProjectRoles. Requires a client reference and the project ID. ```rust pub fn new(client: &'c Client, project_id: &str) -> Self ``` -------------------------------- ### GET /batches Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Batches.html List your organization’s batches. ```APIDOC ## GET /batches ### Description List your organization’s batches. ### Method GET ### Endpoint /batches ### Response #### Success Response (200) - **list** (ListBatchesResponse) - A list of batches belonging to the organization. ``` -------------------------------- ### GET /chatkit/threads Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/chatkit/api.rs.html Query parameters for listing ChatKit threads. ```APIDOC ## GET /chatkit/threads ### Description Retrieves a list of ChatKit threads with optional filtering and pagination. ### Method GET ### Endpoint /chatkit/threads ### Parameters #### Query Parameters - **limit** (u32) - Optional - Maximum number of thread items to return. Defaults to 20. - **order** (string) - Optional - Sort order for results by creation time (asc, desc). Defaults to desc. - **after** (string) - Optional - List items created after this thread item ID. - **before** (string) - Optional - List items created before this thread item ID. - **user** (string) - Optional - Filter threads that belong to this user identifier. ``` -------------------------------- ### Build ListFineTuningEventsQuery from Args Source: https://docs.rs/async-openai/0.34.0/async_openai/types/finetuning/struct.ListFineTuningEventsQueryArgs.html Constructs a `ListFineTuningEventsQuery` object from the configured arguments. This method returns a `Result` and may fail if required fields are not initialized. ```rust pub fn build(&self) -> Result ``` -------------------------------- ### Create AzureConfig with Default Values Source: https://docs.rs/async-openai/0.34.0/src/async_openai/config.rs.html Initializes AzureConfig with default settings. Ensure to set the API key and other necessary parameters before use. ```rust impl Default for AzureConfig { fn default() -> Self { Self { api_base: Default::default(), api_key: default_api_key().into(), deployment_id: Default::default(), api_version: Default::default(), } } } ``` -------------------------------- ### GET /project_service_accounts Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/admin/project_service_accounts/project_service_accounts_.rs.html Retrieves a list of service accounts for a project. ```APIDOC ## GET /project_service_accounts ### Description Retrieves a list of all service accounts associated with the project. ### Method GET ### Response #### Success Response (200) - **object** (string) - The object type (list) - **data** (array) - List of project service accounts - **first_id** (string) - ID of the first account in the list - **last_id** (string) - ID of the last account in the list - **has_more** (boolean) - Indicates if more accounts are available ``` -------------------------------- ### Implement PolicyExt::or Source: https://docs.rs/async-openai/0.34.0/async_openai/types/admin/certificates/struct.ListOrganizationCertificatesQuery.html Creates a new Policy that returns Action::Follow if either self or other returns Action::Follow. ```rust fn or(self, other: P) -> Or where T: Policy, P: Policy, ``` -------------------------------- ### GET /evals Source: https://docs.rs/async-openai/0.34.0/src/async_openai/evals/evals_.rs.html List all evaluations associated with the current project. ```APIDOC ## GET /evals ### Description List evaluations for a project. ### Method GET ### Endpoint /evals ### Response #### Success Response (200) - **EvalList** (object) - A list of evaluation objects. ``` -------------------------------- ### Initialize Azure OpenAI Client Source: https://docs.rs/async-openai/0.34.0/async_openai/index.html Configures the client using AzureConfig with specific API base, version, deployment ID, and key. Note that the library implements the OpenAI spec and may not maintain full parity with Azure-specific features. ```rust use async_openai::{Client, config::AzureConfig}; let config = AzureConfig::new() .with_api_base("https://my-resource-name.openai.azure.com") .with_api_version("2023-03-15-preview") .with_deployment_id("deployment-id") .with_api_key("..."); let client = Client::with_config(config); // Note that `async-openai` only implements OpenAI spec // and doesn't maintain parity with the spec of Azure OpenAI service. ``` -------------------------------- ### GET /audio/voice_consents Source: https://docs.rs/async-openai/0.34.0/src/async_openai/audio/voice_consents.rs.html Retrieves a list of all voice consent recordings. ```APIDOC ## GET /audio/voice_consents ### Description Returns a list of voice consent recordings. ### Method GET ### Endpoint /audio/voice_consents ``` -------------------------------- ### Prompt Conversion Methods Source: https://docs.rs/async-openai/0.34.0/async_openai/types/chat/enum.Prompt.html This section outlines the various `from` implementations for the `Prompt` type, allowing conversion from different vector and array structures. Note that these implementations are conditional on specific crate features being enabled. ```APIDOC ## Prompt Conversion Implementations This documentation details the various ways to convert different data structures into the `Prompt` type. All implementations require specific crate features to be enabled. ### `impl From<&Vec<&[u32; N]>> for Prompt` - **Description**: Converts a vector of byte slices to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec<&[u32; N]>` ### `impl From<&Vec<&String>> for Prompt` - **Description**: Converts a vector of string slices to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec<&String>` ### `impl From<&Vec<&str>> for Prompt` - **Description**: Converts a vector of string slices to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec<&str>` ### `impl From<&Vec<[u32; N]>> for Prompt` - **Description**: Converts a vector of fixed-size byte arrays to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec<[u32; N]>` ### `impl From<&Vec> for Prompt` - **Description**: Converts a vector of `String` objects to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec` ### `impl From<&Vec>> for Prompt` - **Description**: Converts a vector of vectors of bytes to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec>` ### `impl From<&Vec> for Prompt` - **Description**: Converts a vector of bytes to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &Vec` ### `impl From<&str> for Prompt` - **Description**: Converts a string slice to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: &str` ### `impl From<[&[u32; N]; M]> for Prompt` - **Description**: Converts an array of byte slices to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [&[u32; N]; M]` ### `impl From<[&String; N]> for Prompt` - **Description**: Converts an array of string references to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [&String; N]` ### `impl From<[&Vec; N]> for Prompt` - **Description**: Converts an array of byte vector references to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [&Vec; N]` ### `impl From<[&str; N]> for Prompt` - **Description**: Converts an array of string slices to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [&str; N]` ### `impl From<[[u32; N]; M]> for Prompt` - **Description**: Converts a 2D array of bytes to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [[u32; N]; M]` ### `impl From<[String; N]> for Prompt` - **Description**: Converts an array of `String` objects to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [String; N]` ### `impl From<[Vec; N]> for Prompt` - **Description**: Converts an array of byte vectors to a `Prompt`. - **Available on**: `audio-types`, `file-types`, `image-types`, `chat-completion-types`, `completion-types`, `embedding-types`, `moderation-types`, `video-types`. - **Method**: `from` - **Parameters**: `value: [Vec; N]` ``` -------------------------------- ### GET /organization/projects/{project_id} Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/projects.rs.html Retrieves details for a specific project. ```APIDOC ## GET /organization/projects/{project_id} ### Description Retrieves a project. ### Method GET ### Endpoint /organization/projects/{project_id} ### Parameters #### Path Parameters - **project_id** (String) - Required - The ID of the project to retrieve. ### Response #### Success Response (200) - **Project** (object) - The project details. ``` -------------------------------- ### Initialize ProjectAPIKeys Client Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/project_api_keys.rs.html Instantiates the ProjectAPIKeys client for a given project ID. Requires an existing Client instance and the project's ID. ```rust pub fn new(client: &'c Client, project_id: &str) -> Self { Self { client, project_id: project_id.into(), request_options: RequestOptions::new(), } } ``` -------------------------------- ### GET /organization/projects Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/projects.rs.html Returns a list of projects within the organization. ```APIDOC ## GET /organization/projects ### Description Returns a list of projects. ### Method GET ### Endpoint /organization/projects ### Response #### Success Response (200) - **ProjectListResponse** (object) - A list of projects. ``` -------------------------------- ### GET /organization/certificates/{certificate_id} Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/certificates.rs.html Retrieve details for a specific certificate. ```APIDOC ## GET /organization/certificates/{certificate_id} ### Description Retrieve a single certificate by its ID. ### Method GET ### Endpoint /organization/certificates/{certificate_id} ### Parameters #### Path Parameters - **certificate_id** (string) - Required - The ID of the certificate to retrieve. ### Response #### Success Response (200) - **Certificate** (object) - The certificate details. ``` -------------------------------- ### Run Configuration Parameters Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/assistants/thread.rs.html This section details the parameters used to configure a run for an assistant. These parameters allow fine-grained control over the model's output and the execution of the run. ```APIDOC ## Run Configuration This document outlines the parameters available for configuring a run within the OpenAI Assistants API. These parameters allow for detailed control over the assistant's behavior during a run. ### Parameters #### Request Body Parameters - **tool_resources** (AssistantToolResources) - Optional - Specifies additional resources for tools. - **metadata** (HashMap) - Optional - A map of additional data to be provided for the run. - **temperature** (f32) - Optional - Controls randomness. Values between 0 and 2. Higher values increase randomness, lower values increase determinism. Defaults to 1.0. - **top_p** (f32) - Optional - Nucleus sampling parameter. Considers tokens comprising the top p probability mass. Defaults to 1.0. - **stream** (bool) - Optional - If true, returns a stream of events as server-sent events. Defaults to false. - **max_prompt_tokens** (u32) - Optional - The maximum number of prompt tokens to be used. The run will attempt to stay within this limit. - **max_completion_tokens** (u32) - Optional - The maximum number of completion tokens to be generated. The run will attempt to stay within this limit. - **truncation_strategy** (TruncationObject) - Optional - Controls how the thread will be truncated prior to the run, defining the initial context window. - **tool_choice** (AssistantsApiToolChoiceOption) - Optional - Specifies the tool to use for the run. - **parallel_tool_calls** (bool) - Optional - Enables parallel function calling during tool use. Defaults to true. - **response_format** (AssistantsApiResponseFormatOption) - Optional - Specifies the format for the assistant's response. ``` -------------------------------- ### GET /organization/invites Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/invites.rs.html Returns a list of all invites within the organization. ```APIDOC ## GET /organization/invites ### Description Returns a list of invites in the organization. ### Method GET ### Endpoint /organization/invites ### Response #### Success Response (200) - **InviteListResponse** (object) - A list of organization invites. ``` -------------------------------- ### Initialize Admin Module Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/admin_.rs.html Instantiates the Admin struct, which serves as a client for all administration-related APIs. Requires a generic Config type. ```rust pub struct Admin<'c, C: Config> { client: &'c Client, } impl<'c, C: Config> Admin<'c, C> { pub(crate) fn new(client: &'c Client) -> Self { Self { client } } ``` -------------------------------- ### GET /organization/admin_api_keys Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/admin_api_keys.rs.html List all organization and project API keys. ```APIDOC ## GET /organization/admin_api_keys ### Description List all organization and project API keys. ### Method GET ### Endpoint /organization/admin_api_keys ### Response #### Success Response (200) - **ApiKeyList** (object) - A list of organization and project API keys. ``` -------------------------------- ### PolicyExt Or Implementation Source: https://docs.rs/async-openai/0.34.0/async_openai/types/admin/project_users/struct.ProjectUserListResponse.html Creates a new Policy that returns Action::Follow if either self or other policies return Action::Follow. ```rust fn or(self, other: P) -> Or where T: Policy, P: Policy, ``` -------------------------------- ### POST /skills/byot Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Skills.html Create a new skill by uploading files (Bring Your Own Token). ```APIDOC ## POST /skills/byot ### Description Create a new skill by uploading files (Bring Your Own Token). ### Method POST ### Endpoint /skills/byot ### Request Body - **request** (T0) - Required - The request body for creating a skill, must implement `AsyncTryFrom`. ### Response #### Success Response (200) - **R** - The deserialized response, must implement `DeserializeOwned`. #### Error Response - **OpenAIError** - If the creation fails. ``` -------------------------------- ### GET /threads/{thread_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Threads.html Retrieves an existing thread by its ID. ```APIDOC ## GET /threads/{thread_id} ### Description Retrieves a thread. ### Method GET ### Endpoint /threads/{thread_id} ### Parameters #### Path Parameters - **thread_id** (str) - Required - The ID of the thread to retrieve. ``` -------------------------------- ### POST /assistants Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/assistants_.rs.html Create a new assistant with a model and instructions. ```APIDOC ## POST /assistants ### Description Create an assistant with a model and instructions. ### Method POST ### Endpoint /assistants ### Request Body - **request** (CreateAssistantRequest) - Required - The configuration for the new assistant. ### Response #### Success Response (200) - **AssistantObject** - The created assistant object. ``` -------------------------------- ### GET /projects/{project_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Projects.html Retrieves details for a specific project. ```APIDOC ## GET /projects/{project_id} ### Description Retrieves a project. ### Method GET ### Endpoint /projects/{project_id} ### Parameters #### Path Parameters - **project_id** (String) - Required - The ID of the project to retrieve. ### Response #### Success Response (200) - **Project** (object) - The project details. ``` -------------------------------- ### List Run Steps Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/steps.rs.html Retrieves a list of all run steps for a given run. The response includes pagination details. ```rust pub async fn list(&self) -> Result { self.client .get( &format!("/threads/{}/runs/{}/steps", self.thread_id, self.run_id), &self.request_options, ) .await } ``` -------------------------------- ### GET /projects Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Projects.html Returns a list of projects within the organization. ```APIDOC ## GET /projects ### Description Returns a list of projects. ### Method GET ### Endpoint /projects ### Response #### Success Response (200) - **ProjectListResponse** (object) - A list of projects. ``` -------------------------------- ### GET /files/{file_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Files.html Retrieve information about a specific file. ```APIDOC ## GET /files/{file_id} ### Description Returns information about a specific file. ### Method GET ### Endpoint `/files/{file_id}` ### Parameters #### Path Parameters - **file_id** (string) - Required - The ID of the file to retrieve. ### Response #### Success Response (200) - **OpenAIFile** - The file object. #### Response Example ```json { "id": "file-xxxxxxxxxxxxxxxxx", "object": "file", "bytes": 12345, "created_at": 1678886400, "filename": "example.txt", "purpose": "assistants" } ``` ``` -------------------------------- ### Retrieve File Contents Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Files.html Get the content of a specified file. ```rust pub async fn content(&self, file_id: &str) -> Result ``` -------------------------------- ### Implement From for Reasoning Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/responses/impls.rs.html Initializes `Reasoning` with a specified `ReasoningEffort`, setting `summary` to `None`. ```rust impl From for Reasoning { fn from(effort: ReasoningEffort) -> Self { Reasoning { effort: Some(effort), summary: None, } } } ``` -------------------------------- ### GET /fine_tuning/jobs Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.FineTuning.html Lists the organization's fine-tuning jobs. ```APIDOC ## GET /fine_tuning/jobs ### Description List your organization’s fine-tuning jobs. ### Method GET ### Response #### Success Response (200) - **ListPaginatedFineTuningJobsResponse** (Object) - A paginated list of fine-tuning jobs. ``` -------------------------------- ### Implement Serialize for CreateFineTuningJobRequest Source: https://docs.rs/async-openai/0.34.0/async_openai/types/finetuning/struct.CreateFineTuningJobRequest.html Enables serialization of CreateFineTuningJobRequest to a Serde serializer. ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, Serialize this value into the given Serde serializer. Read more ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.ProjectUsers.html Documentation for TryFrom and TryInto traits. ```APIDOC ### impl TryFrom for T #### Description Allows conversion from type `U` into type `T`. #### Type Alias - **Error** (`Infallible`) - The type returned in the event of a conversion error. #### Method - **try_from(value: U) -> Result>::Error>** - Performs the conversion. ### impl TryInto for T #### Description Allows conversion from type `T` into type `U`. #### Type Alias - **Error** (`>::Error`) - The type returned in the event of a conversion error. #### Method - **try_into(self) -> Result>::Error>** - Performs the conversion. ``` -------------------------------- ### GET /conversations/{conversation_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Conversations.html Retrieves an existing conversation by its ID. ```APIDOC ## GET /conversations/{conversation_id} ### Description Retrieves a conversation. ### Method GET ### Endpoint /conversations/{conversation_id} ### Parameters #### Path Parameters - **conversation_id** (str) - Required - The unique identifier of the conversation. ### Response #### Success Response (200) - **response** (ConversationResource) - The retrieved conversation resource. ``` -------------------------------- ### GET /batches/{batch_id} Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.Batches.html Retrieves a specific batch by its ID. ```APIDOC ## GET /batches/{batch_id} ### Description Retrieves a batch. ### Method GET ### Endpoint /batches/{batch_id} ### Parameters #### Path Parameters - **batch_id** (string) - Required - The ID of the batch to retrieve. ### Response #### Success Response (200) - **batch** (Batch) - The retrieved batch object. ``` -------------------------------- ### From for AssistantToolResources Source: https://docs.rs/async-openai/0.34.0/async_openai/types/assistants/struct.AssistantToolResources.html Allows conversion from AssistantToolFileSearchResources into AssistantToolResources. ```rust fn from(value: AssistantToolFileSearchResources) -> Self ``` -------------------------------- ### Create Project Source: https://docs.rs/async-openai/0.34.0/src/async_openai/admin/projects.rs.html Creates a new project in the organization. Projects can be created and archived, but not deleted. Requires `serde::Serialize` for the request and `serde::de::DeserializeOwned` for the response. ```rust pub async fn create(&self, request: ProjectCreateRequest) -> Result { self.client .post("/organization/projects", request, &self.request_options) .await } ``` -------------------------------- ### GET /files Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/files/file.rs.html Retrieve a list of files that have been uploaded to the OpenAI API. ```APIDOC ## GET /files ### Description Returns a list of files that belong to the user's organization. ### Method GET ### Endpoint /files ### Response #### Success Response (200) - **object** (String) - The object type, always "list". - **data** (Vec) - A list of file objects. - **first_id** (Option) - The ID of the first file in the list. - **last_id** (Option) - The ID of the last file in the list. - **has_more** (bool) - Indicates if there are more files available. ``` -------------------------------- ### AudioInput Implementations Source: https://docs.rs/async-openai/0.34.0/async_openai/types/audio/struct.AudioInput.html Provides methods for creating and manipulating AudioInput instances. ```APIDOC ### impl AudioInput #### pub fn from_bytes(filename: String, bytes: Bytes) -> Self Available on **crate features`audio-types` or `file-types` or `image-types` or `chat-completion-types` or `completion-types` or `embedding-types` or `moderation-types` or `video-types`** only. Creates an `AudioInput` from a filename and byte slice. #### pub fn from_vec_u8(filename: String, vec: Vec) -> Self Available on **crate features`audio-types` or `file-types` or `image-types` or `chat-completion-types` or `completion-types` or `embedding-types` or `moderation-types` or `video-types`** only. Creates an `AudioInput` from a filename and a vector of bytes. ``` -------------------------------- ### GET /containers Source: https://docs.rs/async-openai/0.34.0/src/async_openai/types/containers/api.rs.html Retrieves a list of containers with support for pagination and sorting. ```APIDOC ## GET /containers ### Description List containers with optional pagination and sorting parameters. ### Method GET ### Endpoint /containers ### Parameters #### Query Parameters - **limit** (u32) - Optional - A limit on the number of objects to be returned (1-100, default 20). - **order** (string) - Optional - Sort order by created_at timestamp ('asc' or 'desc'). - **after** (string) - Optional - A cursor for pagination, representing an object ID. ``` -------------------------------- ### Build ListProjectCertificatesQuery Source: https://docs.rs/async-openai/0.34.0/async_openai/types/admin/certificates/struct.ListProjectCertificatesQueryArgs.html Constructs a new `ListProjectCertificatesQuery` instance from the configured arguments. Returns a `Result` which may contain an `OpenAIError` if required fields are missing. ```rust pub fn build(&self) -> Result ``` -------------------------------- ### GET /threads/{thread_id}/runs Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/runs.rs.html Lists all runs associated with a thread. ```APIDOC ## GET /threads/{thread_id}/runs ### Description Returns a list of runs belonging to a thread. ### Method GET ### Endpoint /threads/{thread_id}/runs ### Parameters #### Path Parameters - **thread_id** (String) - Required - The ID of the thread. ``` -------------------------------- ### GET /assistants/{assistant_id} Source: https://docs.rs/async-openai/0.34.0/src/async_openai/assistants/assistants_.rs.html Retrieve details of a specific assistant by its ID. ```APIDOC ## GET /assistants/{assistant_id} ### Description Retrieves an assistant. ### Method GET ### Endpoint /assistants/{assistant_id} ### Parameters #### Path Parameters - **assistant_id** (str) - Required - The ID of the assistant to retrieve. ### Response #### Success Response (200) - **AssistantObject** - The assistant object. ``` -------------------------------- ### Initialize ProjectGroupRoles Source: https://docs.rs/async-openai/0.34.0/async_openai/struct.ProjectGroupRoles.html Creates a new instance of ProjectGroupRoles. Requires a client, project ID, and group ID. ```rust pub fn new(client: &'c Client, project_id: &str, group_id: &str) -> Self ```