Unverified Commit bce74588 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

chore: Rust to 1.89 and edition 2024 (#2659)

parent 268d017e
......@@ -9,12 +9,12 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
ChatCompletionResponseStream, CreateChatCompletionRequest, CreateChatCompletionResponse,
},
Client,
};
/// Given a list of messages comprising a conversation, the model will return a response.
......
......@@ -11,20 +11,20 @@
use std::pin::Pin;
use bytes::Bytes;
use futures::{stream::StreamExt, Stream};
use futures::{Stream, stream::StreamExt};
use reqwest::multipart::Form;
use reqwest_eventsource::{Event, EventSource, RequestBuilderExt};
use serde::{de::DeserializeOwned, Serialize};
use serde::{Serialize, de::DeserializeOwned};
use crate::{
Assistants, Audio, AuditLogs, Batches, Chat, Completions, Embeddings, FineTuning, Invites,
Models, Projects, Responses, Threads, Uploads, Users, VectorStores,
config::{Config, OpenAIConfig},
error::{map_deserialization_error, ApiError, OpenAIError, WrappedError},
error::{ApiError, OpenAIError, WrappedError, map_deserialization_error},
file::Files,
image::Images,
moderation::Moderations,
traits::AsyncTryFrom,
Assistants, Audio, AuditLogs, Batches, Chat, Completions, Embeddings, FineTuning, Invites,
Models, Projects, Responses, Threads, Uploads, Users, VectorStores,
};
#[derive(Debug, Clone, Default)]
......
......@@ -9,7 +9,7 @@
// Licensed under Apache 2.0
//! Client configurations: [OpenAIConfig] for OpenAI, [AzureConfig] for Azure OpenAI Service.
use reqwest::header::{HeaderMap, AUTHORIZATION};
use reqwest::header::{AUTHORIZATION, HeaderMap};
use secrecy::{ExposeSecret, SecretString};
use serde::Deserialize;
......@@ -251,10 +251,10 @@ impl Config for AzureConfig {
#[cfg(test)]
mod test {
use super::*;
use crate::Client;
use crate::types::{
ChatCompletionRequestMessage, ChatCompletionRequestUserMessage, CreateChatCompletionRequest,
};
use crate::Client;
use std::sync::Arc;
#[test]
fn test_client_creation() {
......
......@@ -10,8 +10,8 @@
use std::path::{Path, PathBuf};
use base64::{engine::general_purpose, Engine as _};
use rand::{distr::Alphanumeric, Rng};
use base64::{Engine as _, engine::general_purpose};
use rand::{Rng, distr::Alphanumeric};
use reqwest::Url;
use crate::error::OpenAIError;
......
......@@ -9,10 +9,10 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{CreateBase64EmbeddingResponse, CreateEmbeddingRequest, CreateEmbeddingResponse},
Client,
};
#[cfg(not(feature = "byot"))]
......
......@@ -12,10 +12,10 @@ use bytes::Bytes;
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{CreateFileRequest, DeleteFileResponse, ListFilesResponse, OpenAIFile},
Client,
};
/// Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
......
......@@ -11,13 +11,13 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
CreateFineTuningJobRequest, FineTuningJob, ListFineTuningJobCheckpointsResponse,
ListFineTuningJobEventsResponse, ListPaginatedFineTuningJobsResponse,
},
Client,
};
/// Manage fine-tuning jobs to tailor a model to your specific training data.
......
......@@ -9,12 +9,12 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
CreateImageEditRequest, CreateImageRequest, CreateImageVariationRequest, ImagesResponse,
},
Client,
};
/// Given a prompt and/or an input image, the model will generate a new image.
......
......@@ -11,10 +11,10 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{Invite, InviteDeleteResponse, InviteListResponse, InviteRequest},
Client,
};
/// Invite and manage invitations for an organization. Invited users are automatically added to the Default project.
......
......@@ -11,13 +11,13 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
CreateMessageRequest, DeleteMessageResponse, ListMessagesResponse, MessageObject,
ModifyMessageRequest,
},
Client,
};
/// Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads).
......
......@@ -9,10 +9,10 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{DeleteModelResponse, ListModelResponse, Model},
Client,
};
/// List and describe the various models available in the API.
......
......@@ -9,10 +9,10 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{CreateModerationRequest, CreateModerationResponse},
Client,
};
/// Given text and/or image inputs, classifies if those inputs are potentially harmful across several categories.
......
......@@ -11,10 +11,10 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{ProjectApiKey, ProjectApiKeyDeleteResponse, ProjectApiKeyListResponse},
Client,
};
/// Manage API keys for a given project. Supports listing and deleting keys for users.
......
......@@ -11,6 +11,7 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
......@@ -18,7 +19,6 @@ use crate::{
ProjectServiceAccountCreateResponse, ProjectServiceAccountDeleteResponse,
ProjectServiceAccountListResponse,
},
Client,
};
/// Manage service accounts within a project. A service account is a bot user that is not
......
......@@ -11,13 +11,13 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{
ProjectUser, ProjectUserCreateRequest, ProjectUserDeleteResponse, ProjectUserListResponse,
ProjectUserUpdateRequest,
},
Client,
};
/// Manage users within a project, including adding, updating roles, and removing users.
......
......@@ -11,11 +11,11 @@
use serde::Serialize;
use crate::{
Client, ProjectServiceAccounts, ProjectUsers,
config::Config,
error::OpenAIError,
project_api_keys::ProjectAPIKeys,
types::{Project, ProjectCreateRequest, ProjectListResponse, ProjectUpdateRequest},
Client, ProjectServiceAccounts, ProjectUsers,
};
/// Manage the projects within an organization includes creation, updating, and archiving or projects.
......
......@@ -9,10 +9,10 @@
// Licensed under Apache 2.0
use crate::{
Client,
config::Config,
error::OpenAIError,
types::responses::{CreateResponse, Response, ResponseStream},
Client,
};
/// Given text input or a list of context items, the model will generate a response.
......
......@@ -11,6 +11,7 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
steps::Steps,
......@@ -18,7 +19,6 @@ use crate::{
AssistantEventStream, CreateRunRequest, ListRunsResponse, ModifyRunRequest, RunObject,
SubmitToolOutputsRunRequest,
},
Client,
};
/// Represents an execution run on a thread.
......
......@@ -11,10 +11,10 @@
use serde::Serialize;
use crate::{
Client,
config::Config,
error::OpenAIError,
types::{ListRunStepsResponse, RunStepObject},
Client,
};
/// Represents a step in execution of a run.
......
......@@ -9,13 +9,13 @@
// Licensed under Apache 2.0
use crate::{
Client, Messages, Runs,
config::Config,
error::OpenAIError,
types::{
AssistantEventStream, CreateThreadAndRunRequest, CreateThreadRequest, DeleteThreadResponse,
ModifyThreadRequest, RunObject, ThreadObject,
},
Client, Messages, Runs,
};
/// Create threads that assistants can interact with.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment