Mark the non-streaming chat completions route unimplemented

This commit is contained in:
Kerollmops 2025-06-10 09:18:36 +02:00
parent 1fda05c2fd
commit 48e8356a16
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 9 additions and 2 deletions

View File

@ -390,6 +390,7 @@ InvalidDocumentEditionFunctionFilter , InvalidRequest , BAD_REQU
EditDocumentsByFunctionError , InvalidRequest , BAD_REQUEST ; EditDocumentsByFunctionError , InvalidRequest , BAD_REQUEST ;
InvalidSettingsIndexChat , InvalidRequest , BAD_REQUEST ; InvalidSettingsIndexChat , InvalidRequest , BAD_REQUEST ;
// Experimental features - Chat Completions // Experimental features - Chat Completions
UnimplementedNonStreamingChatCompletions , InvalidRequest , NOT_IMPLEMENTED ;
ChatWorkspaceNotFound , InvalidRequest , NOT_FOUND ; ChatWorkspaceNotFound , InvalidRequest , NOT_FOUND ;
InvalidChatCompletionOrgId , InvalidRequest , BAD_REQUEST ; InvalidChatCompletionOrgId , InvalidRequest , BAD_REQUEST ;
InvalidChatCompletionProjectId , InvalidRequest , BAD_REQUEST ; InvalidChatCompletionProjectId , InvalidRequest , BAD_REQUEST ;

View File

@ -301,17 +301,23 @@ async fn process_search_request(
Ok((index, documents, text)) Ok((index, documents, text))
} }
#[allow(unreachable_code, unused_variables)] // will be correctly implemented in the future
async fn non_streamed_chat( async fn non_streamed_chat(
index_scheduler: GuardedData<ActionPolicy<{ actions::CHAT_COMPLETIONS }>, Data<IndexScheduler>>, index_scheduler: GuardedData<ActionPolicy<{ actions::CHAT_COMPLETIONS }>, Data<IndexScheduler>>,
auth_ctrl: web::Data<AuthController>, auth_ctrl: web::Data<AuthController>,
search_queue: web::Data<SearchQueue>, search_queue: web::Data<SearchQueue>,
workspace_uid: &str, workspace_uid: &str,
req: HttpRequest, req: HttpRequest,
mut chat_completion: CreateChatCompletionRequest, chat_completion: CreateChatCompletionRequest,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
index_scheduler.features().check_chat_completions("using the /chats chat completions route")?; index_scheduler.features().check_chat_completions("using the /chats chat completions route")?;
let filters = index_scheduler.filters();
return Err(ResponseError::from_msg(
format!("Non-streamed chat completions is not implemented"),
Code::UnimplementedNonStreamingChatCompletions,
));
let filters = index_scheduler.filters();
let rtxn = index_scheduler.read_txn()?; let rtxn = index_scheduler.read_txn()?;
let chat_settings = match index_scheduler.chat_settings(&rtxn, workspace_uid).unwrap() { let chat_settings = match index_scheduler.chat_settings(&rtxn, workspace_uid).unwrap() {
Some(settings) => settings, Some(settings) => settings,