feat: complete docs
This commit is contained in:
+13
-7
@@ -15,33 +15,39 @@ use crate::api::routes;
|
||||
),
|
||||
),
|
||||
paths(
|
||||
// routes::v1::chat::completions,
|
||||
// routes::v1::chat::chat_completions,
|
||||
routes::v1::llm::list_models,
|
||||
// routes::v1::models::load_model,
|
||||
// routes::v1::models::unload_model,
|
||||
routes::v1::llm::completions,
|
||||
routes::v1::llm::chat_completions,
|
||||
routes::v1::llm::load_model,
|
||||
routes::v1::llm::unload_model,
|
||||
),
|
||||
components(
|
||||
schemas(
|
||||
api::errors::ErrorResponse,
|
||||
|
||||
api::types::ApiModelsResponse,
|
||||
api::types::ApiModelInfo,
|
||||
api::types::ApiModelMetadata,
|
||||
|
||||
api::types::ApiLoadModelResponse,
|
||||
api::types::ApiLoadModelRequest,
|
||||
api::types::ApiUnloadModelResponse,
|
||||
|
||||
api::types::ApiLlmOptions,
|
||||
|
||||
api::types::ApiCompletionRequest,
|
||||
api::types::ApiCompletionObject,
|
||||
api::types::ApiFinishReason,
|
||||
api::types::ApiCompletionResponse,
|
||||
api::types::ApiCompletionObject,
|
||||
api::types::Choice,
|
||||
api::types::Usage,
|
||||
api::types::CompletionChunk,
|
||||
api::types::ApiFinishReason,
|
||||
|
||||
api::types::ApiChatRequest,
|
||||
api::types::ApiMessage,
|
||||
api::types::ApiRole,
|
||||
api::types::ApiChatResponse,
|
||||
api::types::ApiChatChoice,
|
||||
|
||||
api::types::ChatCompletionChunk,
|
||||
api::types::ChatChunkChoice,
|
||||
api::types::Delta,
|
||||
|
||||
@@ -17,7 +17,7 @@ use uuid::Uuid;
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/models",
|
||||
path = "/llm/models",
|
||||
tag = "models",
|
||||
responses(
|
||||
(
|
||||
@@ -34,7 +34,6 @@ use uuid::Uuid;
|
||||
)
|
||||
)
|
||||
)]
|
||||
// #[axum::debug_handler]
|
||||
pub async fn list_models(
|
||||
State(state): State<SharedState>,
|
||||
) -> Result<Json<api::types::ApiModelsResponse>, api::errors::ApiError> {
|
||||
@@ -45,7 +44,7 @@ pub async fn list_models(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/models/{model}/load",
|
||||
path = "/llm/models/{model}/load",
|
||||
tag = "models",
|
||||
params(
|
||||
("model" = String, Path, description = "Name of the model to load into memory (e.g. 'llama3')")
|
||||
@@ -108,7 +107,7 @@ pub async fn load_model(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/models/{model}/unload",
|
||||
path = "/llm/models/{model}/unload",
|
||||
tag = "models",
|
||||
params(
|
||||
("model" = String, Path, description = "Name of the model to unload from memory (e.g. 'llama3')")
|
||||
@@ -155,7 +154,7 @@ pub async fn unload_model(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/completions",
|
||||
path = "/llm/completions",
|
||||
tag = "chat",
|
||||
request_body(
|
||||
content = api::types::ApiCompletionRequest,
|
||||
@@ -219,7 +218,7 @@ pub async fn completions(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/chat/completions",
|
||||
path = "/llm/chat/completions",
|
||||
tag = "chat",
|
||||
request_body(
|
||||
content = api::types::ApiChatRequest,
|
||||
|
||||
+6
-6
@@ -129,12 +129,12 @@ pub struct Usage {
|
||||
pub total_tokens: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
||||
pub struct CompletionChunk {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
pub choices: Vec<Choice>,
|
||||
}
|
||||
// #[derive(Debug, Serialize, Deserialize, ToSchema)]
|
||||
// pub struct CompletionChunk {
|
||||
// pub id: String,
|
||||
// pub object: String,
|
||||
// pub choices: Vec<Choice>,
|
||||
// }
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, ToSchema)]
|
||||
pub struct ApiChatRequest {
|
||||
|
||||
Reference in New Issue
Block a user