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