[2/2] [feature] support openai like classification api in router (#11670)
This commit is contained in:
@@ -42,6 +42,7 @@ use crate::{
|
||||
},
|
||||
protocols::{
|
||||
chat::ChatCompletionRequest,
|
||||
classify::ClassifyRequest,
|
||||
completion::CompletionRequest,
|
||||
embedding::EmbeddingRequest,
|
||||
generate::GenerateRequest,
|
||||
@@ -828,7 +829,7 @@ impl crate::routers::RouterTrait for OpenAIRouter {
|
||||
.into_response(),
|
||||
Err(e) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Json(json!({"error": format!("Failed to get response: {}", e)})),
|
||||
Json(json!({ "error": format!("Failed to get response: {}", e) })),
|
||||
)
|
||||
.into_response(),
|
||||
}
|
||||
@@ -882,6 +883,15 @@ impl crate::routers::RouterTrait for OpenAIRouter {
|
||||
(StatusCode::NOT_IMPLEMENTED, "Rerank not supported").into_response()
|
||||
}
|
||||
|
||||
async fn route_classify(
|
||||
&self,
|
||||
_headers: Option<&HeaderMap>,
|
||||
_body: &ClassifyRequest,
|
||||
_model_id: Option<&str>,
|
||||
) -> Response {
|
||||
(StatusCode::NOT_IMPLEMENTED, "Classify not supported").into_response()
|
||||
}
|
||||
|
||||
async fn create_conversation(&self, _headers: Option<&HeaderMap>, body: &Value) -> Response {
|
||||
create_conversation(&self.conversation_storage, body.clone()).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user